我一直在查看scikit的文档这么久了,它说我能够将SVC中的C值更改为不同的值,但我看不到要查找的实际代码所以。我希望看到将其更改为不同值的结果。我从文档中获取代码如下:
>>> X = [[0], [1], [2], [3]]
>>> Y = [0, 1, 2, 3]
>>> clf = svm.SVC()
>>> clf.fit(X, Y)
SVC(C=1.0, cache_size=200, class_weight=None, coef0=0.0, degree=3,
gamma=0.0, kernel='rbf', max_iter=-1, probability=False, random_state=None,
shrinking=True, tol=0.001, verbose=False)
但是他们拥有自己的数组而不是X,Y的值。我的问题是,如何将SVC中的C值更改为1.0以外的数字。
答案 0 :(得分:1)
将其指定为构造函数的可选参数,即
>>> clf = svm.SVC(C=2)
>>> clf.fit(X, Y)
SVC(C=2, cache_size=200, class_weight=None, coef0=0.0, degree=3, gamma=0.0,
kernel='rbf', max_iter=-1, probability=False, random_state=None,
shrinking=True, tol=0.001, verbose=False)
>>>