richliao / textClassifier

Text classifier for Hierarchical Attention Networks for Document Classification
Apache License 2.0
1.07k stars 379 forks source link

Capturing attention weights and seeing which words contributed to the classification #36

Open arunarn2 opened 5 years ago

arunarn2 commented 5 years ago

I am not clear on how to actually see which words contributed to a particular classification. I have been able to get the weights from the sentence level attention layer but unclear on how to process this 3D matrix to get information on if the word contributed to the classification.

vr25 commented 5 years ago

I am not clear what the "sequences" is in the following code to find attention weights:

test_seq = pad_sequences([sequences[index]], maxlen=MAX_SEQUENCE_LENGTH)

Thank you!