Lab 12

We will be using this lab to explore decision trees and random forests using the palmerpenguins package. We will also use a couple of other packages such as rpart.plot, rpart, ranger, and vip.

  1. Fit a decision tree using decision_tree(), and visualize the structure of the tree.

  2. Try different values of the hyperparameters for the tree and see how the shape of the tree changes.

  3. Use the vip package to showcase the variable importance.

  4. Fit a random forest model using rand_forest(). What Do you see in the output?

  5. Use the vip package to showcase the variable importance for the random forest.