I implement the fastText for text classification, link https://github.com/facebookresearch/fastText/blob/master/tutorials/supervised-learning.md I was wondering what's the precision@1, or P@5 means? I did a binary classification, but I tested different number, I don't understand results:
haos-mbp:fastText hao$ ./fasttext test trainmodel.bin train.valid 2
N 312
P@2 0.5
R@2 1
Number of examples: 312
haos-mbp:fastText hao$ ./fasttext test trainmodel.bin train.valid 1
N 312
P@1 0.712
R@1 0.712
Number of examples: 312
haos-mbp:fastText hao$ ./fasttext test trainmodel.bin train.valid 3
N 312
P@3 0.333
R@3 1
Number of examples: 312
Precision is a ratio of number of correctly predicted labels over number of labels predicted by the model
Recall is a ratio of number of correctly predicted labels over number of actual labels from validation dataset.
For examples: Actual labels for a input in validation dataset:
A, B, C, F, G
Predicted labels for the input from the model:
A, B, C, D
Correctly predicted labels:
A, B, C
Precision:
3 / 4
=0.75
Recall:
3 / 5
=0.6