MATLAB Answers

Anyone help me please, How to use Classification Learner App to calculate accuracy rates on training set, and on test set??

9 views (last 30 days)
I am using classification Learner App on my dataset. My dataset has two sets, Training set and Test set these sets are separate files, I have trained the training dataset using Classification learner and exported the model, now I am not getting how to evaluate this trained model on the test set, to check the accuracy on the test set too. Please help.

  0 Comments

Sign in to comment.

Accepted Answer

Von Duesenberg
Von Duesenberg on 14 Jun 2018
It's all explained here: https://fr.mathworks.com/help/stats/export-classification-model-for-use-with-new-data.html Basically, if your trained model is called trainedModel, then use the predictFcn property on new data, eg.:
Y = trainedModel.predictFcn(newData)

  3 Comments

saeeda saher
saeeda saher on 14 Jun 2018
I tried this but did not get the confusion matrix and accuracy percentage the result is like following yfit = trainedModel.predictFcn(test)
yfit =
21×1 categorical array
Surprise
Neutral
Sad
Disgust
Disgust
Disgust
Disgust
Disgust
Surprise
Sad
Fear
Sad
Angry
Happy
Angry
Disgust
Disgust
Neutral
Surprise
Fear
Surprise
Von Duesenberg
Von Duesenberg on 14 Jun 2018
These are the predicted labels, you want now to use confusionmat or plotconfusion with true labels and predicted labels as arguments.
kanuparthi bhagyasree
kanuparthi bhagyasree on 27 Apr 2019
Dear Saeeda saher,
I am also facing the same issue, I got the predicted labels but now I wanted to find the accuracy and confusion matrix for the test data.
How to do that?
Please help me.

Sign in to comment.

More Answers (0)