<commit_before>
=======================
Feature selection
=======================



Univariate feature selection
=============================

Univariate feature selection works by selecting features based on a
univariate test statistic. Although it can seen as a preprocessing step
to an estimator, `scikit.learn` exposes an object to wrap as existing
estimator with feature selection and expose a new estimator:

.. autofunction:: scikits.learn.feature_selection.univ_selection.UnivSelection

This object takes another estimator, a scoring function that returns
univariate p values, and a selection function that selects attributes.

Feature scoring functions
--------------------------

.. warning:: 

    A common case of non-functionning for feature selection is to use a 
    regression scoring function with a classification problem.

For classification
.......................

.. autofunction:: scikits.learn.feature_selection.univ_selection.f_classif

For regression
.................

.. autofunction:: scikits.learn.feature_selection.univ_selection.f_regression

Feature selection functions
----------------------------

.. autofunction:: scikits.learn.feature_selection.univ_selection.select_k_best

.. autofunction:: scikits.learn.feature_selection.univ_selection.select_percentile

.. autofunction:: scikits.learn.feature_selection.univ_selection.select_fpr

.. autofunction:: scikits.learn.feature_selection.univ_selection.select_fdr

.. autofunction:: scikits.learn.feature_selection.univ_selection.select_fwe


Examples
----------

.. literalinclude:: ../../examples/plot_feature_selection.py

<commit_msg>Update API changes in feature_selection doc.<commit_after>
=======================
Feature selection
=======================



Univariate feature selection
=============================

Univariate feature selection works by selecting features based on a
univariate test statistic. Although it can seen as a preprocessing step
to an estimator, `scikit.learn` exposes an object to wrap as existing
estimator with feature selection and expose a new estimator:

.. autofunction:: scikits.learn.feature_selection.univariate_selection.UnivSelection

This object takes another estimator, a scoring function that returns
univariate p values, and a selection function that selects attributes.

Feature scoring functions
--------------------------

.. warning:: 

    A common case of non-functionning for feature selection is to use a 
    regression scoring function with a classification problem.

For classification
.......................

.. autofunction:: scikits.learn.feature_selection.univariate_selection.f_classif

For regression
.................

.. autofunction:: scikits.learn.feature_selection.univariate_selection.f_regression

Feature selection functions
----------------------------

.. autofunction:: scikits.learn.feature_selection.univariate_selection.select_k_best

.. autofunction:: scikits.learn.feature_selection.univariate_selection.select_percentile

.. autofunction:: scikits.learn.feature_selection.univariate_selection.select_fpr

.. autofunction:: scikits.learn.feature_selection.univariate_selection.select_fdr

.. autofunction:: scikits.learn.feature_selection.univariate_selection.select_fwe


Examples
----------

.. literalinclude:: ../../examples/plot_feature_selection.py


{'fraction_non_alphanumeric': 0.16421495046532572, 'fraction_numerical': 0.0, 'mean_word_length': 3.9072164948453607, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6625186', 'n_tokens_mistral': 884, 'n_tokens_neox': 808, 'n_words': 237}