1. Learn
  2. /
  3. Courses
  4. /
  5. Ensemble Methods in Python

Connected

Exercise

Soft vs. hard voting

You've now practiced building two types of ensemble methods: Voting and Averaging (soft voting). Which one is better? It's best to try both of them and then compare their performance. Let's try this now using the Game of Thrones dataset.

Three individual classifiers have been instantiated for you:

  • A DecisionTreeClassifier (clf_dt).
  • A LogisticRegression (clf_lr).
  • A KNeighborsClassifier (clf_knn).

Your task is to try both voting and averaging to determine which is better.

Instructions

100 XP
  • Prepare the list of (string, estimator) tuples. Use 'dt' as the label for clf_dt, 'lr' for clf_lr, and 'knn' for clf_knn.
  • Build a voting classifier called clf_vote.
  • Build an averaging classifier called clf_avg.