get prediction of all binary learners for multi-class classification
2 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Wenhao Dang
il 5 Feb 2021
Risposto: Aditya Patil
il 16 Feb 2021
When I use fitcecoc to perform multi-category classification, kfordpredict function only give me the Yhat after error correcting(pool results from all binary learners), how can I see raw results for all binary learners within the model?
0 Commenti
Risposta accettata
Aditya Patil
il 16 Feb 2021
You can get the underlying compact models using the Trained Property. You can call the predict function on these models.
You can also get the binary learners from the compact models, as shown in the Inspect Binary Learner Properties of ECOC Classifier example. You will have to reimplement the Error-Correcting Output Codes Model if you want to aggregate the results. If not, you can pass the input data to the binary classifiers, and get the required result.
Here is an basic code example
load fisheriris
X = meas(:,3:4);
Y = species;
CVMdl = fitcecoc(X,Y, 'CrossVal',"on");
cvsize = size(CVMdl.Trained, 1);
for i = 1:cvsize
trainedMdl = CVMdl.Trained{i};
blsize = size(trainedMdl.BinaryLearners, 1);
for j = 1:blsize
blmdl = trainedMdl.BinaryLearners{j};
yhat = predict(blmdl, X);
% postprocess the yhat as required
end
end
Note that crossvalidated models are intended to be used for validating the accuracy of the model, and not for prediction in general.
0 Commenti
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Classification Ensembles in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!