{"action":"created","comment":{"url":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/comments/79076134","id":79076134,"diff_hunk":"@@ -542,3 +542,67 @@ def test_index_offset():\n     # Make sure translating between 1D and N-D indices are preserved\n     assert_equal(_barnes_hut_tsne.test_index2offset(), 1)\n     assert_equal(_barnes_hut_tsne.test_index_offset(), 1)\n+\n+\n+def test_n_iter_without_progress():\n+    # Make sure that the parameter n_iter_without_progress is used correctly\n+    random_state = check_random_state(0)\n+    X = random_state.randn(100, 2)\n+    tsne = TSNE(n_iter_without_progress=2, verbose=2,\n+                random_state=0, method='exact')\n+\n+    old_stdout = sys.stdout\n+    sys.stdout = StringIO()\n+    try:\n+        tsne.fit_transform(X)\n+    finally:\n+        out = sys.stdout.getvalue()\n+        sys.stdout.close()\n+        sys.stdout = old_stdout\n+\n+    # The output needs to contain the value of n_iter_without_progress\n+    assert(\"did not make any progress during the \"\n+           \"last 2 episodes. Finished.\" in out)\n+\n+\n+def test_min_grad_norm():\n+    # Make sure that the parameter min_grad_norm is used correctly\n+    random_state = check_random_state(0)\n+    X = random_state.randn(100, 2)\n+    min_grad_norm = 0.002\n+    tsne = TSNE(min_grad_norm=min_grad_norm, verbose=2,\n+                random_state=0, method='exact')\n+\n+    old_stdout = sys.stdout\n+    sys.stdout = StringIO()\n+    try:\n+        tsne.fit_transform(X)\n+    finally:\n+        out = sys.stdout.getvalue()\n+        sys.stdout.close()\n+        sys.stdout = old_stdout\n+\n+    lines_out = out.split('\\n')\n+\n+    # extract the gradient norm from the verbose output\n+    gradient_norm_values = []\n+    for line in lines_out:\n+        # When the computation is Finished just an old gradient norm value\n+        # is repeated that we do not need to store\n+        if 'Finished' in line:\n+            break\n+\n+        start_grad_norm = line.find('gradient norm')\n+        if start_grad_norm >= 0:\n+            line = line[start_grad_norm:]\n+            line = line.replace('gradient norm = ', '')\n+            gradient_norm_values.append(float(line))\n+\n+    # Compute how often the gradient norm is smaller than min_grad_norm\n+    gradient_norm_values = np.array(gradient_norm_values)\n+    n_smaller_gradient_norms = \\\n+        len(gradient_norm_values[gradient_norm_values <= min_grad_norm])\n+\n+    # The gradient norm can be smaller than min_grad_norm at most once,\n+    # because in the moment it becomes smaller the optimization stops\n+    assert_less_equal(n_smaller_gradient_norms, 1)","path":"sklearn/manifold/tests/test_t_sne.py","position":67,"original_position":67,"commit_id":"fe1af032b79ec7fe865b599dab5eb0a6b956d004","original_commit_id":"fe1af032b79ec7fe865b599dab5eb0a6b956d004","user":{"login":"jnothman","id":78827,"avatar_url":"https://avatars.githubusercontent.com/u/78827?v=3","gravatar_id":"","url":"https://api.github.com/users/jnothman","html_url":"https://github.com/jnothman","followers_url":"https://api.github.com/users/jnothman/followers","following_url":"https://api.github.com/users/jnothman/following{/other_user}","gists_url":"https://api.github.com/users/jnothman/gists{/gist_id}","starred_url":"https://api.github.com/users/jnothman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jnothman/subscriptions","organizations_url":"https://api.github.com/users/jnothman/orgs","repos_url":"https://api.github.com/users/jnothman/repos","events_url":"https://api.github.com/users/jnothman/events{/privacy}","received_events_url":"https://api.github.com/users/jnothman/received_events","type":"User","site_admin":false},"body":"Needs newline at end of file.","created_at":"2016-09-15T22:30:12Z","updated_at":"2016-09-15T22:30:31Z","html_url":"https://github.com/scikit-learn/scikit-learn/pull/6497#discussion_r79076134","pull_request_url":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/6497","_links":{"self":{"href":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/comments/79076134"},"html":{"href":"https://github.com/scikit-learn/scikit-learn/pull/6497#discussion_r79076134"},"pull_request":{"href":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/6497"}}},"pull_request":{"url":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/6497","id":61859408,"html_url":"https://github.com/scikit-learn/scikit-learn/pull/6497","diff_url":"https://github.com/scikit-learn/scikit-learn/pull/6497.diff","patch_url":"https://github.com/scikit-learn/scikit-learn/pull/6497.patch","issue_url":"https://api.github.com/repos/scikit-learn/scikit-learn/issues/6497","number":6497,"state":"open","locked":false,"title":"[MRG] Fixes n_iter_without_progress and min_grad_norm in TSNE","user":{"login":"ssaeger","id":1192254,"avatar_url":"https://avatars.githubusercontent.com/u/1192254?v=3","gravatar_id":"","url":"https://api.github.com/users/ssaeger","html_url":"https://github.com/ssaeger","followers_url":"https://api.github.com/users/ssaeger/followers","following_url":"https://api.github.com/users/ssaeger/following{/other_user}","gists_url":"https://api.github.com/users/ssaeger/gists{/gist_id}","starred_url":"https://api.github.com/users/ssaeger/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ssaeger/subscriptions","organizations_url":"https://api.github.com/users/ssaeger/orgs","repos_url":"https://api.github.com/users/ssaeger/repos","events_url":"https://api.github.com/users/ssaeger/events{/privacy}","received_events_url":"https://api.github.com/users/ssaeger/received_events","type":"User","site_admin":false},"body":"Fixes #6450.\r\nThe parameters `n_iter_without_progress` and `min_grad_norm` are now correctly used and a test was added to ensure that n_iter_without_progress is used correctly.","created_at":"2016-03-06T23:29:33Z","updated_at":"2016-09-15T22:30:31Z","closed_at":null,"merged_at":null,"merge_commit_sha":"2b88e505ddf093d7f9e15f1332f8cc6f4f8c1f81","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/6497/commits","review_comments_url":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/6497/comments","review_comment_url":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/comments{/number}","comments_url":"https://api.github.com/repos/scikit-learn/scikit-learn/issues/6497/comments","statuses_url":"https://api.github.com/repos/scikit-learn/scikit-learn/statuses/fe1af032b79ec7fe865b599dab5eb0a6b956d004","head":{"label":"ssaeger:issue_6204","ref":"issue_6204","sha":"fe1af032b79ec7fe865b599dab5eb0a6b956d004","user":{"login":"ssaeger","id":1192254,"avatar_url":"https://avatars.githubusercontent.com/u/1192254?v=3","gravatar_id":"","url":"https://api.github.com/users/ssaeger","html_url":"https://github.com/ssaeger","followers_url":"https://api.github.com/users/ssaeger/followers","following_url":"https://api.github.com/users/ssaeger/following{/other_user}","gists_url":"https://api.github.com/users/ssaeger/gists{/gist_id}","starred_url":"https://api.github.com/users/ssaeger/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ssaeger/subscriptions","organizations_url":"https://api.github.com/users/ssaeger/orgs","repos_url":"https://api.github.com/users/ssaeger/repos","events_url":"https://api.github.com/users/ssaeger/events{/privacy}","received_events_url":"https://api.github.com/users/ssaeger/received_events","type":"User","site_admin":false},"repo":{"id":18630018,"name":"scikit-learn","full_name":"ssaeger/scikit-learn","owner":{"login":"ssaeger","id":1192254,"avatar_url":"https://avatars.githubusercontent.com/u/1192254?v=3","gravatar_id":"","url":"https://api.github.com/users/ssaeger","html_url":"https://github.com/ssaeger","followers_url":"https://api.github.com/users/ssaeger/followers","following_url":"https://api.github.com/users/ssaeger/following{/other_user}","gists_url":"https://api.github.com/users/ssaeger/gists{/gist_id}","starred_url":"https://api.github.com/users/ssaeger/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ssaeger/subscriptions","organizations_url":"https://api.github.com/users/ssaeger/orgs","repos_url":"https://api.github.com/users/ssaeger/repos","events_url":"https://api.github.com/users/ssaeger/events{/privacy}","received_events_url":"https://api.github.com/users/ssaeger/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/ssaeger/scikit-learn","description":"scikit-learn: machine learning in Python","fork":true,"url":"https://api.github.com/repos/ssaeger/scikit-learn","forks_url":"https://api.github.com/repos/ssaeger/scikit-learn/forks","keys_url":"https://api.github.com/repos/ssaeger/scikit-learn/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ssaeger/scikit-learn/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ssaeger/scikit-learn/teams","hooks_url":"https://api.github.com/repos/ssaeger/scikit-learn/hooks","issue_events_url":"https://api.github.com/repos/ssaeger/scikit-learn/issues/events{/number}","events_url":"https://api.github.com/repos/ssaeger/scikit-learn/events","assignees_url":"https://api.github.com/repos/ssaeger/scikit-learn/assignees{/user}","branches_url":"https://api.github.com/repos/ssaeger/scikit-learn/branches{/branch}","tags_url":"https://api.github.com/repos/ssaeger/scikit-learn/tags","blobs_url":"https://api.github.com/repos/ssaeger/scikit-learn/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ssaeger/scikit-learn/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ssaeger/scikit-learn/git/refs{/sha}","trees_url":"https://api.github.com/repos/ssaeger/scikit-learn/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ssaeger/scikit-learn/statuses/{sha}","languages_url":"https://api.github.com/repos/ssaeger/scikit-learn/languages","stargazers_url":"https://api.github.com/repos/ssaeger/scikit-learn/stargazers","contributors_url":"https://api.github.com/repos/ssaeger/scikit-learn/contributors","subscribers_url":"https://api.github.com/repos/ssaeger/scikit-learn/subscribers","subscription_url":"https://api.github.com/repos/ssaeger/scikit-learn/subscription","commits_url":"https://api.github.com/repos/ssaeger/scikit-learn/commits{/sha}","git_commits_url":"https://api.github.com/repos/ssaeger/scikit-learn/git/commits{/sha}","comments_url":"https://api.github.com/repos/ssaeger/scikit-learn/comments{/number}","issue_comment_url":"https://api.github.com/repos/ssaeger/scikit-learn/issues/comments{/number}","contents_url":"https://api.github.com/repos/ssaeger/scikit-learn/contents/{+path}","compare_url":"https://api.github.com/repos/ssaeger/scikit-learn/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ssaeger/scikit-learn/merges","archive_url":"https://api.github.com/repos/ssaeger/scikit-learn/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ssaeger/scikit-learn/downloads","issues_url":"https://api.github.com/repos/ssaeger/scikit-learn/issues{/number}","pulls_url":"https://api.github.com/repos/ssaeger/scikit-learn/pulls{/number}","milestones_url":"https://api.github.com/repos/ssaeger/scikit-learn/milestones{/number}","notifications_url":"https://api.github.com/repos/ssaeger/scikit-learn/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ssaeger/scikit-learn/labels{/name}","releases_url":"https://api.github.com/repos/ssaeger/scikit-learn/releases{/id}","deployments_url":"https://api.github.com/repos/ssaeger/scikit-learn/deployments","created_at":"2014-04-10T08:54:04Z","updated_at":"2016-02-20T11:00:41Z","pushed_at":"2016-03-22T11:38:21Z","git_url":"git://github.com/ssaeger/scikit-learn.git","ssh_url":"git@github.com:ssaeger/scikit-learn.git","clone_url":"https://github.com/ssaeger/scikit-learn.git","svn_url":"https://github.com/ssaeger/scikit-learn","homepage":"http://scikit-learn.org","size":66820,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"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":"scikit-learn:master","ref":"master","sha":"945cb7ef536d42912e39cd6fa221b3076965bcc4","user":{"login":"scikit-learn","id":365630,"avatar_url":"https://avatars.githubusercontent.com/u/365630?v=3","gravatar_id":"","url":"https://api.github.com/users/scikit-learn","html_url":"https://github.com/scikit-learn","followers_url":"https://api.github.com/users/scikit-learn/followers","following_url":"https://api.github.com/users/scikit-learn/following{/other_user}","gists_url":"https://api.github.com/users/scikit-learn/gists{/gist_id}","starred_url":"https://api.github.com/users/scikit-learn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scikit-learn/subscriptions","organizations_url":"https://api.github.com/users/scikit-learn/orgs","repos_url":"https://api.github.com/users/scikit-learn/repos","events_url":"https://api.github.com/users/scikit-learn/events{/privacy}","received_events_url":"https://api.github.com/users/scikit-learn/received_events","type":"Organization","site_admin":false},"repo":{"id":843222,"name":"scikit-learn","full_name":"scikit-learn/scikit-learn","owner":{"login":"scikit-learn","id":365630,"avatar_url":"https://avatars.githubusercontent.com/u/365630?v=3","gravatar_id":"","url":"https://api.github.com/users/scikit-learn","html_url":"https://github.com/scikit-learn","followers_url":"https://api.github.com/users/scikit-learn/followers","following_url":"https://api.github.com/users/scikit-learn/following{/other_user}","gists_url":"https://api.github.com/users/scikit-learn/gists{/gist_id}","starred_url":"https://api.github.com/users/scikit-learn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scikit-learn/subscriptions","organizations_url":"https://api.github.com/users/scikit-learn/orgs","repos_url":"https://api.github.com/users/scikit-learn/repos","events_url":"https://api.github.com/users/scikit-learn/events{/privacy}","received_events_url":"https://api.github.com/users/scikit-learn/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/scikit-learn/scikit-learn","description":"scikit-learn: machine learning in Python","fork":false,"url":"https://api.github.com/repos/scikit-learn/scikit-learn","forks_url":"https://api.github.com/repos/scikit-learn/scikit-learn/forks","keys_url":"https://api.github.com/repos/scikit-learn/scikit-learn/keys{/key_id}","collaborators_url":"https://api.github.com/repos/scikit-learn/scikit-learn/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/scikit-learn/scikit-learn/teams","hooks_url":"https://api.github.com/repos/scikit-learn/scikit-learn/hooks","issue_events_url":"https://api.github.com/repos/scikit-learn/scikit-learn/issues/events{/number}","events_url":"https://api.github.com/repos/scikit-learn/scikit-learn/events","assignees_url":"https://api.github.com/repos/scikit-learn/scikit-learn/assignees{/user}","branches_url":"https://api.github.com/repos/scikit-learn/scikit-learn/branches{/branch}","tags_url":"https://api.github.com/repos/scikit-learn/scikit-learn/tags","blobs_url":"https://api.github.com/repos/scikit-learn/scikit-learn/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/scikit-learn/scikit-learn/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/scikit-learn/scikit-learn/git/refs{/sha}","trees_url":"https://api.github.com/repos/scikit-learn/scikit-learn/git/trees{/sha}","statuses_url":"https://api.github.com/repos/scikit-learn/scikit-learn/statuses/{sha}","languages_url":"https://api.github.com/repos/scikit-learn/scikit-learn/languages","stargazers_url":"https://api.github.com/repos/scikit-learn/scikit-learn/stargazers","contributors_url":"https://api.github.com/repos/scikit-learn/scikit-learn/contributors","subscribers_url":"https://api.github.com/repos/scikit-learn/scikit-learn/subscribers","subscription_url":"https://api.github.com/repos/scikit-learn/scikit-learn/subscription","commits_url":"https://api.github.com/repos/scikit-learn/scikit-learn/commits{/sha}","git_commits_url":"https://api.github.com/repos/scikit-learn/scikit-learn/git/commits{/sha}","comments_url":"https://api.github.com/repos/scikit-learn/scikit-learn/comments{/number}","issue_comment_url":"https://api.github.com/repos/scikit-learn/scikit-learn/issues/comments{/number}","contents_url":"https://api.github.com/repos/scikit-learn/scikit-learn/contents/{+path}","compare_url":"https://api.github.com/repos/scikit-learn/scikit-learn/compare/{base}...{head}","merges_url":"https://api.github.com/repos/scikit-learn/scikit-learn/merges","archive_url":"https://api.github.com/repos/scikit-learn/scikit-learn/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/scikit-learn/scikit-learn/downloads","issues_url":"https://api.github.com/repos/scikit-learn/scikit-learn/issues{/number}","pulls_url":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls{/number}","milestones_url":"https://api.github.com/repos/scikit-learn/scikit-learn/milestones{/number}","notifications_url":"https://api.github.com/repos/scikit-learn/scikit-learn/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/scikit-learn/scikit-learn/labels{/name}","releases_url":"https://api.github.com/repos/scikit-learn/scikit-learn/releases{/id}","deployments_url":"https://api.github.com/repos/scikit-learn/scikit-learn/deployments","created_at":"2010-08-17T09:43:38Z","updated_at":"2016-09-15T22:21:11Z","pushed_at":"2016-09-15T21:47:17Z","git_url":"git://github.com/scikit-learn/scikit-learn.git","ssh_url":"git@github.com:scikit-learn/scikit-learn.git","clone_url":"https://github.com/scikit-learn/scikit-learn.git","svn_url":"https://github.com/scikit-learn/scikit-learn","homepage":"http://scikit-learn.org","size":124170,"stargazers_count":13413,"watchers_count":13413,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":7722,"mirror_url":null,"open_issues_count":1232,"forks":7722,"open_issues":1232,"watchers":13413,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/6497"},"html":{"href":"https://github.com/scikit-learn/scikit-learn/pull/6497"},"issue":{"href":"https://api.github.com/repos/scikit-learn/scikit-learn/issues/6497"},"comments":{"href":"https://api.github.com/repos/scikit-learn/scikit-learn/issues/6497/comments"},"review_comments":{"href":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/6497/comments"},"review_comment":{"href":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/6497/commits"},"statuses":{"href":"https://api.github.com/repos/scikit-learn/scikit-learn/statuses/fe1af032b79ec7fe865b599dab5eb0a6b956d004"}}}}
{"actor":{"display_login":"jnothman"}}