在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
clear; CM = load('confusionMatrix_5Exp.mat'); fieldNames = fieldnames(CM); fieldNames = fieldNames'; varNames = {'CM', 'Sen', 'Spc', 'Prc', 'F1', 'Acc'}; varTypes = {'cell', 'double', 'double', 'double', 'double', 'double'}; CMCell = cell(numel(fieldNames),1); CMTable = table('Size', [numel(fieldNames) numel(varNames)], 'VariableTypes', varTypes, 'VariableNames', varNames, 'RowNames', fieldNames); for iField = 1:numel(fieldNames) curCM = getfield(CM, fieldNames{iField}); resultCM = genRes(curCM); CMCell{iField} = curCM; CMTable(iField, :) = {{curCM}, resultCM.Sensitivity, resultCM.Specificity, resultCM.Precision, resultCM.F1, resultCM.Accuracy}; end %% Support Functions function resultCM = genRes(CM) resultCM.Sensitivity = CM(1,1)/(CM(1,1) + CM(2,1)); resultCM.Specificity = CM(2,2)/(CM(2,2) + CM(1,2)); resultCM.Precision = CM(1,1)/(CM(1,1) + CM(1,2)); resultCM.F1 = 2*((resultCM.Precision*resultCM.Specificity)/(resultCM.Precision+resultCM.Specificity)); resultCM.Accuracy = (CM(1,1)+CM(2,2))/sum(CM, 'all')*100; end |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论