scikit-learn/scikit-learn — pull request #1770 by jnothman (2013-03-13 07:21:42+00:00)
Title: ENH allow SelectKBest to select all features in a parameter search

Currently it is difficult to perform a grid-search over k for SelectKBest feature selection such that one parameter option is to ignore SelectKBest altogether (i.e. k == infty). If k > X.shape[1], it throws an error, and X.shape is not always known when the parameter grid is constructed. This patch allows one to use a parameter grid such as `{'k': [5, 10, 20, 40, 80, SelectKBest.SELECT_ALL]}` to include bypassing the selector as an option.

An alternative to this is to harness #1769 to simply switch off the SelectKBest component. Perhaps neither solution is intuitive!