{"action":"created","comment":{"url":"https://api.github.com/repos/mryab/askme/pulls/comments/90469747","pull_request_review_id":9516467,"id":90469747,"diff_hunk":"@@ -0,0 +1,701 @@\n+# coding: utf-8\n+\n+# # L1 - Градиентый спуск и линейные модели\n+\n+# In[1]:\n+\n+import numpy as np\n+import matplotlib\n+import matplotlib.pyplot as plt\n+from mpl_toolkits.mplot3d import Axes3D\n+from scipy.optimize import minimize\n+import math\n+\n+get_ipython().magic('matplotlib notebook')\n+matplotlib.rcParams['figure.figsize'] = '12,8'\n+matplotlib.rcParams['figure.max_open_warning'] = False\n+\n+\n+# In[2]:\n+\n+def plot_figure_setup(xlabel='x', ylabel='y', hline=False, vline=False, equal_axes=False):\n+    f = plt.figure()\n+    if equal_axes:\n+        plt.axis('equal')\n+    plt.xlabel(xlabel)\n+    plt.ylabel(ylabel)\n+    plt.grid(True, which='both')\n+    if hline:\n+        plt.axhline(color='k', alpha=0.7)\n+    if vline:\n+        plt.axvline(color='k', alpha=0.7)\n+    return f\n+\n+\n+# In[3]:\n+\n+SAMPLE_NUM = 20000\n+\n+first = np.random.normal(-1, 1, (SAMPLE_NUM // 2, 2))\n+second = np.random.normal(1.7, 1, (SAMPLE_NUM // 2, 2))\n+\n+X = np.c_[np.ones(SAMPLE_NUM), np.concatenate((first, second))]\n+Y = np.r_[np.ones(SAMPLE_NUM // 2), -np.ones(SAMPLE_NUM // 2)].reshape(SAMPLE_NUM)\n+\n+w_exact = np.linalg.inv(X.T.dot(X)).dot(X.T).dot(Y)\n+\n+x_ax = np.linspace(-5, 5, 2)\n+y_ax_exact = np.array(-(w_exact[0] / w_exact[1]) - (w_exact[2] / w_exact[1]) * x_ax)\n+\n+plot_figure_setup(hline=True, vline=True, equal_axes=True)\n+plt.scatter(first.T[0], first.T[1], c='green', alpha=0.2)\n+plt.scatter(second.T[0], second.T[1], c='red', alpha=0.2)\n+plt.plot(x_ax, y_ax_exact.T, color='b')","path":"L1 - Gradient descent and linear models.py","position":53,"original_position":53,"commit_id":"6654fa258c87aae180a81bc67c2690f485a337d8","original_commit_id":"6654fa258c87aae180a81bc67c2690f485a337d8","user":{"login":"dasimagin","id":16786407,"avatar_url":"https://avatars.githubusercontent.com/u/16786407?v=3","gravatar_id":"","url":"https://api.github.com/users/dasimagin","html_url":"https://github.com/dasimagin","followers_url":"https://api.github.com/users/dasimagin/followers","following_url":"https://api.github.com/users/dasimagin/following{/other_user}","gists_url":"https://api.github.com/users/dasimagin/gists{/gist_id}","starred_url":"https://api.github.com/users/dasimagin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dasimagin/subscriptions","organizations_url":"https://api.github.com/users/dasimagin/orgs","repos_url":"https://api.github.com/users/dasimagin/repos","events_url":"https://api.github.com/users/dasimagin/events{/privacy}","received_events_url":"https://api.github.com/users/dasimagin/received_events","type":"User","site_admin":false},"body":"Нет причин для транспонирования.","created_at":"2016-12-01T15:31:43Z","updated_at":"2016-12-01T15:33:41Z","html_url":"https://github.com/mryab/askme/pull/1#discussion_r90469747","pull_request_url":"https://api.github.com/repos/mryab/askme/pulls/1","_links":{"self":{"href":"https://api.github.com/repos/mryab/askme/pulls/comments/90469747"},"html":{"href":"https://github.com/mryab/askme/pull/1#discussion_r90469747"},"pull_request":{"href":"https://api.github.com/repos/mryab/askme/pulls/1"}}},"pull_request":{"url":"https://api.github.com/repos/mryab/askme/pulls/1","id":94532793,"html_url":"https://github.com/mryab/askme/pull/1","diff_url":"https://github.com/mryab/askme/pull/1.diff","patch_url":"https://github.com/mryab/askme/pull/1.patch","issue_url":"https://api.github.com/repos/mryab/askme/issues/1","number":1,"state":"closed","locked":false,"title":"Lab1 solution","user":{"login":"mryab","id":16766985,"avatar_url":"https://avatars.githubusercontent.com/u/16766985?v=3","gravatar_id":"","url":"https://api.github.com/users/mryab","html_url":"https://github.com/mryab","followers_url":"https://api.github.com/users/mryab/followers","following_url":"https://api.github.com/users/mryab/following{/other_user}","gists_url":"https://api.github.com/users/mryab/gists{/gist_id}","starred_url":"https://api.github.com/users/mryab/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mryab/subscriptions","organizations_url":"https://api.github.com/users/mryab/orgs","repos_url":"https://api.github.com/users/mryab/repos","events_url":"https://api.github.com/users/mryab/events{/privacy}","received_events_url":"https://api.github.com/users/mryab/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-11-20T21:16:45Z","updated_at":"2016-12-01T15:33:41Z","closed_at":"2016-11-30T22:02:29Z","merged_at":"2016-11-30T22:02:29Z","merge_commit_sha":"888228275f3cd1f9d2503209508e4f1cf940eb13","assignee":{"login":"dasimagin","id":16786407,"avatar_url":"https://avatars.githubusercontent.com/u/16786407?v=3","gravatar_id":"","url":"https://api.github.com/users/dasimagin","html_url":"https://github.com/dasimagin","followers_url":"https://api.github.com/users/dasimagin/followers","following_url":"https://api.github.com/users/dasimagin/following{/other_user}","gists_url":"https://api.github.com/users/dasimagin/gists{/gist_id}","starred_url":"https://api.github.com/users/dasimagin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dasimagin/subscriptions","organizations_url":"https://api.github.com/users/dasimagin/orgs","repos_url":"https://api.github.com/users/dasimagin/repos","events_url":"https://api.github.com/users/dasimagin/events{/privacy}","received_events_url":"https://api.github.com/users/dasimagin/received_events","type":"User","site_admin":false},"assignees":[{"login":"dasimagin","id":16786407,"avatar_url":"https://avatars.githubusercontent.com/u/16786407?v=3","gravatar_id":"","url":"https://api.github.com/users/dasimagin","html_url":"https://github.com/dasimagin","followers_url":"https://api.github.com/users/dasimagin/followers","following_url":"https://api.github.com/users/dasimagin/following{/other_user}","gists_url":"https://api.github.com/users/dasimagin/gists{/gist_id}","starred_url":"https://api.github.com/users/dasimagin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dasimagin/subscriptions","organizations_url":"https://api.github.com/users/dasimagin/orgs","repos_url":"https://api.github.com/users/dasimagin/repos","events_url":"https://api.github.com/users/dasimagin/events{/privacy}","received_events_url":"https://api.github.com/users/dasimagin/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/mryab/askme/pulls/1/commits","review_comments_url":"https://api.github.com/repos/mryab/askme/pulls/1/comments","review_comment_url":"https://api.github.com/repos/mryab/askme/pulls/comments{/number}","comments_url":"https://api.github.com/repos/mryab/askme/issues/1/comments","statuses_url":"https://api.github.com/repos/mryab/askme/statuses/6654fa258c87aae180a81bc67c2690f485a337d8","head":{"label":"mryab:lab1","ref":"lab1","sha":"6654fa258c87aae180a81bc67c2690f485a337d8","user":{"login":"mryab","id":16766985,"avatar_url":"https://avatars.githubusercontent.com/u/16766985?v=3","gravatar_id":"","url":"https://api.github.com/users/mryab","html_url":"https://github.com/mryab","followers_url":"https://api.github.com/users/mryab/followers","following_url":"https://api.github.com/users/mryab/following{/other_user}","gists_url":"https://api.github.com/users/mryab/gists{/gist_id}","starred_url":"https://api.github.com/users/mryab/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mryab/subscriptions","organizations_url":"https://api.github.com/users/mryab/orgs","repos_url":"https://api.github.com/users/mryab/repos","events_url":"https://api.github.com/users/mryab/events{/privacy}","received_events_url":"https://api.github.com/users/mryab/received_events","type":"User","site_admin":false},"repo":{"id":73577487,"name":"askme","full_name":"mryab/askme","owner":{"login":"mryab","id":16766985,"avatar_url":"https://avatars.githubusercontent.com/u/16766985?v=3","gravatar_id":"","url":"https://api.github.com/users/mryab","html_url":"https://github.com/mryab","followers_url":"https://api.github.com/users/mryab/followers","following_url":"https://api.github.com/users/mryab/following{/other_user}","gists_url":"https://api.github.com/users/mryab/gists{/gist_id}","starred_url":"https://api.github.com/users/mryab/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mryab/subscriptions","organizations_url":"https://api.github.com/users/mryab/orgs","repos_url":"https://api.github.com/users/mryab/repos","events_url":"https://api.github.com/users/mryab/events{/privacy}","received_events_url":"https://api.github.com/users/mryab/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/mryab/askme","description":"Implementation of the «Dynamic Memory Networks for Natural Language Processing» article","fork":false,"url":"https://api.github.com/repos/mryab/askme","forks_url":"https://api.github.com/repos/mryab/askme/forks","keys_url":"https://api.github.com/repos/mryab/askme/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mryab/askme/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mryab/askme/teams","hooks_url":"https://api.github.com/repos/mryab/askme/hooks","issue_events_url":"https://api.github.com/repos/mryab/askme/issues/events{/number}","events_url":"https://api.github.com/repos/mryab/askme/events","assignees_url":"https://api.github.com/repos/mryab/askme/assignees{/user}","branches_url":"https://api.github.com/repos/mryab/askme/branches{/branch}","tags_url":"https://api.github.com/repos/mryab/askme/tags","blobs_url":"https://api.github.com/repos/mryab/askme/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mryab/askme/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mryab/askme/git/refs{/sha}","trees_url":"https://api.github.com/repos/mryab/askme/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mryab/askme/statuses/{sha}","languages_url":"https://api.github.com/repos/mryab/askme/languages","stargazers_url":"https://api.github.com/repos/mryab/askme/stargazers","contributors_url":"https://api.github.com/repos/mryab/askme/contributors","subscribers_url":"https://api.github.com/repos/mryab/askme/subscribers","subscription_url":"https://api.github.com/repos/mryab/askme/subscription","commits_url":"https://api.github.com/repos/mryab/askme/commits{/sha}","git_commits_url":"https://api.github.com/repos/mryab/askme/git/commits{/sha}","comments_url":"https://api.github.com/repos/mryab/askme/comments{/number}","issue_comment_url":"https://api.github.com/repos/mryab/askme/issues/comments{/number}","contents_url":"https://api.github.com/repos/mryab/askme/contents/{+path}","compare_url":"https://api.github.com/repos/mryab/askme/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mryab/askme/merges","archive_url":"https://api.github.com/repos/mryab/askme/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mryab/askme/downloads","issues_url":"https://api.github.com/repos/mryab/askme/issues{/number}","pulls_url":"https://api.github.com/repos/mryab/askme/pulls{/number}","milestones_url":"https://api.github.com/repos/mryab/askme/milestones{/number}","notifications_url":"https://api.github.com/repos/mryab/askme/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mryab/askme/labels{/name}","releases_url":"https://api.github.com/repos/mryab/askme/releases{/id}","deployments_url":"https://api.github.com/repos/mryab/askme/deployments","created_at":"2016-11-12T20:45:14Z","updated_at":"2016-11-30T22:02:31Z","pushed_at":"2016-11-30T22:02:36Z","git_url":"git://github.com/mryab/askme.git","ssh_url":"git@github.com:mryab/askme.git","clone_url":"https://github.com/mryab/askme.git","svn_url":"https://github.com/mryab/askme","homepage":"","size":5959,"stargazers_count":0,"watchers_count":0,"language":"Jupyter Notebook","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"mryab:master","ref":"master","sha":"eb3baf0e81e1d371ecc9f77a92993eb7fede7196","user":{"login":"mryab","id":16766985,"avatar_url":"https://avatars.githubusercontent.com/u/16766985?v=3","gravatar_id":"","url":"https://api.github.com/users/mryab","html_url":"https://github.com/mryab","followers_url":"https://api.github.com/users/mryab/followers","following_url":"https://api.github.com/users/mryab/following{/other_user}","gists_url":"https://api.github.com/users/mryab/gists{/gist_id}","starred_url":"https://api.github.com/users/mryab/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mryab/subscriptions","organizations_url":"https://api.github.com/users/mryab/orgs","repos_url":"https://api.github.com/users/mryab/repos","events_url":"https://api.github.com/users/mryab/events{/privacy}","received_events_url":"https://api.github.com/users/mryab/received_events","type":"User","site_admin":false},"repo":{"id":73577487,"name":"askme","full_name":"mryab/askme","owner":{"login":"mryab","id":16766985,"avatar_url":"https://avatars.githubusercontent.com/u/16766985?v=3","gravatar_id":"","url":"https://api.github.com/users/mryab","html_url":"https://github.com/mryab","followers_url":"https://api.github.com/users/mryab/followers","following_url":"https://api.github.com/users/mryab/following{/other_user}","gists_url":"https://api.github.com/users/mryab/gists{/gist_id}","starred_url":"https://api.github.com/users/mryab/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mryab/subscriptions","organizations_url":"https://api.github.com/users/mryab/orgs","repos_url":"https://api.github.com/users/mryab/repos","events_url":"https://api.github.com/users/mryab/events{/privacy}","received_events_url":"https://api.github.com/users/mryab/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/mryab/askme","description":"Implementation of the «Dynamic Memory Networks for Natural Language Processing» article","fork":false,"url":"https://api.github.com/repos/mryab/askme","forks_url":"https://api.github.com/repos/mryab/askme/forks","keys_url":"https://api.github.com/repos/mryab/askme/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mryab/askme/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mryab/askme/teams","hooks_url":"https://api.github.com/repos/mryab/askme/hooks","issue_events_url":"https://api.github.com/repos/mryab/askme/issues/events{/number}","events_url":"https://api.github.com/repos/mryab/askme/events","assignees_url":"https://api.github.com/repos/mryab/askme/assignees{/user}","branches_url":"https://api.github.com/repos/mryab/askme/branches{/branch}","tags_url":"https://api.github.com/repos/mryab/askme/tags","blobs_url":"https://api.github.com/repos/mryab/askme/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mryab/askme/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mryab/askme/git/refs{/sha}","trees_url":"https://api.github.com/repos/mryab/askme/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mryab/askme/statuses/{sha}","languages_url":"https://api.github.com/repos/mryab/askme/languages","stargazers_url":"https://api.github.com/repos/mryab/askme/stargazers","contributors_url":"https://api.github.com/repos/mryab/askme/contributors","subscribers_url":"https://api.github.com/repos/mryab/askme/subscribers","subscription_url":"https://api.github.com/repos/mryab/askme/subscription","commits_url":"https://api.github.com/repos/mryab/askme/commits{/sha}","git_commits_url":"https://api.github.com/repos/mryab/askme/git/commits{/sha}","comments_url":"https://api.github.com/repos/mryab/askme/comments{/number}","issue_comment_url":"https://api.github.com/repos/mryab/askme/issues/comments{/number}","contents_url":"https://api.github.com/repos/mryab/askme/contents/{+path}","compare_url":"https://api.github.com/repos/mryab/askme/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mryab/askme/merges","archive_url":"https://api.github.com/repos/mryab/askme/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mryab/askme/downloads","issues_url":"https://api.github.com/repos/mryab/askme/issues{/number}","pulls_url":"https://api.github.com/repos/mryab/askme/pulls{/number}","milestones_url":"https://api.github.com/repos/mryab/askme/milestones{/number}","notifications_url":"https://api.github.com/repos/mryab/askme/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mryab/askme/labels{/name}","releases_url":"https://api.github.com/repos/mryab/askme/releases{/id}","deployments_url":"https://api.github.com/repos/mryab/askme/deployments","created_at":"2016-11-12T20:45:14Z","updated_at":"2016-11-30T22:02:31Z","pushed_at":"2016-11-30T22:02:36Z","git_url":"git://github.com/mryab/askme.git","ssh_url":"git@github.com:mryab/askme.git","clone_url":"https://github.com/mryab/askme.git","svn_url":"https://github.com/mryab/askme","homepage":"","size":5959,"stargazers_count":0,"watchers_count":0,"language":"Jupyter Notebook","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mryab/askme/pulls/1"},"html":{"href":"https://github.com/mryab/askme/pull/1"},"issue":{"href":"https://api.github.com/repos/mryab/askme/issues/1"},"comments":{"href":"https://api.github.com/repos/mryab/askme/issues/1/comments"},"review_comments":{"href":"https://api.github.com/repos/mryab/askme/pulls/1/comments"},"review_comment":{"href":"https://api.github.com/repos/mryab/askme/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/mryab/askme/pulls/1/commits"},"statuses":{"href":"https://api.github.com/repos/mryab/askme/statuses/6654fa258c87aae180a81bc67c2690f485a337d8"}}}}
{"actor":{"display_login":"dasimagin"}}