Decision Trees


Work with your assigned partner to write a series of Python scripts to fit classification and regression trees.


Synthetic Data

Fit classification trees to the following data and answer the following questions.

  1. Fit a classification tree to this data set. Try different maximum depths for the tree.
  2. Measure the F1 score of the model.
  3. Make a figure of the structure of the tree.
  4. Fit a second classification tree to the same data set with noisy columns added.
  5. Make a figure of the structure of the second tree.
  6. How do the structure of trees compare?
  7. How many features were used in the second tree?
  8. How was F1 impacted?
  9. How does the F1 compare to K-Nearest Neighbors, Logistic Regression, and MLP?



Car Quality

Fit a classification tree to this used car quality data.


Make sure to do the following:

How do decision trees compare to logistic regression, NB, KNN, and MLP?



Rentals

Fit a regression tree to this rental data. Make sure to remove price_display from the features since it contains the answer! You will need to do some feature engineering, cross validation, and model selection. What is the MAE and MAPE? Make of a figure of the tree. Which features did the tree use?


This page was last modified on 2026-08-19 at 20:15:10.

Copyright © 2018–2026 George Fox University. All rights reserved.