2

When I use the eli5 show prediction function I only see the feature weights and not the color highlighted example.

I have the following sklearn pipeline

pipeline = Pipeline([
('tfidf', TfidfVectorizer(analyzer='word', use_idf=True,  ngram_range=(1,3), sublinear_tf=True)),
('clf', LogisticRegression())
])

pipeline.fit(X_train, y_train)
predicted = pipeline.predict(X_test)

And I'm using eli5 as follows

eli5.show_prediction(pipeline[1], X[0], vec=pipeline[0])

But I only see the feature weights like this:

enter image description here

What I would like to see is the highlighted text like this:

enter image description here

How can I achieve this?

mjspier
  • 6,386
  • 5
  • 33
  • 43

1 Answers1

2

I just stumbled upon the same issue. The reason for it seems to be an incompatibility between sckit-learn > 0.21 and ELI5 0.10.1.

The quickfix I used is to downgrade sklearn to 0.21.3. The better solution would be to fix the bug and submit a PR to the eli5 repo.

For more information see https://github.com/TeamHG-Memex/eli5/issues/361

Ursin Brunner
  • 2,310
  • 1
  • 24
  • 24