{"action":"created","comment":{"url":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/comments/143421928","pull_request_review_id":67928502,"id":143421928,"diff_hunk":"@@ -773,6 +827,14 @@ class FeatureAgglomeration(AgglomerativeClustering, AgglomerationTransform):\n     ----------\n     n_clusters : int, default 2\n         The number of clusters to find.\n+        NOTE: You should set either ``n_clusters`` or ``distance_threshold``,\n+        NOT both.\n+\n+    distance_threshold : int (optional)\n+        The distance threshold to cluster at.","path":"sklearn/cluster/hierarchical.py","position":56,"original_position":159,"commit_id":"1c9ad692bf9042f0fcc604a21eb35907655c11a7","original_commit_id":"1c9ad692bf9042f0fcc604a21eb35907655c11a7","user":{"login":"jnothman","id":78827,"avatar_url":"https://avatars2.githubusercontent.com/u/78827?v=4","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":"Update to match above","created_at":"2017-10-09T09:41:27Z","updated_at":"2017-10-09T09:45:35Z","html_url":"https://github.com/scikit-learn/scikit-learn/pull/9069#discussion_r143421928","pull_request_url":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/9069","author_association":"OWNER","_links":{"self":{"href":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/comments/143421928"},"html":{"href":"https://github.com/scikit-learn/scikit-learn/pull/9069#discussion_r143421928"},"pull_request":{"href":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/9069"}}},"pull_request":{"url":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/9069","id":124687149,"html_url":"https://github.com/scikit-learn/scikit-learn/pull/9069","diff_url":"https://github.com/scikit-learn/scikit-learn/pull/9069.diff","patch_url":"https://github.com/scikit-learn/scikit-learn/pull/9069.patch","issue_url":"https://api.github.com/repos/scikit-learn/scikit-learn/issues/9069","number":9069,"state":"open","locked":false,"title":"[MRG] Distance threshold added to hierarchical clustering","user":{"login":"VathsalaAchar","id":1846599,"avatar_url":"https://avatars2.githubusercontent.com/u/1846599?v=4","gravatar_id":"","url":"https://api.github.com/users/VathsalaAchar","html_url":"https://github.com/VathsalaAchar","followers_url":"https://api.github.com/users/VathsalaAchar/followers","following_url":"https://api.github.com/users/VathsalaAchar/following{/other_user}","gists_url":"https://api.github.com/users/VathsalaAchar/gists{/gist_id}","starred_url":"https://api.github.com/users/VathsalaAchar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/VathsalaAchar/subscriptions","organizations_url":"https://api.github.com/users/VathsalaAchar/orgs","repos_url":"https://api.github.com/users/VathsalaAchar/repos","events_url":"https://api.github.com/users/VathsalaAchar/events{/privacy}","received_events_url":"https://api.github.com/users/VathsalaAchar/received_events","type":"User","site_admin":false},"body":"#### Reference Issue \r\nImplementation for #3796 \r\n\r\n#### What does this implement/fix? Explain your changes.\r\n\r\nHierarchical clustering now has a `distance_threshold` parameter which can be set instead of `n_clusters` and this is used to determine the number of clusters to cut the tree at.\r\n\r\n*Note: that this works only when compute_full_tree=True and n_clusters=None.*\r\n\r\nChanges\r\n* Either `distance_threshold` or `n_clusters` is accepted as parameter. When `distance_threshold` is set  `n_clusters` needs to be set to None as the default of 2 clusters has been retained.\r\n* When building the tree the return_distance is set to True if the `distance_threshold` has been set.\r\nThe distances returned is then used to calculate the number of clusters when cutting the tree.\r\n\r\nTests\r\n* Updated distance_threshold tests to pass with `n_clusters=None` as parameter as the default for n_clusters is 2.\r\n* Test to raise error when neither n_cluster nor distance_threshold is passed in.\r\n* Test agglomerative clustering with distance_threshold passed in and compare with the different number of clusters produced with and without connectivity.\r\n\r\nDocumentation\r\n* Updated the User Guide to show `distance_threshold` parameter in the table.\r\n* Doc string updated with `distance_threshold` explanation\r\n\r\n#### Any other comments?\r\n\r\nIs this implementation the right behaviour of `distance_threshold` or should the construction of the tree stop when the distance is reached?\r\n\r\n--------\r\nApologies for the constant stream of commits, I was trying to sort out the errors myself.","created_at":"2017-06-08T16:02:19Z","updated_at":"2017-10-09T09:45:35Z","closed_at":null,"merged_at":null,"merge_commit_sha":"c5e8e01b5df3609bff4de17b7d31d03c2834208e","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/9069/commits","review_comments_url":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/9069/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/9069/comments","statuses_url":"https://api.github.com/repos/scikit-learn/scikit-learn/statuses/1c9ad692bf9042f0fcc604a21eb35907655c11a7","head":{"label":"VathsalaAchar:hierarchical_clustering_threshold","ref":"hierarchical_clustering_threshold","sha":"1c9ad692bf9042f0fcc604a21eb35907655c11a7","user":{"login":"VathsalaAchar","id":1846599,"avatar_url":"https://avatars2.githubusercontent.com/u/1846599?v=4","gravatar_id":"","url":"https://api.github.com/users/VathsalaAchar","html_url":"https://github.com/VathsalaAchar","followers_url":"https://api.github.com/users/VathsalaAchar/followers","following_url":"https://api.github.com/users/VathsalaAchar/following{/other_user}","gists_url":"https://api.github.com/users/VathsalaAchar/gists{/gist_id}","starred_url":"https://api.github.com/users/VathsalaAchar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/VathsalaAchar/subscriptions","organizations_url":"https://api.github.com/users/VathsalaAchar/orgs","repos_url":"https://api.github.com/users/VathsalaAchar/repos","events_url":"https://api.github.com/users/VathsalaAchar/events{/privacy}","received_events_url":"https://api.github.com/users/VathsalaAchar/received_events","type":"User","site_admin":false},"repo":{"id":85945176,"name":"scikit-learn","full_name":"VathsalaAchar/scikit-learn","owner":{"login":"VathsalaAchar","id":1846599,"avatar_url":"https://avatars2.githubusercontent.com/u/1846599?v=4","gravatar_id":"","url":"https://api.github.com/users/VathsalaAchar","html_url":"https://github.com/VathsalaAchar","followers_url":"https://api.github.com/users/VathsalaAchar/followers","following_url":"https://api.github.com/users/VathsalaAchar/following{/other_user}","gists_url":"https://api.github.com/users/VathsalaAchar/gists{/gist_id}","starred_url":"https://api.github.com/users/VathsalaAchar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/VathsalaAchar/subscriptions","organizations_url":"https://api.github.com/users/VathsalaAchar/orgs","repos_url":"https://api.github.com/users/VathsalaAchar/repos","events_url":"https://api.github.com/users/VathsalaAchar/events{/privacy}","received_events_url":"https://api.github.com/users/VathsalaAchar/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/VathsalaAchar/scikit-learn","description":"scikit-learn: machine learning in Python","fork":true,"url":"https://api.github.com/repos/VathsalaAchar/scikit-learn","forks_url":"https://api.github.com/repos/VathsalaAchar/scikit-learn/forks","keys_url":"https://api.github.com/repos/VathsalaAchar/scikit-learn/keys{/key_id}","collaborators_url":"https://api.github.com/repos/VathsalaAchar/scikit-learn/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/VathsalaAchar/scikit-learn/teams","hooks_url":"https://api.github.com/repos/VathsalaAchar/scikit-learn/hooks","issue_events_url":"https://api.github.com/repos/VathsalaAchar/scikit-learn/issues/events{/number}","events_url":"https://api.github.com/repos/VathsalaAchar/scikit-learn/events","assignees_url":"https://api.github.com/repos/VathsalaAchar/scikit-learn/assignees{/user}","branches_url":"https://api.github.com/repos/VathsalaAchar/scikit-learn/branches{/branch}","tags_url":"https://api.github.com/repos/VathsalaAchar/scikit-learn/tags","blobs_url":"https://api.github.com/repos/VathsalaAchar/scikit-learn/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/VathsalaAchar/scikit-learn/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/VathsalaAchar/scikit-learn/git/refs{/sha}","trees_url":"https://api.github.com/repos/VathsalaAchar/scikit-learn/git/trees{/sha}","statuses_url":"https://api.github.com/repos/VathsalaAchar/scikit-learn/statuses/{sha}","languages_url":"https://api.github.com/repos/VathsalaAchar/scikit-learn/languages","stargazers_url":"https://api.github.com/repos/VathsalaAchar/scikit-learn/stargazers","contributors_url":"https://api.github.com/repos/VathsalaAchar/scikit-learn/contributors","subscribers_url":"https://api.github.com/repos/VathsalaAchar/scikit-learn/subscribers","subscription_url":"https://api.github.com/repos/VathsalaAchar/scikit-learn/subscription","commits_url":"https://api.github.com/repos/VathsalaAchar/scikit-learn/commits{/sha}","git_commits_url":"https://api.github.com/repos/VathsalaAchar/scikit-learn/git/commits{/sha}","comments_url":"https://api.github.com/repos/VathsalaAchar/scikit-learn/comments{/number}","issue_comment_url":"https://api.github.com/repos/VathsalaAchar/scikit-learn/issues/comments{/number}","contents_url":"https://api.github.com/repos/VathsalaAchar/scikit-learn/contents/{+path}","compare_url":"https://api.github.com/repos/VathsalaAchar/scikit-learn/compare/{base}...{head}","merges_url":"https://api.github.com/repos/VathsalaAchar/scikit-learn/merges","archive_url":"https://api.github.com/repos/VathsalaAchar/scikit-learn/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/VathsalaAchar/scikit-learn/downloads","issues_url":"https://api.github.com/repos/VathsalaAchar/scikit-learn/issues{/number}","pulls_url":"https://api.github.com/repos/VathsalaAchar/scikit-learn/pulls{/number}","milestones_url":"https://api.github.com/repos/VathsalaAchar/scikit-learn/milestones{/number}","notifications_url":"https://api.github.com/repos/VathsalaAchar/scikit-learn/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/VathsalaAchar/scikit-learn/labels{/name}","releases_url":"https://api.github.com/repos/VathsalaAchar/scikit-learn/releases{/id}","deployments_url":"https://api.github.com/repos/VathsalaAchar/scikit-learn/deployments","created_at":"2017-03-23T12:06:10Z","updated_at":"2017-05-18T12:05:34Z","pushed_at":"2017-08-08T08:44:35Z","git_url":"git://github.com/VathsalaAchar/scikit-learn.git","ssh_url":"git@github.com:VathsalaAchar/scikit-learn.git","clone_url":"https://github.com/VathsalaAchar/scikit-learn.git","svn_url":"https://github.com/VathsalaAchar/scikit-learn","homepage":"http://scikit-learn.org","size":84293,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_projects":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":"scikit-learn:master","ref":"master","sha":"1059946bf246497fb9172fb136b3ad1330ac1ec4","user":{"login":"scikit-learn","id":365630,"avatar_url":"https://avatars2.githubusercontent.com/u/365630?v=4","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://avatars2.githubusercontent.com/u/365630?v=4","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":"2017-10-09T09:19:40Z","pushed_at":"2017-10-09T09:32:51Z","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":86407,"stargazers_count":21669,"watchers_count":21669,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":11608,"mirror_url":null,"open_issues_count":1493,"forks":11608,"open_issues":1493,"watchers":21669,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/9069"},"html":{"href":"https://github.com/scikit-learn/scikit-learn/pull/9069"},"issue":{"href":"https://api.github.com/repos/scikit-learn/scikit-learn/issues/9069"},"comments":{"href":"https://api.github.com/repos/scikit-learn/scikit-learn/issues/9069/comments"},"review_comments":{"href":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/9069/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/9069/commits"},"statuses":{"href":"https://api.github.com/repos/scikit-learn/scikit-learn/statuses/1c9ad692bf9042f0fcc604a21eb35907655c11a7"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"jnothman"}}