其中,TP表示正类数预测为正类数的个数;FP为负类数预测为正类数的个数;FN为正类数预测为负类数的个数;TN为负类数预测为负类数的个数。
附上python代码:
# coding=utf-8
import matplotlib.pyplot as plt
import numpy as np
confusion = np.array(([190,0,0,0,0,0,0,0,0,0,10,0,0,0,0],
[0,200,0,0,0,0,0,0,0,0,0,0,0,0,0],
[0,0,200,0,0,0,0,0,0,0,0,0,0,0,0],
[0,0,0,199,0,0,0,1,0,0,0,0,0,0,0],
[0,0,0,0,200,0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,200,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,200,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,200,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,200,0,0,0,0,0,0],
[0,0,0,0,0,0,0,1,0,199,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,0,200,0,0,0,0],
[0,1,0,0,0,0,0,0,0,0,0,199,0,0,0],
[0,0,0,0,0,2,0,0,0,0,0,0,197,0,1],
[0,0,0,0,0,0,0,0,0,0,0,0,0,200,0],
[0,0,0,0,0,0,0,0,0,0,0,0,0,0,200]
))
classes=['1','2','3','4','5','6','7