{"action":"created","issue":{"url":"https://api.github.com/repos/scikit-learn/scikit-learn/issues/7935","repository_url":"https://api.github.com/repos/scikit-learn/scikit-learn","labels_url":"https://api.github.com/repos/scikit-learn/scikit-learn/issues/7935/labels{/name}","comments_url":"https://api.github.com/repos/scikit-learn/scikit-learn/issues/7935/comments","events_url":"https://api.github.com/repos/scikit-learn/scikit-learn/issues/7935/events","html_url":"https://github.com/scikit-learn/scikit-learn/pull/7935","id":191552240,"number":7935,"title":"[MRG + 1] Set a random random_state at init to ensure deterministic randomness when random_state is `None`","user":{"login":"raghavrv","id":9487348,"avatar_url":"https://avatars.githubusercontent.com/u/9487348?v=3","gravatar_id":"","url":"https://api.github.com/users/raghavrv","html_url":"https://github.com/raghavrv","followers_url":"https://api.github.com/users/raghavrv/followers","following_url":"https://api.github.com/users/raghavrv/following{/other_user}","gists_url":"https://api.github.com/users/raghavrv/gists{/gist_id}","starred_url":"https://api.github.com/users/raghavrv/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/raghavrv/subscriptions","organizations_url":"https://api.github.com/users/raghavrv/orgs","repos_url":"https://api.github.com/users/raghavrv/repos","events_url":"https://api.github.com/users/raghavrv/events{/privacy}","received_events_url":"https://api.github.com/users/raghavrv/received_events","type":"User","site_admin":false},"labels":[{"id":273400470,"url":"https://api.github.com/repos/scikit-learn/scikit-learn/labels/Blocker","name":"Blocker","color":"e11d21","default":false},{"id":12995755,"url":"https://api.github.com/repos/scikit-learn/scikit-learn/labels/Bug","name":"Bug","color":"e10c02","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/scikit-learn/scikit-learn/milestones/21","html_url":"https://github.com/scikit-learn/scikit-learn/milestones/0.19","labels_url":"https://api.github.com/repos/scikit-learn/scikit-learn/milestones/21/labels","id":1970916,"number":21,"title":"0.19","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":184,"closed_issues":44,"state":"open","created_at":"2016-08-29T22:34:33Z","updated_at":"2016-12-07T16:54:52Z","due_on":"2017-04-01T00:00:00Z","closed_at":null},"comments":37,"created_at":"2016-11-24T15:55:02Z","updated_at":"2016-12-07T20:55:18Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/7935","html_url":"https://github.com/scikit-learn/scikit-learn/pull/7935","diff_url":"https://github.com/scikit-learn/scikit-learn/pull/7935.diff","patch_url":"https://github.com/scikit-learn/scikit-learn/pull/7935.patch"},"body":"This is a better fix for #6726 as opposed to my previous #7660 \r\n\r\nEnsures deterministic randomness across multiple calls to `split` even when `random_state` is not set...\r\n\r\nThis replicates the behaviour of cross-validators in pre 0.18...\r\n\r\n#### In master (0.18.1)\r\n\r\n```py\r\n>>> from sklearn.model_selection import KFold\r\n\r\n# Splits are different for multiple split calls when random_state is not set\r\n>>> kf = KFold(n_splits=2, shuffle=True, random_state=None)\r\n>>> for _ in range(2):\r\n...     print(list(kf.split([1,] * 4)))\r\n[(array([2, 3]), array([0, 1])), (array([0, 1]), array([2, 3]))]\r\n[(array([1, 2]), array([0, 3])), (array([0, 3]), array([1, 2]))]\r\n```\r\n\r\n#### In this branch, splits are different for multiple initializations of cross-validators but same across multiple split calls for the same initialization.\r\n\r\n```py\r\n>>> from sklearn.model_selection import KFold\r\n\r\n# Splits are same for same initialization in successive split calls.\r\n>>> kf = KFold(n_splits=2, shuffle=True, random_state=None)\r\n>>> for _ in range(2):\r\n...     print(list(kf.split([1,] * 4)))\r\n[(array([2, 3]), array([0, 1])), (array([0, 1]), array([2, 3]))]\r\n[(array([2, 3]), array([0, 1])), (array([0, 1]), array([2, 3]))]\r\n\r\n# Splits are different for different initializations of cross-validators.\r\n>>> for _ in range(2):\r\n...     print(list(KFold(n_splits=2, shuffle=True, random_state=None).split([1,] * 4)))\r\n[(array([0, 2]), array([1, 3])), (array([1, 3]), array([0, 2]))]\r\n[(array([0, 3]), array([1, 2])), (array([1, 2]), array([0, 3]))]\r\n```\r\n\r\nPing @GaelVaroquaux @jnothman @amueller \r\n\r\n(Sorry for the tongue twisting PR title :p)"},"comment":{"url":"https://api.github.com/repos/scikit-learn/scikit-learn/issues/comments/265570484","html_url":"https://github.com/scikit-learn/scikit-learn/pull/7935#issuecomment-265570484","issue_url":"https://api.github.com/repos/scikit-learn/scikit-learn/issues/7935","id":265570484,"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-12-07T20:55:17Z","updated_at":"2016-12-07T20:55:17Z","body":"You might make the analogy that current behaviour considers split like fit;\nproposed behaviour here considers split like transform.\n\nOn 8 December 2016 at 07:54, Joel Nothman <joel.nothman@gmail.com> wrote:\n\n> We had a different interface in 0.17. We had sufficient information at\n> __init__ to determine the entire partition statically. Here we only have\n> that information when split is called.\n>\n> On 8 December 2016 at 03:23, Andreas Mueller <notifications@github.com>\n> wrote:\n>\n>> Hm... we introduced this behavior in 0.18 and now we're going back to\n>> where we were in 0.17, right? We didn't really intentionally change that in\n>> 0.18 and one could argue that this is a bug-fix to restore the old behavior.\n>> On the other hand I guess changing twice is worse than changing once.\n>>\n>> I'm kind of torn on this. Actually the behavior in current master is\n>> consistent with how estimators behave on fit.\n>>\n>> —\n>> You are receiving this because you were mentioned.\n>> Reply to this email directly, view it on GitHub\n>> <https://github.com/scikit-learn/scikit-learn/pull/7935#issuecomment-265493909>,\n>> or mute the thread\n>> <https://github.com/notifications/unsubscribe-auth/AAEz67Q3UFPegXsEqxFVbxSKsuoqw4Ynks5rFt1ugaJpZM4K7ykQ>\n>> .\n>>\n>\n>\n"}}
{"actor":{"display_login":"jnothman"}}