Combining N pattern classifiers using weighted majority voting in Matlab

2 views (last 30 days)
I want to combine some classifiers. The number of classifiers is 4 and there are 3 possible classes. I came a cross this code: "Efficient multiclass weighted majority voting implementation in MATLAB". It makes use of 3 classifiers and 3 possible classes. I have tried to customize it for use with 4 classifiers and 3 possible classes without success. How can this code be extended for use in my case, or to N classifiers. Or is there any other code applicable to my case. Please help.

Answers (1)

kh rezaee
kh rezaee on 29 Jan 2020
Edited: kh rezaee on 29 Jan 2020
I think that your problem is near this code:
voteWeightsSUM = sum(voteWeights);
W = voteWeights/(voteWeightsSUM);
outPut = (testPredictions(:,1)*W(1)+testPredictions(:,2)*W(2)+testPredictions(:,3)*W(3)+testPredictions(:,4)*W(4));
VotingConfusionMatrix = confusionmat(TestLabel,outPut);
softVotingAccuracy = sum(diag(VotingConfusionMatrix))/sum(VotingConfusionMatrix(:));
Where, voteWeights and testPredictions are accuracy and predicted test labels of each classifier, respectively. Also, voteWeights comes from the training phase, but testPredictions is calculated based on trained models.

Tags

No tags entered yet.

Community Treasure Hunt

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

Start Hunting!