calculating accuracy and confusion matrix

조회 수: 5 (최근 30일)
saeeda saher
saeeda saher 2018년 6월 20일
댓글: Mohd Syamizal Mohd Isa 2020년 7월 9일
I have used Classification Learner app for classifying 7 classes(happy, sad, angry, disgust, neutral, fear, surprise) I trained the model using SVM on the training set. Then used the trained model on the test set, it provided me labels as result, I want to calculate the accuracy rate and confusion matrix for the test set. Please help me to code it. I am new to MATLAB, and don't know how to code it.
  댓글 수: 1
Mohd Syamizal Mohd Isa
Mohd Syamizal Mohd Isa 2020년 7월 9일
i have the problem like you, do you have the solution???

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

답변 (1개)

Stephan
Stephan 2018년 6월 20일
편집: Stephan 2018년 6월 20일
Hi,
to compute the confusion matrix use:
confusionmat
command. Some examples are given in the confusionmat documentation.
If you have a Neural Network Toolbox™ license, you can plot the confusion matrix using
plotconfusion
which is described here.
For calculation of the accuracy you could calculate the error from your crossvalidated model using
crossval
command at first and then calculate the error in form using the
kfoldloss
command. This gives you the error from your test set for your model which should mean:
accuracy = 1 - kfoldloss
These steps are shown with examples here.
Best regards
Stephan

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by