I found this problem just by accident(when I use K-fold to train huge data)
The problem that I have is similar with issue issue5150. However, when I get this warning "class label 0 specified in weight is not found", I can not even get the model(The kernel is linear).
The x, y and w can be copied from https://github.com/scikit-learn/scikit-learn/issues/9494
And here is my code and errors:
>>> clf = SVC(C=0.5,class_weight='balanced',kernel='linear')
>>> clf.fit(x, y, sample_weight=w)
warning: class label 0 specified in weight is not found
SVC(C=0.5, cache_size=200, class_weight='balanced', coef0=0.0,
decision_function_shape=None, degree=3, gamma='auto', kernel='linear',
max_iter=-1, probability=False, random_state=None, shrinking=True,
tol=0.001, verbose=False)
>>> clf.coef_
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/xxx/lib/python2.7/site-packages/sklearn/svm/base.py", line 488, in coef_
coef = self._get_coef()
File "/xxx/lib/python2.7/site-packages/sklearn/svm/base.py", line 707, in _get_coef
if sp.issparse(coef[0]):
IndexError: list index out of range