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.
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.
- Decision trees and random forests trained on the
Carseatsdataset. - Feature importance analyzed to understand the impact of predictors on sales.
- Model performance evaluated using test mean squared error (MSE).
- 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
- Clone or download this repository.
- Open
predicting_carseats_sales_trees.ipynbin Jupyter Notebook or Jupyter Lab. - Run all cells to reproduce results, figures, and exported HTML/PDF outputs.