yangheng95 / PyABSA

Sentiment Analysis, Text Classification, Text Augmentation, Text Adversarial defense, etc.;
https://pyabsa.readthedocs.io
MIT License
949 stars 160 forks source link

Probabilities of all classes for the APC #200

Closed miguelwon closed 2 years ago

miguelwon commented 2 years ago

How can I get the softmax probabilities associated with each class for the sentiment classifier?

yangheng95 commented 2 years ago

Just insert this line

print({label:i_probs[self.opt.label_to_index[label]] for label in self.opt.label_to_index})

before https://github.com/yangheng95/PyABSA/blob/42aac7857fd6fb781184433f68063581ed1c3cc4/pyabsa/core/apc/prediction/sentiment_classifier.py#L239

yangheng95 commented 2 years ago
image