是否可以子图混淆矩阵?

Is it possible to subplot confusion matrices?

我正在使用 plot_confusion() 函数绘制几个混淆矩阵,我想将它们放在一个子图中(2x5 数字),但似乎 work.It 不会单独显示每个混淆矩阵。密谋混淆有什么限制吗?谢谢!

figure

Subplot(2,1,1);

plotconfusion(targets,outputs,'train');

subplot(2,1,2);

plotconfusion(targets1,outputs1,'test')

你 "not supposed" 可以做到这一点(功能不包括在内),但你可以稍微欺骗 Matlab,因为在一天结束时它只是一个轴 object:

%% First Example Data
[x,t] = cancer_dataset;
net = patternnet(10);
net = train(net,x,t);
y = net(x);

%// plot
plotconfusion(t,y)

%// get handle and enable second plöt
cp1 = gcf;
cp1.NextPlot = 'new'
ax1 = findobj(cp1,'Type','Axes')

%% Second Example Data
[x,t] = cancer_dataset;
net = patternnet(5);
net = train(net,2*x,t);
y = net(x);

%// plot
plotconfusion(t,y)

%// get handle and enable third plöt
cp2 = gcf;
cp2.NextPlot = 'new'
ax2 = findobj(cp2,'Type','Axes')

%% combine plots

f1 = figure(42)
f1s1 = subplot(121)
copyobj(allchild(ax1),f1s1)
f1s2 = subplot(122)
copyobj(allchild(ax2),f1s2)

您丢失了标签和标题,可能需要调整轴,但我想您可以做到。