{"action":"created","comment":{"url":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/comments/75240333","id":75240333,"diff_hunk":"@@ -57,43 +59,52 @@ def contingency_matrix(labels_true, labels_pred, eps=None, max_n_classes=5000):\n     labels_pred : array, shape = [n_samples]\n         Cluster labels to evaluate\n \n-    eps: None or float\n+    eps: None or float, optional.\n         If a float, that value is added to all values in the contingency\n         matrix. This helps to stop NaN propagation.\n         If ``None``, nothing is adjusted.\n \n     max_n_classes : int, optional (default=5000)\n         Maximal number of classeses handled for contingency_matrix.\n         This help to avoid Memory error with regression target\n-        for mutual_information.\n+        for mutual_information. If `sparse`, `max_n_classes` is ignored.\n+\n+    sparse: boolean, optional.\n+        If True, return a sparse continency matrix. If ``eps is not None``,\n+        and ``sparse is True``, will throw ValueError.\n \n     Returns\n     -------\n-    contingency: array, shape=[n_classes_true, n_classes_pred]\n+    contingency: {array-like, sparse matrix}, shape=[n_classes_true, n_classes_pred]\n         Matrix :math:`C` such that :math:`C_{i, j}` is the number of samples in\n         true class :math:`i` and in predicted class :math:`j`. If\n         ``eps is None``, the dtype of this array will be integer. If ``eps`` is\n         given, the dtype will be float.","path":"sklearn/metrics/cluster/supervised.py","position":54,"original_position":54,"commit_id":"8ec4d112f4ed03ced7c59a9498d19b7a52ee53b4","original_commit_id":"8ec4d112f4ed03ced7c59a9498d19b7a52ee53b4","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":"Note that sparse will be used if `sparse=True`","created_at":"2016-08-18T02:30:59Z","updated_at":"2016-08-18T02:30:59Z","html_url":"https://github.com/scikit-learn/scikit-learn/pull/7203#discussion_r75240333","pull_request_url":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/7203","_links":{"self":{"href":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/comments/75240333"},"html":{"href":"https://github.com/scikit-learn/scikit-learn/pull/7203#discussion_r75240333"},"pull_request":{"href":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/7203"}}},"pull_request":{"url":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/7203","id":81744564,"html_url":"https://github.com/scikit-learn/scikit-learn/pull/7203","diff_url":"https://github.com/scikit-learn/scikit-learn/pull/7203.diff","patch_url":"https://github.com/scikit-learn/scikit-learn/pull/7203.patch","issue_url":"https://api.github.com/repos/scikit-learn/scikit-learn/issues/7203","number":7203,"state":"open","locked":false,"title":"Use sparse contingency matrix for supervised cluster metrics","user":{"login":"stuppie","id":5470131,"avatar_url":"https://avatars.githubusercontent.com/u/5470131?v=3","gravatar_id":"","url":"https://api.github.com/users/stuppie","html_url":"https://github.com/stuppie","followers_url":"https://api.github.com/users/stuppie/followers","following_url":"https://api.github.com/users/stuppie/following{/other_user}","gists_url":"https://api.github.com/users/stuppie/gists{/gist_id}","starred_url":"https://api.github.com/users/stuppie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stuppie/subscriptions","organizations_url":"https://api.github.com/users/stuppie/orgs","repos_url":"https://api.github.com/users/stuppie/repos","events_url":"https://api.github.com/users/stuppie/events{/privacy}","received_events_url":"https://api.github.com/users/stuppie/received_events","type":"User","site_admin":false},"body":"See https://github.com/scikit-learn/scikit-learn/pull/4788\r\n\r\nReplaces `max_n_classes`\r\n\r\nIn sklearn.metrics.cluster.supervised\r\nWith large numbers of clusters (approx. >100k), construction of the contingency matrix runs out of memory (throws MemoryError).\r\n\r\n    >>> from random import randrange\r\n    >>> labels_true = [randrange(100000) for x in range(100000)]\r\n    >>> labels_pred = [randrange(100000) for x in range(100000)]\r\n    >>> contingency = contingency_matrix(labels_true, labels_pred)\r\n    ... MemoryError\r\n    >>> contingency = contingency_matrix(labels_true, labels_pred, sparse=True)\r\n    ... No error\r\nUsing a sparse matrix instead allows construction of the contingency matrix.\r\n\r\nModified adjusted_rand_score\r\nhomogeneity_completeness_v_measure\r\nmutual_info_score\r\nto accept a sparse matrix.\r\n\r\n","created_at":"2016-08-18T01:37:38Z","updated_at":"2016-08-18T02:30:59Z","closed_at":null,"merged_at":null,"merge_commit_sha":"8194ba6a3e7fb4fb70ff49a7e05bf773a04c98ae","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/7203/commits","review_comments_url":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/7203/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/7203/comments","statuses_url":"https://api.github.com/repos/scikit-learn/scikit-learn/statuses/8ec4d112f4ed03ced7c59a9498d19b7a52ee53b4","head":{"label":"stuppie:master","ref":"master","sha":"8ec4d112f4ed03ced7c59a9498d19b7a52ee53b4","user":{"login":"stuppie","id":5470131,"avatar_url":"https://avatars.githubusercontent.com/u/5470131?v=3","gravatar_id":"","url":"https://api.github.com/users/stuppie","html_url":"https://github.com/stuppie","followers_url":"https://api.github.com/users/stuppie/followers","following_url":"https://api.github.com/users/stuppie/following{/other_user}","gists_url":"https://api.github.com/users/stuppie/gists{/gist_id}","starred_url":"https://api.github.com/users/stuppie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stuppie/subscriptions","organizations_url":"https://api.github.com/users/stuppie/orgs","repos_url":"https://api.github.com/users/stuppie/repos","events_url":"https://api.github.com/users/stuppie/events{/privacy}","received_events_url":"https://api.github.com/users/stuppie/received_events","type":"User","site_admin":false},"repo":{"id":65951591,"name":"scikit-learn","full_name":"stuppie/scikit-learn","owner":{"login":"stuppie","id":5470131,"avatar_url":"https://avatars.githubusercontent.com/u/5470131?v=3","gravatar_id":"","url":"https://api.github.com/users/stuppie","html_url":"https://github.com/stuppie","followers_url":"https://api.github.com/users/stuppie/followers","following_url":"https://api.github.com/users/stuppie/following{/other_user}","gists_url":"https://api.github.com/users/stuppie/gists{/gist_id}","starred_url":"https://api.github.com/users/stuppie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stuppie/subscriptions","organizations_url":"https://api.github.com/users/stuppie/orgs","repos_url":"https://api.github.com/users/stuppie/repos","events_url":"https://api.github.com/users/stuppie/events{/privacy}","received_events_url":"https://api.github.com/users/stuppie/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/stuppie/scikit-learn","description":"scikit-learn: machine learning in Python","fork":true,"url":"https://api.github.com/repos/stuppie/scikit-learn","forks_url":"https://api.github.com/repos/stuppie/scikit-learn/forks","keys_url":"https://api.github.com/repos/stuppie/scikit-learn/keys{/key_id}","collaborators_url":"https://api.github.com/repos/stuppie/scikit-learn/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/stuppie/scikit-learn/teams","hooks_url":"https://api.github.com/repos/stuppie/scikit-learn/hooks","issue_events_url":"https://api.github.com/repos/stuppie/scikit-learn/issues/events{/number}","events_url":"https://api.github.com/repos/stuppie/scikit-learn/events","assignees_url":"https://api.github.com/repos/stuppie/scikit-learn/assignees{/user}","branches_url":"https://api.github.com/repos/stuppie/scikit-learn/branches{/branch}","tags_url":"https://api.github.com/repos/stuppie/scikit-learn/tags","blobs_url":"https://api.github.com/repos/stuppie/scikit-learn/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/stuppie/scikit-learn/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/stuppie/scikit-learn/git/refs{/sha}","trees_url":"https://api.github.com/repos/stuppie/scikit-learn/git/trees{/sha}","statuses_url":"https://api.github.com/repos/stuppie/scikit-learn/statuses/{sha}","languages_url":"https://api.github.com/repos/stuppie/scikit-learn/languages","stargazers_url":"https://api.github.com/repos/stuppie/scikit-learn/stargazers","contributors_url":"https://api.github.com/repos/stuppie/scikit-learn/contributors","subscribers_url":"https://api.github.com/repos/stuppie/scikit-learn/subscribers","subscription_url":"https://api.github.com/repos/stuppie/scikit-learn/subscription","commits_url":"https://api.github.com/repos/stuppie/scikit-learn/commits{/sha}","git_commits_url":"https://api.github.com/repos/stuppie/scikit-learn/git/commits{/sha}","comments_url":"https://api.github.com/repos/stuppie/scikit-learn/comments{/number}","issue_comment_url":"https://api.github.com/repos/stuppie/scikit-learn/issues/comments{/number}","contents_url":"https://api.github.com/repos/stuppie/scikit-learn/contents/{+path}","compare_url":"https://api.github.com/repos/stuppie/scikit-learn/compare/{base}...{head}","merges_url":"https://api.github.com/repos/stuppie/scikit-learn/merges","archive_url":"https://api.github.com/repos/stuppie/scikit-learn/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/stuppie/scikit-learn/downloads","issues_url":"https://api.github.com/repos/stuppie/scikit-learn/issues{/number}","pulls_url":"https://api.github.com/repos/stuppie/scikit-learn/pulls{/number}","milestones_url":"https://api.github.com/repos/stuppie/scikit-learn/milestones{/number}","notifications_url":"https://api.github.com/repos/stuppie/scikit-learn/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/stuppie/scikit-learn/labels{/name}","releases_url":"https://api.github.com/repos/stuppie/scikit-learn/releases{/id}","deployments_url":"https://api.github.com/repos/stuppie/scikit-learn/deployments","created_at":"2016-08-18T00:24:50Z","updated_at":"2016-08-18T00:25:01Z","pushed_at":"2016-08-18T02:14:00Z","git_url":"git://github.com/stuppie/scikit-learn.git","ssh_url":"git@github.com:stuppie/scikit-learn.git","clone_url":"https://github.com/stuppie/scikit-learn.git","svn_url":"https://github.com/stuppie/scikit-learn","homepage":"http://scikit-learn.org","size":73575,"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":"9d0c2dd618c6655061d9c3adb411e6f0eb1784ce","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-08-18T01:20:33Z","pushed_at":"2016-08-18T02:14:01Z","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":121880,"stargazers_count":12868,"watchers_count":12868,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":7446,"mirror_url":null,"open_issues_count":1254,"forks":7446,"open_issues":1254,"watchers":12868,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/7203"},"html":{"href":"https://github.com/scikit-learn/scikit-learn/pull/7203"},"issue":{"href":"https://api.github.com/repos/scikit-learn/scikit-learn/issues/7203"},"comments":{"href":"https://api.github.com/repos/scikit-learn/scikit-learn/issues/7203/comments"},"review_comments":{"href":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/7203/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/7203/commits"},"statuses":{"href":"https://api.github.com/repos/scikit-learn/scikit-learn/statuses/8ec4d112f4ed03ced7c59a9498d19b7a52ee53b4"}}}}
{"actor":{"display_login":"jnothman"}}