

.. _example_plot_rfe_with_cross_validation.py:


===================================================
Recursive feature elimination with cross-validation
===================================================

A recursive feature elimination example with automatic tuning of the
number of features selected with cross-validation.



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


**Script output**::

  Optimal number of features : 5



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

.. literalinclude:: plot_rfe_with_cross_validation.py
    :lines: 9-
    