get prediction of all binary learners for multi-class classification
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Wenhao Dang
le 5 Fév 2021
Réponse apportée : Aditya Patil
le 16 Fév 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 commentaires
Réponse acceptée
Aditya Patil
le 16 Fév 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 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Classification Ensembles dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!