使用带间隔的 GridSearchCV
Using GridSearchCV with interval
当使用 GridSearchCV() 函数在 python 中使用 Grid 搜索分类器时,假设我们有一个参数区间来调整 1 到 100 的形式,我们如何能够指定(1:100 不工作)??
这是将参数传递给 GridSearchCV() 函数的方式:
pipeline = Pipeline([
('clf', OneVsRestClassifier(SVC(), n_jobs=1)),
])
parameters = [
{'clf__estimator__kernel': ['rbf'],
'clf__estimator__gamma': [1e-3, 1e-4],
'clf__estimator__C': [1, 10]
},
{'clf__estimator__kernel': ['poly'],
'clf__estimator__C': [1, 10]
}
]
grid_search_tune = GridSearchCV(pipeline, parameters, cv=2, n_jobs=3, verbose=10)
当使用 GridSearchCV() 函数在 python 中使用 Grid 搜索分类器时,假设我们有一个参数区间来调整 1 到 100 的形式,我们如何能够指定(1:100 不工作)??
这是将参数传递给 GridSearchCV() 函数的方式:
pipeline = Pipeline([
('clf', OneVsRestClassifier(SVC(), n_jobs=1)),
])
parameters = [
{'clf__estimator__kernel': ['rbf'],
'clf__estimator__gamma': [1e-3, 1e-4],
'clf__estimator__C': [1, 10]
},
{'clf__estimator__kernel': ['poly'],
'clf__estimator__C': [1, 10]
}
]
grid_search_tune = GridSearchCV(pipeline, parameters, cv=2, n_jobs=3, verbose=10)