gridsearch cv

Solutions on MaxInterview for gridsearch cv by the best coders in the world

showing results for - "gridsearch cv"
Angela
13 Jan 2016
1>>> from sklearn import svm, datasets
2>>> from sklearn.model_selection import GridSearchCV
3>>> iris = datasets.load_iris()
4>>> parameters = {'kernel':('linear', 'rbf'), 'C':[1, 10]}
5>>> svc = svm.SVC()
6>>> clf = GridSearchCV(svc, parameters)
7>>> clf.fit(iris.data, iris.target)
8GridSearchCV(estimator=SVC(),
9             param_grid={'C': [1, 10], 'kernel': ('linear', 'rbf')})
10>>> sorted(clf.cv_results_.keys())
11['mean_fit_time', 'mean_score_time', 'mean_test_score',...
12 'param_C', 'param_kernel', 'params',...
13 'rank_test_score', 'split0_test_score',...
14 'split2_test_score', ...
15 'std_fit_time', 'std_score_time', 'std_test_score']