gpt4 book ai didi

python - 搜索估计器参数返回的结果不在网格中?

转载 作者:太空宇宙 更新时间:2023-11-03 17:06:00 27 4
gpt4 key购买 nike

我正在使用 sklearn 并正在微调我的 SVM,但是当我尝试执行 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 内核。我是不是做错了什么?

最佳答案

我意识到,当尝试获取最佳估计器参数时,必须使用 best_params_ 属性。

通过说:

print(clf.best_params_)

我得到了最好的网格搜索参数。任何人都可以输入有关 estimator 值的含义(例如 estimator_C1.0)?

关于python - 搜索估计器参数返回的结果不在网格中?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34585829/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com