{"action":"created","issue":{"url":"https://api.github.com/repos/scikit-learn/scikit-learn/issues/7203","repository_url":"https://api.github.com/repos/scikit-learn/scikit-learn","labels_url":"https://api.github.com/repos/scikit-learn/scikit-learn/issues/7203/labels{/name}","comments_url":"https://api.github.com/repos/scikit-learn/scikit-learn/issues/7203/comments","events_url":"https://api.github.com/repos/scikit-learn/scikit-learn/issues/7203/events","html_url":"https://github.com/scikit-learn/scikit-learn/pull/7203","id":171799304,"number":7203,"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},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2016-08-18T01:37:38Z","updated_at":"2016-08-18T02:38:17Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/7203","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"},"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"},"comment":{"url":"https://api.github.com/repos/scikit-learn/scikit-learn/issues/comments/240608206","html_url":"https://github.com/scikit-learn/scikit-learn/pull/7203#issuecomment-240608206","issue_url":"https://api.github.com/repos/scikit-learn/scikit-learn/issues/7203","id":240608206,"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},"created_at":"2016-08-18T02:38:17Z","updated_at":"2016-08-18T02:38:17Z","body":"I reckon we should just always use `sparse=True` when calculating contingency internally. It's hard to imagine a setting where a sparse matrix would be inefficient, i.e. the contingency matrix is densely populated but there are many classes.\r\n\r\nCorollaries:\r\n* This makes `max_n_classes` irrelevant. It should be deprecated from all the metric functions (but can be kept if we really want in `contingency_matrix`).\r\n* It's okay still to allow the user to supply their own contingency matrix, but I think the API for this remains questionable, so we should leave it out of this PR."}}
{"actor":{"display_login":"jnothman"}}