How to remove a specific class in the confusion matrix?

Hi,
I have a confusion matrix that can be generated by the code below with attached mat-file.
figure; cm = confusionchart([trueCellR{:}],[testCellR{:}],'RowSummary','row-normalized','ColumnSummary','column-normalized');
I want to remove the class of "n/a" in both confusion matrix and generated figure.
Besides, how can I change the order of the classes in the figure?
Thank you very much,

 Respuesta aceptada

load testCells
x = removecats([trueCellR{:}],'n/a');
y = removecats([testCellR{:}],'n/a');
x = reordercats(x,[3 2 1]);
figure; cm = confusionchart(x,y,'RowSummary','row-normalized','ColumnSummary','column-normalized');

6 comentarios

Mibang
Mibang el 27 de Mzo. de 2024
Verified, perfect! Thanks a lot, expert!
Voss
Voss el 27 de Mzo. de 2024
You're welcome!
Mibang
Mibang el 28 de Mzo. de 2024
Do you know how to change a class name, e.g., A to PAC? Thanks.
Mibang
Mibang el 28 de Mzo. de 2024
Great, thanks again!!
Voss
Voss el 28 de Mzo. de 2024
You're welcome!

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Deep Learning Toolbox en Centro de ayuda y File Exchange.

Preguntada:

el 26 de Mzo. de 2024

Comentada:

el 28 de Mzo. de 2024

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by