Adding parameter and value pair in fitcdiscr for QDA classifier

2 次查看(过去 30 天)
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?

采纳的回答

Aditya Patil
Aditya Patil 2020-12-21
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.

更多回答(0 个)

标签

Community Treasure Hunt

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

Start Hunting!

Translated by