{"action":"created","comment":{"url":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/comments/41832221","id":41832221,"diff_hunk":"@@ -412,6 +412,16 @@ def __init__(self, labels, n_folds=3, shuffle=False, random_state=None):\n                      \" than the number of labels: {1}.\").format(n_folds,\n                                                                 n_labels))\n \n+        if shuffle:\n+            # In case of ties in label weights, label names are indirectly\n+            # used to assign samples to folds. When shuffle=True, label names\n+            # are randomized to obtain random fold assigments.\n+            rng = check_random_state(self.random_state)\n+            unique_labels = np.arange(n_labels, dtype=np.int)","path":"sklearn/cross_validation.py","position":9,"original_position":9,"commit_id":"1f4bc26a02443297ef103a3c72ea16114c7395a5","original_commit_id":"1f4bc26a02443297ef103a3c72ea16114c7395a5","user":{"login":"ogrisel","id":89061,"avatar_url":"https://avatars.githubusercontent.com/u/89061?v=3","gravatar_id":"","url":"https://api.github.com/users/ogrisel","html_url":"https://github.com/ogrisel","followers_url":"https://api.github.com/users/ogrisel/followers","following_url":"https://api.github.com/users/ogrisel/following{/other_user}","gists_url":"https://api.github.com/users/ogrisel/gists{/gist_id}","starred_url":"https://api.github.com/users/ogrisel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ogrisel/subscriptions","organizations_url":"https://api.github.com/users/ogrisel/orgs","repos_url":"https://api.github.com/users/ogrisel/repos","events_url":"https://api.github.com/users/ogrisel/events{/privacy}","received_events_url":"https://api.github.com/users/ogrisel/received_events","type":"User","site_admin":false},"body":"It would be better never to use Python dtype (that have an implicitly defined size / precision level) but instead use numpy dtypes only, e.g. `np.intp` in this case: `np.intp` is the smallest integer dtype that is big enough to index any array.","created_at":"2015-10-13T06:55:10Z","updated_at":"2015-10-13T06:55:10Z","html_url":"https://github.com/scikit-learn/scikit-learn/pull/5300#discussion_r41832221","pull_request_url":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/5300","_links":{"self":{"href":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/comments/41832221"},"html":{"href":"https://github.com/scikit-learn/scikit-learn/pull/5300#discussion_r41832221"},"pull_request":{"href":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/5300"}}},"pull_request":{"url":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/5300","id":45772849,"html_url":"https://github.com/scikit-learn/scikit-learn/pull/5300","diff_url":"https://github.com/scikit-learn/scikit-learn/pull/5300.diff","patch_url":"https://github.com/scikit-learn/scikit-learn/pull/5300.patch","issue_url":"https://api.github.com/repos/scikit-learn/scikit-learn/issues/5300","number":5300,"state":"closed","locked":false,"title":"[MRG+1] Ensure correct LabelKFold folds when shuffle=True","user":{"login":"glouppe","id":477771,"avatar_url":"https://avatars.githubusercontent.com/u/477771?v=3","gravatar_id":"","url":"https://api.github.com/users/glouppe","html_url":"https://github.com/glouppe","followers_url":"https://api.github.com/users/glouppe/followers","following_url":"https://api.github.com/users/glouppe/following{/other_user}","gists_url":"https://api.github.com/users/glouppe/gists{/gist_id}","starred_url":"https://api.github.com/users/glouppe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/glouppe/subscriptions","organizations_url":"https://api.github.com/users/glouppe/orgs","repos_url":"https://api.github.com/users/glouppe/repos","events_url":"https://api.github.com/users/glouppe/events{/privacy}","received_events_url":"https://api.github.com/users/glouppe/received_events","type":"User","site_admin":false},"body":"This is meant to fix #5292 \r\n\r\nCC: @andreasvc ","created_at":"2015-09-23T12:27:53Z","updated_at":"2015-10-13T06:55:10Z","closed_at":"2015-09-28T14:29:07Z","merged_at":"2015-09-28T14:29:07Z","merge_commit_sha":"8ee859bf8dbf63039bfdf5258465f2d12539e079","assignee":null,"milestone":{"url":"https://api.github.com/repos/scikit-learn/scikit-learn/milestones/15","html_url":"https://github.com/scikit-learn/scikit-learn/milestones/0.17","labels_url":"https://api.github.com/repos/scikit-learn/scikit-learn/milestones/15/labels","id":995666,"number":15,"title":"0.17","description":"","creator":{"login":"amueller","id":449558,"avatar_url":"https://avatars.githubusercontent.com/u/449558?v=3","gravatar_id":"","url":"https://api.github.com/users/amueller","html_url":"https://github.com/amueller","followers_url":"https://api.github.com/users/amueller/followers","following_url":"https://api.github.com/users/amueller/following{/other_user}","gists_url":"https://api.github.com/users/amueller/gists{/gist_id}","starred_url":"https://api.github.com/users/amueller/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/amueller/subscriptions","organizations_url":"https://api.github.com/users/amueller/orgs","repos_url":"https://api.github.com/users/amueller/repos","events_url":"https://api.github.com/users/amueller/events{/privacy}","received_events_url":"https://api.github.com/users/amueller/received_events","type":"User","site_admin":false},"open_issues":33,"closed_issues":59,"state":"open","created_at":"2015-02-25T18:59:07Z","updated_at":"2015-10-13T00:02:00Z","due_on":"2015-09-20T04:00:00Z","closed_at":null},"commits_url":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/5300/commits","review_comments_url":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/5300/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/5300/comments","statuses_url":"https://api.github.com/repos/scikit-learn/scikit-learn/statuses/1f4bc26a02443297ef103a3c72ea16114c7395a5","head":{"label":"glouppe:fix-5292","ref":"fix-5292","sha":"1f4bc26a02443297ef103a3c72ea16114c7395a5","user":{"login":"glouppe","id":477771,"avatar_url":"https://avatars.githubusercontent.com/u/477771?v=3","gravatar_id":"","url":"https://api.github.com/users/glouppe","html_url":"https://github.com/glouppe","followers_url":"https://api.github.com/users/glouppe/followers","following_url":"https://api.github.com/users/glouppe/following{/other_user}","gists_url":"https://api.github.com/users/glouppe/gists{/gist_id}","starred_url":"https://api.github.com/users/glouppe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/glouppe/subscriptions","organizations_url":"https://api.github.com/users/glouppe/orgs","repos_url":"https://api.github.com/users/glouppe/repos","events_url":"https://api.github.com/users/glouppe/events{/privacy}","received_events_url":"https://api.github.com/users/glouppe/received_events","type":"User","site_admin":false},"repo":{"id":2047361,"name":"scikit-learn","full_name":"glouppe/scikit-learn","owner":{"login":"glouppe","id":477771,"avatar_url":"https://avatars.githubusercontent.com/u/477771?v=3","gravatar_id":"","url":"https://api.github.com/users/glouppe","html_url":"https://github.com/glouppe","followers_url":"https://api.github.com/users/glouppe/followers","following_url":"https://api.github.com/users/glouppe/following{/other_user}","gists_url":"https://api.github.com/users/glouppe/gists{/gist_id}","starred_url":"https://api.github.com/users/glouppe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/glouppe/subscriptions","organizations_url":"https://api.github.com/users/glouppe/orgs","repos_url":"https://api.github.com/users/glouppe/repos","events_url":"https://api.github.com/users/glouppe/events{/privacy}","received_events_url":"https://api.github.com/users/glouppe/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/glouppe/scikit-learn","description":"scikit-learn: machine learning in Python","fork":true,"url":"https://api.github.com/repos/glouppe/scikit-learn","forks_url":"https://api.github.com/repos/glouppe/scikit-learn/forks","keys_url":"https://api.github.com/repos/glouppe/scikit-learn/keys{/key_id}","collaborators_url":"https://api.github.com/repos/glouppe/scikit-learn/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/glouppe/scikit-learn/teams","hooks_url":"https://api.github.com/repos/glouppe/scikit-learn/hooks","issue_events_url":"https://api.github.com/repos/glouppe/scikit-learn/issues/events{/number}","events_url":"https://api.github.com/repos/glouppe/scikit-learn/events","assignees_url":"https://api.github.com/repos/glouppe/scikit-learn/assignees{/user}","branches_url":"https://api.github.com/repos/glouppe/scikit-learn/branches{/branch}","tags_url":"https://api.github.com/repos/glouppe/scikit-learn/tags","blobs_url":"https://api.github.com/repos/glouppe/scikit-learn/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/glouppe/scikit-learn/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/glouppe/scikit-learn/git/refs{/sha}","trees_url":"https://api.github.com/repos/glouppe/scikit-learn/git/trees{/sha}","statuses_url":"https://api.github.com/repos/glouppe/scikit-learn/statuses/{sha}","languages_url":"https://api.github.com/repos/glouppe/scikit-learn/languages","stargazers_url":"https://api.github.com/repos/glouppe/scikit-learn/stargazers","contributors_url":"https://api.github.com/repos/glouppe/scikit-learn/contributors","subscribers_url":"https://api.github.com/repos/glouppe/scikit-learn/subscribers","subscription_url":"https://api.github.com/repos/glouppe/scikit-learn/subscription","commits_url":"https://api.github.com/repos/glouppe/scikit-learn/commits{/sha}","git_commits_url":"https://api.github.com/repos/glouppe/scikit-learn/git/commits{/sha}","comments_url":"https://api.github.com/repos/glouppe/scikit-learn/comments{/number}","issue_comment_url":"https://api.github.com/repos/glouppe/scikit-learn/issues/comments{/number}","contents_url":"https://api.github.com/repos/glouppe/scikit-learn/contents/{+path}","compare_url":"https://api.github.com/repos/glouppe/scikit-learn/compare/{base}...{head}","merges_url":"https://api.github.com/repos/glouppe/scikit-learn/merges","archive_url":"https://api.github.com/repos/glouppe/scikit-learn/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/glouppe/scikit-learn/downloads","issues_url":"https://api.github.com/repos/glouppe/scikit-learn/issues{/number}","pulls_url":"https://api.github.com/repos/glouppe/scikit-learn/pulls{/number}","milestones_url":"https://api.github.com/repos/glouppe/scikit-learn/milestones{/number}","notifications_url":"https://api.github.com/repos/glouppe/scikit-learn/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/glouppe/scikit-learn/labels{/name}","releases_url":"https://api.github.com/repos/glouppe/scikit-learn/releases{/id}","created_at":"2011-07-14T13:04:06Z","updated_at":"2015-07-20T06:46:00Z","pushed_at":"2015-09-25T11:26:46Z","git_url":"git://github.com/glouppe/scikit-learn.git","ssh_url":"git@github.com:glouppe/scikit-learn.git","clone_url":"https://github.com/glouppe/scikit-learn.git","svn_url":"https://github.com/glouppe/scikit-learn","homepage":"http://scikit-learn.sourceforge.net","size":67661,"stargazers_count":7,"watchers_count":7,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":0,"forks":1,"open_issues":0,"watchers":7,"default_branch":"master"}},"base":{"label":"scikit-learn:master","ref":"master","sha":"8fcd0632fa807f5f1e34e2af1a626519717c6ba1","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}","created_at":"2010-08-17T09:43:38Z","updated_at":"2015-10-13T05:54:16Z","pushed_at":"2015-10-13T01:55:35Z","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":136809,"stargazers_count":7825,"watchers_count":7825,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":4645,"mirror_url":null,"open_issues_count":770,"forks":4645,"open_issues":770,"watchers":7825,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/5300"},"html":{"href":"https://github.com/scikit-learn/scikit-learn/pull/5300"},"issue":{"href":"https://api.github.com/repos/scikit-learn/scikit-learn/issues/5300"},"comments":{"href":"https://api.github.com/repos/scikit-learn/scikit-learn/issues/5300/comments"},"review_comments":{"href":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/5300/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/5300/commits"},"statuses":{"href":"https://api.github.com/repos/scikit-learn/scikit-learn/statuses/1f4bc26a02443297ef103a3c72ea16114c7395a5"}}}}