How to optimise classification learner for a specific class
2 views (last 30 days)
Show older comments
Azura Hashim
on 26 Feb 2018
Answered: Bernhard Suhm
on 2 Apr 2018
Hi,
Is it possible in the classification learner app to prioritise the accuracy for a specific class? For example, if I have two possible reponses: True and False; I would like to maximise the prediction accuracy for the True response. I do not care about the False prediction. This objective simply becomes minimising false True.
Also, how does the machine learning toolbox treat NaNs in the predictor? I wasn't able to find documentation on this.
Thank you.
1 Comment
Ilya
on 28 Feb 2018
Re: This objective simply becomes minimising false True.
This cannot be possibly true. If your objective is really to minimize the number of false positives, classify all observations into the negative class. Then the number of positive classifications, including those that are false, will be zero.
Accepted Answer
Bernhard Suhm
on 2 Apr 2018
You can apply a cost matrix to force the classifier to make fewer mistakes on a subset of your classes, even if they aren't very frequent. So in a two class problem, you can prioritize the accuracy of the first class by using a matrix like C = [0,10;1,0] which penalizes misclassifications of the first class by a factor of 10, and then pass that cost matrix to the training routine using the 'Cost' parameter, like
C = [0,10;1,1];
model = fitc...(training_data,'class','Cost',C,...)
Right now, you can't do this from within the ClassificationLearner app, you have to step back to the programmatic workflow (but you can export code for the model you were exploring in the app with the "Export Model" button).
NaNs are ignored in the data by default.
0 Comments
More Answers (0)
See Also
Categories
Find more on Classification Learner App in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!