kashf34Kashf
kashf34Kashf

Reputation: 63

Evaluate per class precision and recall in FastText

I am using Facebook Research FastText library for text classification following this tutorial. I have 2 labels for which i am performing the classification (2-class). The output of the prediction on test file shows the precision and recall for the same. How can i calculate per-class precision and recall for my test file?

Upvotes: 2

Views: 1771

Answers (1)

sail0r
sail0r

Reputation: 451

I had to deal with this recently myself. This issue in Github describes the issue, and presents a solution.

In summary, you need to do this as a post processing step. The code linked to above does a comparison of your actual labels vs the predicted ones and computes a confusion matrix which accurately reflects the classifier's performance for binary classification. This code computes the confusion matrix and accuracy only. If you wanted to also add in the precision and recall you could similarly use the scikitlearn API such as sklearn.metrics.precision_recall_fscore_support

Upvotes: 1

Related Questions