How to find the classification Accuracy

20 views (last 30 days)
Noufal
Noufal on 22 Sep 2019
Commented: Athul Prakash on 25 Sep 2019
Hello everyone.
I was working in below docuemntation, and I did run the code
But I couldn't know where the accuracy exactly ? I need it in percentage.
Also how could I find where is the model accuracy for the training and the accuracy for the testing.
Would you please help.
Thank you
  1 Comment
Athul Prakash
Athul Prakash on 25 Sep 2019
check the documentation for fitcsvm and you'll find your answers.
Especially refer to the section: Input Arguments > Hyperparameter Optimization Options
Not sure which parameter exactly you wanted, but I think I found a way by loggin Misclassification rates. Method is outlined in my answer below.

Sign in to comment.

Answers (1)

Athul Prakash
Athul Prakash on 25 Sep 2019
Hi Noufal,
Here's how to log and MisclassificationRate and calculate Accuracy from there:
Where is the Misclassification Rate:
The 'objective Function' during minimization is actually the misclassification rate of the svm. These values are displayed in the output text, for each iteration separately.
To log those values:
By setting 'SaveIntermediateResults' property of 'opts' (HyperparameterOptimizationOptions) to true, fitcsvm will log information after every iteration - into a 'BayesianOptimization' object named 'BayesoptResults'.
After the process completes, examine the 'ObjectiveTrace' property of that object to view the record of objective function values for each iteration (these are the misclassification rates of the 30 different SVMs)
Percentage Accuracy
PercAcc = 100*(1-MisClassRate)
(I highly recommend going through the doc for Bayesian Optimization object - https://www.mathworks.com/help/stats/bayesianoptimization.html)
(Also check the 'Hyperparameter Optimization Options' section of the doc for fitcsvm function - https://www.mathworks.com/help/stats/fitcsvm.html)
Hope it Helps!

Community Treasure Hunt

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

Start Hunting!