calculating accuracy and confusion matrix
11 ビュー (過去 30 日間)
古いコメントを表示
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 件のコメント
回答 (1 件)
Stephan
2018 年 6 月 20 日
編集済み: Stephan
2018 年 6 月 20 日
Hi,
to compute the confusion matrix use:
confusionmat
If you have a Neural Network Toolbox™ license, you can plot the confusion matrix using
plotconfusion
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
Best regards
Stephan
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Classification Learner App についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!