# Is there a way to plot a confusion matrix of the cross validation results?

조회 수: 4 (최근 30일)
편집: ROHAN JAIN 2020년 6월 30일
Can somebody tell me how to plot a confusion matrix of the crossval result?
CVMdl = crossval(classifier,'HoldOut',0.08);
k=kfoldLoss(CVMdl,'lossFun','classiferror','mode','average')
L = resubLoss(classifier,'LossFun','classiferror')
Accuracy = 1 - k
##### 댓글 수: 2없음 표시없음 숨기기
ben dp 2017년 5월 10일
Did you find a solution? I'm in the same problem.
ROHAN JAIN 2020년 6월 30일
편집: ROHAN JAIN 2020년 6월 30일
Hi,
You can plot the confusion matrix easily by using the following function:
confusionchart(testlabels,labels_predicted)
where testlabels are the labels of the test set and labels_predicted refers to the labels that have been predicted by the LDA classifier using predict().
It automatically plots the confusion matrix. Further, you can also store it in a variable and access the values using the dot operator as mentioned below.
cvmat=confusionchart(testlabels,labels_predicted)
cval=cmat.NormalizedValues; % cval is the required matrix
Hope it helps!
Thanks

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

### 답변 (2개)

Santhana Raj 2017년 5월 11일
I am not aware of any method to plot confusion matrix. But usually I calculate the precision and recall from the true positives and true negatives. Some places I also use F-measure. Depending on your application, any of this might be a good measure to evaluate your classification algorithm.
Check wiki for the formulas for these.
##### 댓글 수: 0이전 댓글 -2개 표시이전 댓글 -2개 숨기기

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

Karina Nanuck-Robertson 2019년 4월 16일
Not sure if this helps

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

### 카테고리

Help CenterFile Exchange에서 Classification에 대해 자세히 알아보기

### Community Treasure Hunt

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

Start Hunting!

Translated by