Clear Filters
Clear Filters

Adding parameter and value pair in fitcdiscr for QDA classifier

1 view (last 30 days)
MdlQuadratic = fitcdiscr(QDAinputtrain,QDAtargettrain,'DiscrimType','quadratic','KFold',kfold);
outputtest = predict(MdlQuadratic,QDAinputtest);
Hi guys, the above is the code that I modify in order to test the effect of KFold value on the classification performance of the QDA classifier.
Hoever, the below error pops out.
Error using predict (line 84)
No valid system or dataset was specified.
Could someone help me in this?

Accepted Answer

Aditya Patil
Aditya Patil on 21 Dec 2020
Passing KFold to any classification model creates a ClassificationPartitionedModel, which is a set of multiple models. As such, one cannot call predict on it. Instead, you can use kfoldPredict function, which gives you the classification accuracy on the training partition for each of the model. For example,
load fisheriris.mat
mdl = fitcdiscr(meas, species, 'DiscrimType', 'quadratic', 'KFold', 4);
kfoldPredict(mdl)
If you want to predict on test dataset, train a separate model with same parameters, except for KFold, and then use predict on the test dataset.
The error message is a known issue, and might be fixed in any of the upcoming releases.

More Answers (0)

Tags

Community Treasure Hunt

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

Start Hunting!