Open oterrier opened 3 years ago
Hi Thx for this great package It looks like there is an error when you use OneVsRestClassifier with SVCClassifier
I have this error
if clf.kernel != 'linear': AttributeError: 'OneVsRestClassifier' object has no attribute 'kernel'
Here is the little code snippet to reproduce the issue:
from sklearn.datasets import make_multilabel_classification, fetch_20newsgroups from sklearn.feature_extraction.text import TfidfVectorizer from sklearn.multiclass import OneVsRestClassifier from sklearn.svm import SVC data_train = fetch_20newsgroups(subset='train', shuffle=True, random_state=42) vectorizer = TfidfVectorizer(stop_words='english') X_train = vectorizer.fit_transform(data_train.data[0:100]) y_train = data_train.target[0:100] classif = OneVsRestClassifier(SVC(kernel='linear')) classif.fit(X_train, y_train) expl = eli5.explain_prediction(classif, data_train.data[0], vec=vectorizer)
Thx a lot again
Olivier
Hi If you change SVC by LinearSVC in the previous code snippet, it works ... Any reason SVC is not supported the same way?
Best regards Olivier
Hi Thx for this great package It looks like there is an error when you use OneVsRestClassifier with SVCClassifier
I have this error
Here is the little code snippet to reproduce the issue:
Thx a lot again
Olivier