MATLAB Answers

Display bug with confusionchart for percentages summary

13 views (last 30 days)
The "confusionchart" function seems to have a bug with the display of the summary percentage that is never displayed, as in this image.
Curiously, with another code that uses the same data, the summary did not work at first, but after a while, it suddenly started to show the percentages when I ran the code.
I have tried different ways to display this (based on the Matlab documentation) and even after closing Matlab and relaunching the code, it does not change the result of the display which continues to display the summary without the percentages.
Test #1: (I also tried with only the ColumnSummary or the RowSummary, but the percentages are not displayed)
fig = figure();
[cm] = confusionchart(imdsValidation.Labels, YPred);
cm.ColumnSummary = 'column-normalized';
cm.RowSummary = 'row-normalized';
% Resize the container of the confusion chart so percentages appear in the row summary
fig_Position = fig.Position;
fig_Position(3) = fig_Position(3)*1.5; %Only change the width of the figure.
fig.Position = fig_Position;
Test #2:
fig = figure();
[cm] = confusionchart(imdsValidation.Labels, YPred,'RowSummary','row-normalized','ColumnSummary','column-normalized');
% Resize the container of the confusion chart so percentages appear in the row summary
fig_Position = fig.Position;
fig_Position(3) = fig_Position(3)*1.5; %Only change the width of the figure.
fig.Position = fig_Position;
It seems that the summary view only works sometimes. This method also works, but the display is smaller and so the numbers are very difficult to read in this case with 40 classes.
plotconfusion(imdsValidation.Labels,YPred);
I do not know if there is a solution to fix this bug, but if there is one, I would like to know. It is possible that it is due to the fact that I am on Linux Ubuntu 18.04 LTS.

  0 Comments

Sign in to comment.

Accepted Answer

Bernhard Suhm
Bernhard Suhm on 11 Oct 2018
Many machine learning related charts will start to show some weird behavior if you try to visualize a lot of classes. If you are current on support, why don't you file a case with our tech support?

  1 Comment

Vincent Rougeau-Moss
Vincent Rougeau-Moss on 11 Oct 2018
I am on the current support, so I will create a case for the technical support. I thought maybe I was doing something wrong with the call of the function and that was the cause of this problem.

Sign in to comment.

More Answers (0)

Sign in to answer this question.