# Difference between Weighted and Majority Vote

What differentiates WeightedVote and Majority vote both output under the perf function

I’m going to assume you are referring to when using the `perf()` function in a DIABLO (multiblock sPLS-DA) framework. Looking at the documentation (which is accessed via `?predict` as this function is used within `perf()`):

For discriminant analysis, the predicted class is returned for each block (class) and each distance
(dist) and these predictions are combined by majority vote (MajorityVote) or weighted majority
vote (WeightedVote), using the weights of the blocks that are calculated as the correlation between
a block’s components and the outcome’s components.

In other words, for each test sample a prediction is made - one for each block in the DIABLO object. `MajorityVote` simply takes which ever class has the most votes, and outputs that as the predicted class of that sample. Here’s an example to help explain. For three blocks and a binary classification problem (ie classes = `0` or ‘1’), if the votes for a specific sample were: `0, 0, 1`, then the `MajorityVote` value for this sample would be `0`.

It is a little more complicated with `WeightedVote`. The model yields a series of ‘components’ for all the input blocks as well as the response. The correlation between all the components in a given block and all the response components are averaged and this is the ‘weight’ assigned to the given block. Using that same example from above, lets include the weights of each block, say: `0.3, 0.2, 0.7`. The total vote for the `0` class would be 0.5 (= 0.3 + 0.2) and the total vote for the `1` class would be 0.7 - hence the `WeightedVote` for this sample would be `1`.

Hope this clarified the difference, feel free to ask anymore questions.

Cheers,
Max.

1 Like