0
SVM分類我有一組參數使用GridSearchCV選擇適合svm.SVC分類的最好的:Class_weight在Python中
X=dataset.ix[:, dataset.columns != 'class']
Y=dataset['class']
X_train, X_test, Y_train, Y_test = cross_validation.train_test_split(X, Y, test_size=0.5)
clf=svm.SVC()
params=
{'kernel':['linear', 'rbf', 'poly', 'sigmoid'],
'C':[1, 5, 10],
'degree':[2,3],
'gamma':[0.025, 1.0, 1.25, 1.5, 1.75, 2.0],
'coef0':[2, 5, 9],
'class_weight': [{1:10}, 'balanced']}
searcher = GridSearchCV(clf, params, cv=9, n_jobs=-1, scoring=f1)
searcher.fit(X_train, Y_train)
,我得到的錯誤:ValueError: class_weight must be dict, 'auto', or None, got: 'balanced'
爲什麼我有它,如果在svm參數的說明中有'balanced'
,而不是'auto'
?