confusion
分类混淆矩阵
说明
示例
使用 confusion
函数生成 simpleclass
数据集的混淆矩阵
此示例说明如何使用 confusion
函数生成 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
输入参数
targets
— 目标矩阵
矩阵
目标矩阵,指定为 S
×Q
矩阵,其中每个列向量包含一个 1
值,所有其他元素等于 0
。等于 1
的值的索引指示该向量表示具体哪一个 S
类别。
outputs
— 输出矩阵
矩阵
输出矩阵,指定为 S
×Q
矩阵,其中每列包含范围 [0,1]
内的值。列中最大元素的索引指示该向量表示具体哪一个 S
类别。
输出参量
c
— 混淆值
标量
误分类采样的比例,以标量形式返回。
cm
— 混淆矩阵
矩阵
混淆矩阵,以 S
×S
混淆矩阵形式返回,其中 cm(i,j)
是其目标为分类为 j
的第 i
个类的样本数。
ind
— 索引数组
元胞数组
索引数组,以 S
×S
元胞数组形式返回,其中 ind{i,j}
包含具有第 i
个目标类但具有第 j
个输出类的采样的索引。
per
— 百分比矩阵
矩阵
百分比矩阵,以 S
×4
矩阵形式返回,其中每行汇总与第 i
个类相关联的四个百分比:
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 中推出
另请参阅
MATLAB 命令
您点击的链接对应于以下 MATLAB 命令:
请在 MATLAB 命令行窗口中直接输入以执行命令。Web 浏览器不支持 MATLAB 命令。
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)