Module Expr Str ImportFrom alias ImportFrom alias ImportFrom alias ImportFrom alias ImportFrom alias ImportFrom alias Expr Call NameLoad NameLoad Assign NameStore Call AttributeLoad NameLoad attr Assign NameStore Call NameLoad AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr TupleLoad NameLoad Num Assign NameStore AttributeLoad NameLoad attr Assign TupleStore NameStore NameStore NameStore NameStore Call NameLoad NameLoad NameLoad keyword Num keyword Num Assign NameStore ListLoad Dict Str Str Str ListLoad Str ListLoad Num Num ListLoad Num Num Num Num Dict Str Str ListLoad Str ListLoad Num Num Num Num Assign NameStore ListLoad Str Str For NameStore NameLoad body Expr Call NameLoad BinOpMod Str NameLoad Expr Call NameLoad Assign NameStore Call NameLoad Call NameLoad keyword Num NameLoad keyword Num keyword BinOpMod Str NameLoad Expr Call AttributeLoad NameLoad attr NameLoad NameLoad Expr Call NameLoad Str Expr Call NameLoad Expr Call NameLoad AttributeLoad NameLoad attr Expr Call NameLoad Expr Call NameLoad Str Expr Call NameLoad For TupleStore NameStore NameStore NameStore AttributeLoad NameLoad attr body Expr Call NameLoad BinOpMod Str TupleLoad NameLoad BinOpMult Call AttributeLoad NameLoad attr Num NameLoad Expr Call NameLoad Expr Call NameLoad Str Expr Call NameLoad Expr Call NameLoad Str Expr Call NameLoad Str Expr Call NameLoad Assign TupleStore NameStore NameStore TupleLoad NameLoad Call AttributeLoad NameLoad attr NameLoad Expr Call NameLoad Call NameLoad NameLoad NameLoad Expr Call NameLoad
N/A N/A 
============================================================
Parameter estimation using grid search with cross-validation
============================================================

This examples shows how a classifier is optimized by cross-validation,
which is done using the :class:`sklearn.model_selection.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`.

 __future__ print_function sklearn datasets sklearn.model_selection train_test_split sklearn.model_selection GridSearchCV sklearn.metrics classification_report sklearn.svm SVC N/A N/A print __doc__ N/A digits N/A N/A datasets load_digits N/A n_samples N/A len N/A digits images N/A X N/A N/A N/A digits images reshape N/A n_samples -1 N/A y N/A digits target N/A N/A X_train X_test y_train y_test N/A train_test_split X y test_size 0.5 random_state 0 N/A tuned_parameters N/A N/A kernel gamma C N/A rbf N/A 0.001 0.0001 N/A 1 10 100 1000 N/A kernel C N/A linear N/A 1 10 100 1000 N/A scores N/A precision recall N/A score scores N/A N/A N/A print N/A # Tuning hyper-parameters for %s score N/A N/A print N/A clf N/A GridSearchCV N/A SVC C 1 tuned_parameters cv 5 scoring N/A %s_weighted score N/A N/A N/A clf fit X_train y_train N/A N/A print Best parameters set found on development set: N/A N/A print N/A N/A print N/A clf best_params_ N/A N/A print N/A N/A print Grid scores on development set: N/A N/A print N/A N/A params mean_score scores N/A clf grid_scores_ N/A N/A N/A print N/A %0.3f (+/-%0.03f) for %r N/A mean_score N/A N/A N/A scores std 2 params N/A N/A print N/A N/A print Detailed classification report: N/A N/A print N/A N/A print The model is trained on the full development set. N/A N/A print The scores are computed on the full evaluation set. N/A N/A print N/A N/A y_true y_pred N/A y_test N/A N/A clf predict X_test N/A N/A print N/A classification_report y_true y_pred N/A N/A print