scikit-learn/scikit-learn — pull request #2093 by jnothman (2013-06-24 08:58:14+00:00)
Title: [MRG] refactor feature selection by score

A number of places across the package perform feature selection by score, bounding the scores (specified absolutely or relatively) and/or limiting the number of features (specified absolutely or relatively).

While I think a `mask_by_score` utility could be useful for anyone playing with feature selection, I have particularly used it to assure correctness and common functionality in the many places this selection appears (univariate selection, learnt selector mixin, randomized l1, feature extraction).

I am not sure whether `mask_by_score`, or its realisation as a transformer, `SelectByScore`, should be part of the public API, or how they might come into examples or narrative documentation, and opinions are certainly welcome. It may be confusing that `univariate_selection` is also selection by score, but there the `score_func` returns both scores and p-values, and here we don't care what the scores are as long as they are orderable.

And I apologize for not having a negative total line count (but I think we lose a couple of lines if we remove comments, tests and blank lines)!