{"action":"created","issue":{"url":"https://api.github.com/repos/scikit-learn/scikit-learn/issues/6471","repository_url":"https://api.github.com/repos/scikit-learn/scikit-learn","labels_url":"https://api.github.com/repos/scikit-learn/scikit-learn/issues/6471/labels{/name}","comments_url":"https://api.github.com/repos/scikit-learn/scikit-learn/issues/6471/comments","events_url":"https://api.github.com/repos/scikit-learn/scikit-learn/issues/6471/events","html_url":"https://github.com/scikit-learn/scikit-learn/issues/6471","id":137686132,"number":6471,"title":"StratifiedShuffleSplit still buggy","user":{"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},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-03-01T21:03:03Z","updated_at":"2016-05-30T09:40:19Z","closed_at":null,"body":"```python\r\ny = [0, 1, 2, 3] * 3 + [4, 5] * 5                                                                  \r\nX = np.ones_like(y)                                                                                \r\n                                                                                                       \r\nsplits = StratifiedShuffleSplit(n_iter=1, train_size=11, test_size=11, random_state=0)                                     \r\n                                                                                                       \r\ntrain, test = next(iter(splits.split(X=X, y=y)))                                                   \r\n                                                                                                       \r\nassert_array_equal(np.intersect1d(train, test), [])   \r\nassert_equal(len(train), 11)\r\nassert_equal(len(test), 11)\r\n```\r\n> raise self.failureException('12 != 11')\r\n\r\nthis is a follow-up on #6379 and a sign that the logic is too complex. I'm doing a rewrite to fix this bug but it is not as clean as I'd like."},"comment":{"url":"https://api.github.com/repos/scikit-learn/scikit-learn/issues/comments/222454497","html_url":"https://github.com/scikit-learn/scikit-learn/issues/6471#issuecomment-222454497","issue_url":"https://api.github.com/repos/scikit-learn/scikit-learn/issues/6471","id":222454497,"user":{"login":"mattilyra","id":1055719,"avatar_url":"https://avatars.githubusercontent.com/u/1055719?v=3","gravatar_id":"","url":"https://api.github.com/users/mattilyra","html_url":"https://github.com/mattilyra","followers_url":"https://api.github.com/users/mattilyra/followers","following_url":"https://api.github.com/users/mattilyra/following{/other_user}","gists_url":"https://api.github.com/users/mattilyra/gists{/gist_id}","starred_url":"https://api.github.com/users/mattilyra/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mattilyra/subscriptions","organizations_url":"https://api.github.com/users/mattilyra/orgs","repos_url":"https://api.github.com/users/mattilyra/repos","events_url":"https://api.github.com/users/mattilyra/events{/privacy}","received_events_url":"https://api.github.com/users/mattilyra/received_events","type":"User","site_admin":false},"created_at":"2016-05-30T09:40:19Z","updated_at":"2016-05-30T09:40:19Z","body":"I can add a few more test cases to this. With the following data\r\n\r\n    import sklearn.cross_validation\r\n    from sklearn.datasets import make_blobs\r\n    X, y = make_blobs(n_samples=1000, n_features=2, random_state=42, cluster_std=5.0)\r\n\r\nAll manner of crazy things happen\r\n    split = sklearn.cross_validation.StratifiedShuffleSplit(y, test_size=0.09, train_size=0.1)\r\n    train_idx, test_idx = next(iter(split))\r\n    assert_equal(train_idx.shape[0], split.n_train)\r\n    assert_equal(test_idx.shape[0], split.n_test)\r\n\r\n    AssertionError: \r\n    Items are not equal:\r\n     ACTUAL: 901\r\n     DESIRED: 90\r\n\r\n    split = sklearn.cross_validation.StratifiedShuffleSplit(y, test_size=0.11, train_size=0.1)\r\n    train_idx, test_idx = next(iter(split))\r\n    assert_equal(train_idx.shape[0], split.n_train)\r\n    assert_equal(test_idx.shape[0], split.n_test)\r\n\r\n    AssertionError: \r\n    Items are not equal:\r\n     ACTUAL: 900\r\n     DESIRED: 110"}}
{"actor":{"display_login":"mattilyra"}}