sklearn.model_selection
.GridSearchCV
GridSearchCV
(estimator, param_grid, scoring=None, n_jobs=None, iid='deprecated', refit=True, cv=None, verbose=0, pre_dispatch='2*n_jobs', error_score=nan, return_train_score=False)
cv_results_ dict of numpy (masked) ndarrays
will be represented by a cv_results_
dict of:
{ 'param_kernel': masked_array(data = ['poly', 'poly', 'rbf', 'rbf'], mask = [False False False False]...) 'param_gamma': masked_array(data = [-- -- 0.1 0.2], mask = [ True True False False]...), 'param_degree': masked_array(data = [2.0 3.0 -- --], mask = [False False True True]...), 'split0_test_score' : [0.80, 0.70, 0.80, 0.93], 'split1_test_score' : [0.82, 0.50, 0.70, 0.78], 'mean_test_score' : [0.81, 0.60, 0.75, 0.85], 'std_test_score' : [0.01, 0.10, 0.05, 0.08], 'rank_test_score' : [2, 4, 3, 1], 'split0_train_score' : [0.80, 0.92, 0.70, 0.93], 'split1_train_score' : [0.82, 0.55, 0.70, 0.87], 'mean_train_score' : [0.81, 0.74, 0.70, 0.90], 'std_train_score' : [0.01, 0.19, 0.00, 0.03], 'mean_fit_time' : [0.73, 0.63, 0.43, 0.49], 'std_fit_time' : [0.01, 0.02, 0.01, 0.01], 'mean_score_time' : [0.01, 0.06, 0.04, 0.04], 'std_score_time' : [0.00, 0.00, 0.00, 0.01], 'params' : [{'kernel': 'poly', 'degree': 2}, ...], }
best_estimator_ estimator
best_score_ float
Mean cross-validated score of the best_estimator
best_params_ dict
Parameter setting that gave the best results on the hold out data.
best_index_ int
The index (of the cv_results_
arrays) which corresponds to the best candidate parameter setting.
The dict at search.cv_results_['params'][search.best_index_]
gives the parameter setting for the best model, that gives the highest mean score (search.best_score_
).
scorer_ function or a dict
Scorer function used on the held out data to choose the best parameters for the model.
n_splits_ int
The number of cross-validation splits (folds/iterations).
refit_time_ float
Seconds used for refitting the best model on the whole dataset.
Methods
| Call decision_function on the estimator with the best found parameters. |
| Run fit with all sets of parameters. |
| Get parameters for this estimator. |
| Call inverse_transform on the estimator with the best found params. |
| Call predict on the estimator with the best found parameters. |
| Call predict_log_proba on the estimator with the best found parameters. |
| Call predict_proba on the estimator with the best found parameters. |
| Returns the score on the given data, if the estimator has been refit. |
| Set the parameters of this estimator. |
| Call transform on the estimator with the best found parameters. |