{"action":"opened","issue":{"url":"https://api.github.com/repos/scikit-learn/scikit-learn/issues/8243","repository_url":"https://api.github.com/repos/scikit-learn/scikit-learn","labels_url":"https://api.github.com/repos/scikit-learn/scikit-learn/issues/8243/labels{/name}","comments_url":"https://api.github.com/repos/scikit-learn/scikit-learn/issues/8243/comments","events_url":"https://api.github.com/repos/scikit-learn/scikit-learn/issues/8243/events","html_url":"https://github.com/scikit-learn/scikit-learn/issues/8243","id":203894858,"number":8243,"title":"Using Several Parameters with GridSearchCV","user":{"login":"ScientiaEtVeritas","id":6824488,"avatar_url":"https://avatars.githubusercontent.com/u/6824488?v=3","gravatar_id":"","url":"https://api.github.com/users/ScientiaEtVeritas","html_url":"https://github.com/ScientiaEtVeritas","followers_url":"https://api.github.com/users/ScientiaEtVeritas/followers","following_url":"https://api.github.com/users/ScientiaEtVeritas/following{/other_user}","gists_url":"https://api.github.com/users/ScientiaEtVeritas/gists{/gist_id}","starred_url":"https://api.github.com/users/ScientiaEtVeritas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ScientiaEtVeritas/subscriptions","organizations_url":"https://api.github.com/users/ScientiaEtVeritas/orgs","repos_url":"https://api.github.com/users/ScientiaEtVeritas/repos","events_url":"https://api.github.com/users/ScientiaEtVeritas/events{/privacy}","received_events_url":"https://api.github.com/users/ScientiaEtVeritas/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2017-01-29T20:43:59Z","updated_at":"2017-01-29T20:43:59Z","closed_at":null,"body":"When using (for *example*) the following transformators\r\n\r\n -  ``CountVectorizer``\r\n - ``TruncatedSVD``\r\n - ``SelectKBest``\r\n\r\nwith ``GridSearchCV`` it happens that it chooses a number for ``n_features`` for ``CountVectorizer`` that is less than ``n_components`` for ``TruncatedSVD``  or ``k`` for ``SelectKBest``.\r\n\r\nThis leads to an **error**: ``ValueError: n_components must be < n_features``\r\n\r\nFor ``SelectKBest`` I found a temporary solution:\r\n\r\n    class SelectAtMostKBest(SelectKBest):\r\n        def _check_params(self, X, y):\r\n            if not (self.k == \"all\" or 0 <= self.k <= X.shape[1]):\r\n                self.k = \"all\"\r\n\r\nBut there is no equivalent for ``TruncatedSVD``.\r\nIs this behaviour intended? If yes, what can I do about this?"}}
{"actor":{"display_login":"ScientiaEtVeritas"}}