{"action":"created","issue":{"url":"https://api.github.com/repos/scikit-learn/scikit-learn/issues/3850","labels_url":"https://api.github.com/repos/scikit-learn/scikit-learn/issues/3850/labels{/name}","comments_url":"https://api.github.com/repos/scikit-learn/scikit-learn/issues/3850/comments","events_url":"https://api.github.com/repos/scikit-learn/scikit-learn/issues/3850/events","html_url":"https://github.com/scikit-learn/scikit-learn/pull/3850","id":48655727,"number":3850,"title":"[MRG+1] Make ParameterSampler sample without replacement","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":14,"created_at":"2014-11-13T16:16:31Z","updated_at":"2015-01-17T20:00:47Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/3850","html_url":"https://github.com/scikit-learn/scikit-learn/pull/3850","diff_url":"https://github.com/scikit-learn/scikit-learn/pull/3850.diff","patch_url":"https://github.com/scikit-learn/scikit-learn/pull/3850.patch"},"body":"Fixes #3792.\r\nI think this issue came up before so maybe it is worth addressing.\r\nThis makes the ParametersSampler sample without replacement if all parameters are lists.\r\nThis has a couple of gotchas:\r\n\r\n* It changes current behavior, in particular I raise an error if there are less possible settings than ``n_iter``.\r\n* I don't know if there is a way to detect finite support in a scipy distribution, so we can not do it there. That means that ``'bla' : bernoulli(0.5)`` is not equivalent any more to ``'bla': [0, 1]`` (the first does sampling with replacement, the second without)\r\n\r\nPossibilities to resolve these would be:\r\n* give a warning instead of a value error when ``n_iter`` > ``grid_size`` and produce a smaller grid (or sample with replacement in this case?). Might invalidate the ``__len__`` implementation.\r\n* add a parameter ``with_replacement``, set it to ``None``, and go to a deprecation cycle to set it to ``False``. The parameter would only do something in the case all parameters are lists, though.\r\n* Hack into the scipy dists, check if something is discrete and use lower and upper to get the support. If a user tries to implement his own distribution with finite support, we would still be screwed."},"comment":{"url":"https://api.github.com/repos/scikit-learn/scikit-learn/issues/comments/70381996","html_url":"https://github.com/scikit-learn/scikit-learn/pull/3850#issuecomment-70381996","issue_url":"https://api.github.com/repos/scikit-learn/scikit-learn/issues/3850","id":70381996,"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},"created_at":"2015-01-17T20:00:47Z","updated_at":"2015-01-17T20:00:47Z","body":"Sorry I don't understand your question. For distributions we do sampling with replacement as we can't know if the space was exhausted yet."}}