Session Ready
Exercise

Restricted and unrestricted decision trees

For this exercise, we will revisit the Pokémon dataset from the last chapter. Recall that the goal is to predict whether or not a given Pokémon is legendary.

Here, you will build two separate decision tree classifiers. In the first, you will specify the parameters min_sample_leaf and min_sample_split, but not a maximum depth, so that the tree can fully develop without any restrictions.

In the second, you will specify some constraints by limiting the depth of the decision tree. By then comparing the two models, you'll better understand the notion of a "weak" learner.

Instructions 1/2
undefined XP
  • 1

    Build an unrestricted decision tree using the parameters min_samples_leaf=3, min_samples_split=9, and random_state=500.

    • 2

      Build a restricted tree by replacing min_samples_leaf and min_samples_split with max_depth=4 and max_features=2.