MATLAB Answers

DeltaPredictor property in Classifica​tionPartit​ionedModel

5 views (last 30 days)
Daniel Strahnen
Daniel Strahnen on 27 May 2020
Answered: Jemima Pulipati on 8 Jul 2020
Hello everyone,
I would like to obtain the DeltaPredictor property like after running obj = fitcdiscr(X,Y); obj.DeltaPredictor for a cross-validated model.
However, the DeltaPredictor property is not available.
Is there nevertheless a way to get this information?
Thank you very much and best regards
Daniel

  0 Comments

Sign in to comment.

Answers (1)

Jemima Pulipati
Jemima Pulipati on 8 Jul 2020
From my understanding you are trying to retrieve the DeltaPredictor property from “fitcdisr(X,Y)”.
The fitcdisr()returns a ‘ClassificationDiscriminant’ object. The DeltaPredictor property of the object is a measure of how "useful" a predictor is for classification.
Usually, the 'Delta' property is set to provide a threshold for which predictors to use (any 'DeltaPredictor' value below 'Delta' will cause the associated predictor to not be used). To choose this threshold value, the cvshrink function can be useful.
DeltaPredictor Property would be available for a ClassificationDiscriminant object created from fitcdisr() with appropriate delta and gamma values provided as input to the function.
An extension to an example provided in the cvshrink documentation is given below to explain the above point:
  • Create a linear discriminant analysis classifier for the ovariancancer data. Find vector of cross-validated classification error values and nonzero predictors for the given values of Gamma and Delta
load ovariancancer
obj = fitcdiscr(obs,grp);
rng('default') % for reproducibility
[err,gamma,delta,numpred] = cvshrink(obj,'NumGamma',6,'NumDelta',9);
  • Find the delta threshold associated with the minimum cross-validation error
[errMinCols,rMins] = min(err);
[~,cMin] = min(errMinCols);
rMin = rMins(cMin);
deltaVal = delta(rMin,cMin)
deltaVal =
0.0758
  • Find the associated gamma value
gammaVal = gamma(rMin)
gammaVal =
0.7480
  • You can recreate the "ClassificationDiscriminant" object with the appropriate delta and gamma values from above
obj2 = fitcdiscr(obs,grp,'Gamma',gammaVal,'Delta',deltaVal);
  • At this point DeltaPredictor property would be available to check which predictors are used to result in that low error value
whichPredictors = obj2.DeltaPredictor > deltaVal;

  0 Comments

Sign in to comment.


Translated by