1

我正在使用 sklearn 并正在微调我的 SVM,但是当我尝试做 a 时GridSearchCV,我得到了我什至没有网格搜索的参数!

举个例子:

parameters = {'kernel':['linear'], 'C': [10, 100, 1000]}
cv = cross_validation.ShuffleSplit(len(X), n_iter=4, test_size=0.1, random_state=None)
svr = SVC()
clf = grid_search.GridSearchCV(svr, parameters, cv=cv)
clf.fit(X,Y) #X,Y are my two datasets

当我运行时clf.get_params(),我得到:

n_jobs : 1
verbose : 0
estimator__gamma : auto
estimator__decision_function_shape : None
estimator__probability : False
param_grid : {'kernel': ['linear'], 'C': [10, 100, 1000]}
cv : ShuffleSplit(120, n_iter=4, test_size=0.1, random_state=None)
scoring : None
estimator__cache_size : 200
estimator__verbose : False
pre_dispatch : 2*n_jobs
estimator__kernel : rbf
fit_params : {}
estimator__max_iter : -1
refit : True
iid : True
estimator__shrinking : True
estimator__degree : 3
estimator__class_weight : None
estimator__C : 1.0
estimator__random_state : None
estimator : SVC(C=1.0, cache_size=200, class_weight=None, coef0=0.0,
  decision_function_shape=None, degree=3, gamma='auto', kernel='rbf',
  max_iter=-1, probability=False, random_state=None, shrinking=True,
  tol=0.001, verbose=False)
estimator__coef0 : 0.0
error_score : raise
estimator__tol : 0.001

它每次都给我一个 C 值 1 和 rbf 内核。有什么我做错了吗?

4

1 回答 1

1

我意识到,在尝试获得最佳估算器参数时,您必须使用该best_params_属性。

通过说:

print(clf.best_params_)

我得到了最好的网格搜索参数。任何人都可以就这些estimator值的含义(estimator_C例如1.0)提供输入吗?

于 2016-01-04T06:35:27.773 回答