Python sklearn.model_selection.GridSearchCV如何检索所有.best_参数_

Python sklearn.model_selection.GridSearchCV如何检索所有.best_参数_,python,machine-learning,scikit-learn,classification,svm,Python,Machine Learning,Scikit Learn,Classification,Svm,当我调用svc\u bag\u grid时,我在param\u grid中指定了两个参数。best\u params\u它只返回{'base\u estimator\u svc\u kernel':'linear'},但我还想知道svc()中我指定的param\u grid的最佳C值,每个参数都是其中的一个元素。而不是你现有的字典列表 svc_pipeline = make_pipeline( StandardScaler(), SVC(random_state=1) ) pipe_sv

当我调用
svc\u bag\u grid时,我在
param\u grid
中指定了两个参数。best\u params\u
它只返回
{'base\u estimator\u svc\u kernel':'linear'}
,但我还想知道
svc()
中我指定的
param\u grid
的最佳C值,每个参数都是其中的一个元素。而不是你现有的字典列表

svc_pipeline = make_pipeline(
    StandardScaler(), SVC(random_state=1)
)
pipe_svc_bag = BaggingClassifier(
    base_estimator=svc_pipeline, n_estimators=10, bootstrap=True, random_state=1
)
param_grid = [
    {'base_estimator__svc__kernel': ['linear', 'poly', 'rbf', 'sigmoid']},
    {'base_estimator__svc__C': np.linspace(0.1, 2, 20)}
]
svc_bag_grid = GridSearchCV(
    estimator=pipe_svc_bag, param_grid=param_grid, cv=10
)
svc_bag_grid.fit(X, y)
print(svc_bag_grid.best_params_)
param_grid = {'base_estimator__svc__C': np.linspace(0.1, 2, 20),
    'base_estimator__svc__kernel': ['linear', 'poly', 'rbf', 'sigmoid']}