TeamHG-Memex / eli5

A library for debugging/inspecting machine learning classifiers and explaining their predictions
http://eli5.readthedocs.io
MIT License
2.75k stars 331 forks source link

show_weights() shows weights for only one class #350

Open rvoak opened 4 years ago

rvoak commented 4 years ago

I have trained a Logistic Regression classifier (from sklearn) for a binary classifier. However, when I use eli5 to examine my weights, I see the top coefs for only one class (y=1).

Here is my code:

from sklearn.linear_model import LogisticRegression
lr_0 = LogisticRegression(random_state = 42)
lr_0.fit(xtrain_tfidf_ngram,Ytr)

import eli5
eli5.show_weights(lr_0, vec=tfidf_vect_ngram, top=10,target_names=lr_0.classes_,) 

Can anyone help me? Why am I seeing only one class?

eloukas commented 4 years ago

Same here. Did you find any solution? @rvoak

eloukas commented 4 years ago

I guess this might be the normal usage, according to https://stackoverflow.com/questions/51659523/eli5-show-weights-with-two-labels.