Closed mustfkeskin closed 3 years ago
Hi @mustfkeskin, the explainer takes in a fitted model and data that is compatible with that fitted model.
So you would have to fit the CountVectorizer to the training set, and transform both the train and test set. Then fit the MultinomialNB on the training set, and feed it to the explainer along with the test set. So something along the likes of:
cv = CountVectorizer().fit(X_train)
X_train = cv.transform(X_train)
X_test = cv.transform(X_test)
nb = MultinomialNB().fit(X_train, y_train)
explainer = ClassifierExplainer(nb, X_test, y_test)
ClassifierDashboard(explainer).run()
I got this error
AttributeError: columns not found
X_train contains text array
X_test should be a dataframe, but CountVectorizer
probably pops out a numpy array,
so then you should first wrap it in a dataframe:
explainer = ClassifierExplainer(nb, pd.DataFrame(X_test), y_test)
Countvector is a sparse matrix so i got this error
TypeError: unhashable type: 'csr_matrix'
ClassifierExplainer only explain pandas dataframe format?
This tool support image or nlp algorithm for explaianability?
try
explainer = ClassifierExplainer(nb, pd.DataFrame(X_test.to_array()), y_test)
In any case the tool is mostly meant for tabular data models...
Hello i want to explain multiclass text classification I use sklearn CountVectorizer and MultinomialNB
How i can do it