Sophie

Sophie

distrib > Mandriva > 2010.1 > i586 > by-pkgid > e578866d55cd81fdb23827cdf3cec911 > files > 546

python-scikits-learn-0.6-1mdv2010.2.i586.rpm



.. _example_plot_feature_selection.py:


===============================
Univariate Feature Selection
===============================

An example showing univariate feature selection.

Noisy (non informative) features are added to the iris data and
univariate feature selection is applied. For each feature, we plot the
p-values for the univariate feature selection and the corresponding
weights of an SVM. We can see that univariate feature selection
selects the informative features and that these have larger SVM weights.

In the total set of features, only the 4 first ones are significant. We
can see that they have the highest score with univariate feature
selection. The SVM attributes small weights to these features, but these
weight are non zero. Applying univariate feature selection before the SVM
increases the SVM weight attributed to the significant features, and will
thus improve classification.


.. image:: images/plot_feature_selection.png
    :align: center

**Python source code:** :download:`plot_feature_selection.py <plot_feature_selection.py>`

.. literalinclude:: plot_feature_selection.py
    :lines: 21-