Hard, Soft and Weighted Voting

easy
Unit 7 · Interpretability I0/5 to milestone

Combine several classifiers' predictions:

  • hard_vote(preds): preds is a list of label arrays, one per model. Each sample gets the most common label (ties: the smallest label).
  • soft_vote(probas, weights=None): probas is a list of (n, classes) probability arrays. Average them (weighted if weights is given) and take the argmax.
  • agreement(preds): the fraction of samples where every model agrees, a quick diversity check (ensembles help most when models disagree)
#ensembles#classification2 visible + 1 hidden tests
solution.py · Python 3.13
Loading editor…
Run your code to see results. ⌘↵ to run · ⌘⇧↵ to submit
Hard, Soft and Weighted Voting · TechGradify