{"action":"created","issue":{"url":"https://api.github.com/repos/scikit-learn/scikit-learn/issues/4206","labels_url":"https://api.github.com/repos/scikit-learn/scikit-learn/issues/4206/labels{/name}","comments_url":"https://api.github.com/repos/scikit-learn/scikit-learn/issues/4206/comments","events_url":"https://api.github.com/repos/scikit-learn/scikit-learn/issues/4206/events","html_url":"https://github.com/scikit-learn/scikit-learn/pull/4206","id":56692407,"number":4206,"title":"[MRG] explicit exception message for strict selectors","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},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":8,"created_at":"2015-02-05T16:23:51Z","updated_at":"2015-02-06T09:04:15Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/4206","html_url":"https://github.com/scikit-learn/scikit-learn/pull/4206","diff_url":"https://github.com/scikit-learn/scikit-learn/pull/4206.diff","patch_url":"https://github.com/scikit-learn/scikit-learn/pull/4206.patch"},"body":"This is a fix for #4059 to raise a `ValueError` at transform time with an explicit error message instead of crashing when calling `get_support()` with a cryptic error message.\r\n\r\nNote that for consistency, the behavior of `SelectKBest(k=0)` is also impacted by this change."},"comment":{"url":"https://api.github.com/repos/scikit-learn/scikit-learn/issues/comments/73206298","html_url":"https://github.com/scikit-learn/scikit-learn/pull/4206#issuecomment-73206298","issue_url":"https://api.github.com/repos/scikit-learn/scikit-learn/issues/4206","id":73206298,"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},"created_at":"2015-02-06T09:04:15Z","updated_at":"2015-02-06T09:04:15Z","body":"This is the kind of weird downstream errors that might be caused by passing empty datasets to models:\r\n\r\n```\r\n>>> X = np.ones(0).reshape(10, 0)\r\n>>> y = np.random.random_integers(0, 2, 10)\r\n>>> SVC().fit(X, y)\r\nTraceback (most recent call last):\r\n  File \"<ipython-input-20-0c9fbc689f4e>\", line 1, in <module>\r\n    SVC().fit(X, y)\r\n  File \"/Users/ogrisel/code/scikit-learn/sklearn/svm/base.py\", line 164, in fit\r\n    self._gamma = 1.0 / X.shape[1]\r\nZeroDivisionError: float division by zero\r\n```\r\n\r\nWe should probably make our input validation check stricter for the case where `X.shape[1] == 0` to raise better error messages in general but It think it's worth fixing it upstream in the selector mixin as well."}}