How to remove a specific class in the confusion matrix?

4 vues (au cours des 30 derniers jours)
Mibang
Mibang le 26 Mar 2024
Commenté : Voss le 28 Mar 2024
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,

Réponse acceptée

Voss
Voss le 26 Mar 2024
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 commentaires
Mibang
Mibang le 28 Mar 2024
Great, thanks again!!
Voss
Voss le 28 Mar 2024
You're welcome!

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur 2-D and 3-D Plots dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by