我正在尝试优化我的 SVM,使用交叉验证来估计我的性能。
似乎更改 C 参数无济于事 - 怎么会?
from sklearn import cross_validation
from sklearn import svm
for C in [0.1, 0.5, 1.0, 2.0, 4.0]:
clf = svm.SVC(kernel='linear', C=C)
scores = cross_validation.cross_val_score(clf, X, y, cv=6, n_jobs = -1)
print C, scores
结果是
> 0.1 [ 0.88188976 0.85826772 0.90118577 0.90909091 0.8972332 0.86561265]
> 0.5 [ 0.88188976 0.85826772 0.90118577 0.90909091 0.8972332 0.86561265]
> 1.0 [ 0.88188976 0.85826772 0.90118577 0.90909091 0.8972332 0.86561265]
> 2.0 [ 0.88188976 0.85826772 0.90118577 0.90909091 0.8972332 0.86561265]
> 4.0 [ 0.88188976 0.85826772 0.90118577 0.90909091 0.8972332 0.86561265]