MATLAB Answers

0

How to optimise classification learner for a specific class

Asked by Azura Hashim on 26 Feb 2018
Latest activity Answered by 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

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.

Sign in to comment.

1 Answer

Answer by Bernhard Suhm on 2 Apr 2018
 Accepted Answer

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

Sign in to comment.