

.. _example_grid_search_digits.py:


=====================================================================
Parameter estimation using grid search with a nested cross-validation
=====================================================================

The classifier is optimized by "nested" cross-validation using the
:class:`sklearn.grid_search.GridSearchCV` object on a development set
that comprises only half of the available labeled data.

The performance of the selected hyper-parameters and trained model is
then measured on a dedicated evaluation set that was not used during
the model selection step.

More details on tools available for model selection can be found in the
sections on :ref:`cross_validation` and :ref:`grid_search`.



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

.. literalinclude:: grid_search_digits.py
    :lines: 18-
    