我正在运行一个GridSearchCV使用OneVsRestClasssifer作为SVC估计器的。这是我Pipeline和GridSearchCV参数的方面:
pipeline = Pipeline([
('clf', OneVsRestClassifier(SVC(verbose=True), n_jobs=1)),
])
parameters = {
"clf__estimator__C": [0.1, 1],
"clf__estimator__kernel": ['poly', 'rbf'],
"clf__estimator__degree": [2, 3],
}
grid_search_tune = GridSearchCV(pipeline, parameters, cv=2, n_jobs=8, verbose=10)
grid_search_tune.fit(train_x, train_y)
根据 SVC 的文档,该degree参数仅由poly内核使用:
http://scikit-learn.org/stable/modules/generated/sklearn.svm.SVC.html
度数:int,可选(默认=3)
多项式核函数 ('poly') 的度数。被所有其他内核忽略。
但是当我看到我的输出时,GridSearchCV它似乎正在为每个配置计算不同的运行,每个SVC配置都有一个rbf内核和不同的degree参数值。
[CV] clf__estimator__kernel=poly, clf__estimator__C=0.1, clf__estimator__degree=2
[CV] clf__estimator__kernel=poly, clf__estimator__C=0.1, clf__estimator__degree=2
[CV] clf__estimator__kernel=rbf, clf__estimator__C=0.1, clf__estimator__degree=2
[CV] clf__estimator__kernel=rbf, clf__estimator__C=0.1, clf__estimator__degree=2
[CV] clf__estimator__kernel=poly, clf__estimator__C=0.1, clf__estimator__degree=3
[CV] clf__estimator__kernel=poly, clf__estimator__C=0.1, clf__estimator__degree=3
[CV] clf__estimator__kernel=rbf, clf__estimator__C=0.1, clf__estimator__degree=3
[CV] clf__estimator__kernel=rbf, clf__estimator__C=0.1, clf__estimator__degree=3
当内核设置为时,不应该忽略所有度的值rbf吗?