我使用SciKit作为库来处理分类算法,如:NB,SVM.
这是" SPAM和HAM " 电子邮件的一个非常好的和精细的二进制分类实现:
confusion += confusion_matrix(test_y, predictions)
score = f1_score(test_y, predictions, pos_label=SPAM)
//note in my case 3-classes I do not need to set [pos_label]
Run Code Online (Sandbox Code Playgroud)
如果我有三个类,如{SPAM,HAM,NORMAL}而不是两个,那么:我如何调整该代码以找到每个类的F1-Score以及所有类的平均值.