对于 sklearn 里面的 SVM 分类器,可以通过下面的方式显示设定几个关键字的值
clf = svm.SVC(
C=9,
kernel='rbf',
tol=1e-3,
cache_size=200,
random_state=12345
)
但是对于 dict.get() 就不能显示指定 default = xxx
dict.get(1, default=None)
>>> TypeError: get() takes no keyword arguments
有人知道这是为什么吗?
注:上面的例子中每个关键字都有默认值,声明如下
def __init__(
self,
*,
C=1.0,
kernel="rbf",
degree=3,
gamma="scale",
coef0=0.0,
shrinking=True,
probability=False,
tol=1e-3,
cache_size=200,
class_weight=None,
verbose=False,
max_iter=-1,
decision_function_shape="ovr",
break_ties=False,
random_state=None,
):
0 Commentaires