In a plain majority vote every classifier counts equally. A weighted vote lets stronger classifiers count more, for example by giving each one a weight based on its validation accuracy.
Implement weighted_majority_vote(predictions, weights).
predictions has shape (m, n): m classifiers voting on n samples, with integer labels 0, 1, 2, ….weights has length m and must be nonnegative.Return an integer array of length n.
ValueError.ValueError.len(weights) must equal the number of rows in predictions, otherwise raise ValueError.Build a (n, classes) score matrix and add each weight into the column of the label it votes for.
No results yet
Run your code to check it against the examples, or submit to run every test.