1、SVC函数原型
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)
2、参数详解
- C:惩罚参数。 默认值是1.0,C越大,相当于惩罚松弛变量,希望松弛变量接近0,即对误分类的惩罚增大,趋向于对训练集全分对的情况,这样对训练集测试时准确率很高,但容易过拟合,高方差,泛化能力弱。C值小,对误分类的惩罚减小,允许容错,将他们当成噪声点,泛化能力较强,但过小容易欠拟合,高偏差。
- cache_size :核函数cache缓存大小,默认为200。
- class_weight :类别的权重,字典形式传递。设置第几类的参数C为weight*C(C-SVC中的C)
- coef0 :核函数的常数项。对于‘poly’和 ‘sigmoid’有用。
- decision_function_shape :‘ovo’, ‘ovr’ or None, default=ovr
- degree :多项式poly函数的维度,默认是3,选择其他核函数时会被忽略。
- gamma : ‘rbf’,‘poly’和‘sigmoid’的核函数参数。默认是’auto’,如果是auto,则值为1/n_features
- kernel :核函数。默认是’rbf’,可以是‘linear’, ‘poly’, ‘rbf’, ‘sigmoid’, ‘precomputed’
0 – 线性