For a few days I was wondering on how to efficiently implement weighted majority voting of m experts in matlab. Here is an example of what I want. Suppose we have 3 experts with weights vector
w=[7 2 6]
Suppose they are voting n times on the options A/B/C/D, so we for example get the following n x m voting matrix, where the columns are votes of each expert.
A B B
C A A
D B A
A A C
Now I'd like to find weighted majority vote for each row. We calculate it by adding the weights of experts which voted for each option, and selecting the maximal weight. For example, in the first row, the option A has cumulative weight of 7 (vote of expert 1) and B has cumulative weight of 8 (votes of expert 2 and 3), and hence the final vote is B. So we get the following cumulative weights matrix and final votes:
A B C D
- - - -
7 8 0 0 -> B
8 0 7 0 -> A
6 2 0 7 -> D
9 0 6 0 -> A
Now, the implementation of this using for loops over number of rows n is more or less straightforward. I am now looking for solution, which doesn't require this potentially lengthy loop and instead uses vector arithmetic. I have had a few ideas, but ran into some problems with each of them, so will not mention them now. If anyone have had similar situation before, please share your solutions.
Thanks.
result: