MATLAB 帮助中心
分类混淆矩阵
[c,cm,ind,per] = confusion(targets,outputs)
提示
要绘制深度学习工作流的混淆图,请使用 confusionchart 函数。
confusionchart
[c,cm,ind,per] = confusion(targets,outputs) 接受目标和输出矩阵 targets 和 outputs,并返回混淆值 c、混淆矩阵 cm、元胞数组 ind(其中包含分类为类 i 的类 j 目标的样本索引)以及百分比矩阵 per(其中每行汇总四个与第 i 个类相关联的百分比)。
c
cm
ind
per
targets
outputs
i
j
示例
全部折叠
confusion
simpleclass
此示例说明如何使用 confusion 函数生成 simpleclass_dataset 数据集的混淆矩阵。
simpleclass_dataset
加载 simpleclass_dataset 数据集。定义网络,然后训练它。
[x,t] = simpleclass_dataset; net = patternnet(10); net = train(net,x,t); y = net(x); [c,cm,ind,per] = confusion(t,y)
a3 = 1 2 3 1 2 3 4 5 6 4 5 6 7 7 7 8 8 8 9 9 9 10 10 10
目标矩阵,指定为 S×Q 矩阵,其中每个列向量包含一个 1 值,所有其他元素等于 0。等于 1 的值的索引指示该向量表示具体哪一个 S 类别。
S
Q
1
0
输出矩阵,指定为 S×Q 矩阵,其中每列包含范围 [0,1] 内的值。列中最大元素的索引指示该向量表示具体哪一个 S 类别。
[0,1]
误分类采样的比例,以标量形式返回。
混淆矩阵,以 S×S 混淆矩阵形式返回,其中 cm(i,j) 是其目标为分类为 j 的第 i 个类的样本数。
cm(i,j)
索引数组,以 S×S 元胞数组形式返回,其中 ind{i,j} 包含具有第 i 个目标类但具有第 j 个输出类的采样的索引。
ind{i,j}
百分比矩阵,以 S×4 矩阵形式返回,其中每行汇总与第 i 个类相关联的四个百分比:
4
per(i,1) false negative rate = (false negatives)/(all output negatives) per(i,2) false positive rate = (false positives)/(all output positives) per(i,3) true positive rate = (true positives)/(all output positives) per(i,4) true negative rate = (true negatives)/(all output negatives)
在 R2006a 中推出
plotconfusion | roc
plotconfusion
roc
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
选择网站
选择网站以获取翻译的可用内容,以及查看当地活动和优惠。根据您的位置,我们建议您选择:。
您也可以从以下列表中选择网站:
如何获得最佳网站性能
选择中国网站(中文或英文)以获得最佳网站性能。其他 MathWorks 国家/地区网站并未针对您所在位置的访问进行优化。
美洲
欧洲
亚太
联系您当地的办事处