How do I make an average voting algorithm for a multiclass problem with 3 classes?

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 Commenti

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]?
My mistake, the 4 and 4 would average to 4, the 5.4 and 5.6 would average to 5.5 which would round to 6 and finally 6 and 6.8 would average to 6.4 which would round to 6.

Accedi per commentare.

Risposte (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)))
ans = 1×3
1 2 3
0.5*(a(arrayfun(@(z) find(af==z), ab))+b(arrayfun(@(z) find(bf==z), ab)))
ans = 1×3
4.0000 5.5000 6.4000
0.5*(b(arrayfun(@(z) find(bf==z), bc))+c(arrayfun(@(z) find(cf==z), bc)))
ans = 1×3
7 8 9
setdiff(c,c(arrayfun(@(z) find(cf==z), bc)))
ans = 1×3
10.0000 11.0000 12.5000

Prodotti

Release

R2022a

Richiesto:

il 16 Apr 2022

Risposto:

il 17 Apr 2022

Community Treasure Hunt

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

Start Hunting!

Translated by