How to remove a specific class in the confusion matrix?

조회 수: 1 (최근 30일)
Mibang
Mibang 2024년 3월 26일
댓글: Voss 2024년 3월 28일
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,

채택된 답변

Voss
Voss 2024년 3월 26일
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
Mibang
Mibang 2024년 3월 28일
Great, thanks again!!
Voss
Voss 2024년 3월 28일
You're welcome!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

Community Treasure Hunt

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

Start Hunting!

Translated by