How do I make an average voting algorithm for a multiclass problem with 3 classes?
Show older comments
I am using the command line anfis to create 3 seperate binary classifiers that have overlapping data i.e. compare data1 to data2, data2 to data3 and data3 to data1. I want to combine the 3 prediction outputs into one output and combine the overlapping data into an averaged value. Example (predicted labels): a = [1 2 3 4 5.4 6] (6 x 1) b = [4 5.6 6.8 7 8 9] (6 x 1) c = [7 8 9 10 11 12.5] (6 x 1) combined, the X values would act as the unique Identifiers, it should be a vector equal to: combined = [1 2 3 4 6 6 7 8 9 10 11 12.5] (12 x 1) instead of a (18 x 1).
2 Comments
Dyuman Joshi
on 16 Apr 2022
How exactly is the averaged value calculated?
Comparing a and b, How does [4 5.4 6] and [4 5.6 6.8] become [5 6 6]?
David Smithson
on 16 Apr 2022
Answers (1)
a=[1 2 3 4 5.4 6];
b=[4 5.6 6.8 7 8 9];
c=[7 8 9 10 11 12.5];
af=floor(a);
bf=floor(b);
cf=floor(c);
%getting similar range
ab=intersect(af,bf);
bc=intersect(bf,cf);
setdiff(a,a(arrayfun(@(z) find(af==z), ab)))
0.5*(a(arrayfun(@(z) find(af==z), ab))+b(arrayfun(@(z) find(bf==z), ab)))
0.5*(b(arrayfun(@(z) find(bf==z), bc))+c(arrayfun(@(z) find(cf==z), bc)))
setdiff(c,c(arrayfun(@(z) find(cf==z), bc)))
Categories
Find more on Classification in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!