您如何计算多类别分类问题的正确率和错误率?说,
y_true = [1, -1, 0, 0, 1, -1, 1, 0, -1, 0, 1, -1, 1, 0, 0, -1, 0]
y_prediction = [-1, -1, 1, 0, 0, 0, 0, -1, 1, -1, 1, 1, 0, 0, 1, 1, -1]
Run Code Online (Sandbox Code Playgroud)
混淆矩阵由来计算metrics.confusion_matrix(y_true, y_prediction),但这只是解决了问题。
@seralouk的答案后编辑。在此,该类别-1应被视为否定词,而0和1是正值的变体。
python confusion-matrix scikit-learn multiclass-classification