#!/usr/bin/env python
# -*- coding: UTF-8 -*-
import scipy.io as sio
import numpy as np
feat = sio.loadmat("/run/media/zlf/WMU1/Examples/PathologicalSection/WangYu/four_class/CrossValidation1/WithoutAugment/SVM/feat.mat")
print( feat.keys() )
feat = feat['feat'];
a = feat.shape
print( a )
num_c0_c0 = 0;
num_c0_c1 = 0;
num_c0_c2 = 0;
num_c1_c0 = 0;
num_c1_c1 = 0;
num_c1_c2 = 0;
num_c2_c0 = 0;
num_c2_c1 = 0;
num_c2_c2 = 0;
predict = feat[:, 0:3];
print(predict)
tmp = 0
for i in range(a[0]):
print(feat[i,3])
if feat[i,3] == 0:
if feat[i,0] == max(predict[i][:]):
num_c0_c0 = num_c0_c0 + 1;
elif feat[i,1] == max(predict[i][:]):
num_c0_c1 = num_c0_c1 + 1;
else:
num_c0_c2 = num_c0_c2 + 1
if feat[i,3] == 1:
print('B')
if feat[i,0] == max(predict[i][:]):
num_c1_c0 = num_c1_c0 + 1;
elif feat[i,1] == max(predict[i][:]):
num_c1_c1 = num_c1_c1 + 1;
else:
num_c1_c2 = num_c1_c2 + 1
if feat[i,3] == 2:
print(feat[i,3])
if feat[i][0] == max(predict[i][:]):
num_c2_c0 = num_c2_c0 + 1;
elif feat[i,1] == max(predict[i][:]):
num_c2_c1 = num_c2_c1 + 1;
else:
num_c2_c2 = num_c2_c2 + 1
print( "num_c0_c0", str(num_c0_c0) )
print( "num_c0_c1", str(num_c0_c1) )
print( "num_c0_c2", str(num_c0_c2) )
print( "num_c1_c0", str(num_c1_c0) )
print( "num_c1_c1", str(num_c1_c1) )
print( "num_c1_c2", str(num_c1_c2) )
print( "num_c2_c0", str(num_c2_c0) )
print( "num_c2_c1", str(num_c2_c1) )
print( "num_c2_c2", str(num_c2_c2) )
混淆矩阵
最新推荐文章于 2023-08-04 10:46:16 发布