__作为分隔符。在这种情况下,SVC模型存储为
estimator在
OneVsRestClassifier模型内部命名的属性:
from sklearn.datasets import load_irisfrom sklearn.multiclass import oneVsRestClassifierfrom sklearn.svm import SVCfrom sklearn.grid_search import GridSearchCVfrom sklearn.metrics import f1_scoreiris = load_iris()model_to_set = oneVsRestClassifier(SVC(kernel="poly"))parameters = { "estimator__C": [1,2,4,8], "estimator__kernel": ["poly","rbf"], "estimator__degree":[1, 2, 3, 4],}model_tunning = GridSearchCV(model_to_set, param_grid=parameters, score_func=f1_score)model_tunning.fit(iris.data, iris.target)print model_tunning.best_score_print model_tunning.best_params_
产生:
0.973290762737{'estimator__kernel': 'poly', 'estimator__C': 1, 'estimator__degree': 2}
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)