Ниже мой код:
tuned_parameters = [
{'kernel': ['linear], 'C':[1, 10], 'class_weight': ['auto']}, {'kernel': ['rbf'], 'C':[1,10], 'class_weight':['auto']}]
clf = GridSearchCV(svm.SVC(), tuned_parameters, cv=5, scoring='accuracy')
clf.fit(x_train,y_train)
Но я получаю следующую ошибку:
Traceback (most recent call last):
File "/home/arajabi/PycharmProjects/Muffin/classification.py", line 77, in <module>
clf3.fit(x_train, y_train)
File "/home/arajabi/anaconda3/lib/python3.5/site-packages/sklearn/model_selection/_search.py", line 639, in fit
cv.split(X, y, groups)))
File "/home/arajabi/anaconda3/lib/python3.5/site-packages/sklearn/externals/joblib/parallel.py", line 779, in __call__
while self.dispatch_one_batch(iterator):
File "/home/arajabi/anaconda3/lib/python3.5/site-packages/sklearn/externals/joblib/parallel.py", line 625, in dispatch_one_batch
self._dispatch(tasks)
File "/home/arajabi/anaconda3/lib/python3.5/site-packages/sklearn/externals/joblib/parallel.py", line 588, in _dispatch
job = self._backend.apply_async(batch, callback=cb)
File "/home/arajabi/anaconda3/lib/python3.5/site-packages/sklearn/externals/joblib/_parallel_backends.py", line 111, in apply_async
result = ImmediateResult(func)
File "/home/arajabi/anaconda3/lib/python3.5/site-packages/sklearn/externals/joblib/_parallel_backends.py", line 332, in __init__
self.results = batch()
File "/home/arajabi/anaconda3/lib/python3.5/site-packages/sklearn/externals/joblib/parallel.py", line 131, in __call__
return [func(*args, **kwargs) for func, args, kwargs in self.items]
File "/home/arajabi/anaconda3/lib/python3.5/site-packages/sklearn/externals/joblib/parallel.py", line 131, in <listcomp>
return [func(*args, **kwargs) for func, args, kwargs in self.items]
File "/home/arajabi/anaconda3/lib/python3.5/site-packages/sklearn/model_selection/_validation.py", line 458, in _fit_and_score
estimator.fit(X_train, y_train, **fit_params)
File "/home/arajabi/anaconda3/lib/python3.5/site-packages/sklearn/svm/base.py", line 150, in fit
y = self._validate_targets(y)
File "/home/arajabi/anaconda3/lib/python3.5/site-packages/sklearn/svm/base.py", line 502, in _validate_targets
self.class_weight_ = compute_class_weight(self.class_weight, cls, y_)
File "/home/arajabi/anaconda3/lib/python3.5/site-packages/sklearn/utils/class_weight.py", line 62, in compute_class_weight
" got: %r" % class_weight)
ValueError: class_weight must be dict, 'balanced', or None, got: 'auto'
Я относительно новичок в Python.Может кто-нибудь дать мне простое решение этой проблемы?