我正在研究句子类别检测问题。其中每个句子可以属于多个类别,例如:"It has great sushi and even better service."
True Label: [[ 0. 0. 0. 0. 0. 1. 0. 0. 0. 0. 0. 1.]]
Pred Label: [[ 0. 0. 0. 0. 0. 1. 0. 0. 0. 0. 0. 1.]]
Correct Prediction!
Output: ['FOOD#QUALITY' 'SERVICE#GENERAL']
我实现了一个可以预测多个类别的分类器。我有587个句子,属于多个类别。我用两种方法计算了准确度得分:If all labels of an example predicted or not?
代码:
^{pr2}$
输出:
Total Examples: 587 True Pred: 353 False Pred: 234 Accuracy: 0.60136286201How many labels are correctly predicted for all examples?
代码:print "\n"
print "Total Labels:",len(total[0]),"Predicted Labels:", corrPred, "Accuracy:", corrPred/len(total[0])
输出:
Total Labels: 743 Predicted Labels: 522 Accuracy: 0.702557200538
问题:
这些都是通过将预测得分与基本真实性标签进行比较计算得出的准确度得分。但我想计算F1分数(使用微平均法)、精确度和召回率。我有基本事实的标签,我需要把我的预测与那些基本事实标签相匹配。但是,我不知道如何解决这种类型的多标签分类问题。
我可以使用scikitlearn或python中的任何其他库吗?在