SAP-archive/contextual-ai

array index error in quickstart 1

nilaycicekli opened this issue · 1 comments

While printing the target label, it prints the label at the index 0.

raw_test.target[0]

But shouldn't it actually be raw_test.target[9] since our instance is at index 9 here:

# Generate explanations

exp = explainer.explain_instance(
    labels=[0, 1, 2], # which classes to produce explanations for?
    instance=raw_test.data[9],
    num_features=5 # how many words to show?
)

I run the code with index 0 first and my label was shown as

rec.sport.baseball => 0 , (which is wrong classification)

but the rest of the explanation, the words and confidence scores were the same as your tutorial result. Then I changed the index to 9, and it showed the right label:

soc.religion.christian => 2

Hi @nilaycicekli Thank you for pointing out the error. We will update the tutorial accordingly.