Skip to content

Modeling and predicting carseats sales using decision trees and random forests, with feature importance analysis, test performance evaluation, and reproducible visualizations. This project was done in Python.

License

Notifications You must be signed in to change notification settings

alan-c-lin/predicting_carseats_sales_trees

Repository files navigation

Predicting Carseats Sales with Decision Trees and Random Forests

This project explores the Carseats dataset from the ISLP package to model and predict sales using decision trees and random forests. The goal is to illustrate model fitting, feature importance analysis, and performance evaluation, with reproducible results and visualizations. All data is either provided via the ISLP package; no external datasets are required.

Project Structure

  • predicting_carseats_sales_trees.ipynb — Main Jupyter notebook containing code and explanations.
  • predicting_carseats_sales_trees.html — Exported HTML version of the notebook.
  • predicting_carseats_sales_trees.pdf — Exported PDF version of the notebook.
  • figures/ — Exported plots mainly for reference; all key figures are already embedded in the outputs.

Key Points

  • Decision trees and random forests trained on the Carseats dataset.
  • Feature importance analyzed to understand the impact of predictors on sales.
  • Model performance evaluated using test mean squared error (MSE).

Requirements

  • Python (3.10.16 recommended)
  • Jupyter Notebook / Jupyter Lab
  • Python packages: numpy, pandas, matplotlib, scikit-learn, ISLP

You can install the required packages using:

pip install numpy pandas matplotlib scikit-learn ISLP

How to Use

  1. Clone or download this repository.
  2. Open predicting_carseats_sales_trees.ipynb in Jupyter Notebook or Jupyter Lab.
  3. Run all cells to reproduce results, figures, and exported HTML/PDF outputs.

About

Modeling and predicting carseats sales using decision trees and random forests, with feature importance analysis, test performance evaluation, and reproducible visualizations. This project was done in Python.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published