For each chapter of An Introduction to Statistical Learning (James et al., 2021 and 2023): the lab in R (chNN_lab.R) and in Python (chNN_lab.py), written for this course, and a Python module that reproduces the chapter's figures, linked to the lecture notes.
ISLR2 package in R) from the book's website, and set ISL_DATA to the folder of CSV files for the Python code.Rscript ch03_lab.R or python3 ch03_lab.py, and a chapter's figures with python3 ch03_linear_regression.py (or --fig 3.4 for one figure).The R labs use base R and the standard packages (ISLR2, MASS, class, e1071, glmnet, pls, leaps, splines, gam, tree, randomForest, gbm, BART, survival, boot). The Python labs use pandas, numpy, statsmodels, scikit-learn and PyTorch. Shared helpers are in common.py.
Code: ch01_introduction.py ch01_lab.R ch01_lab.py · Notes: Introduction
Code: ch02_lab.R ch02_lab.py ch02_statistical_learning.py · Notes: Statistical Learning
Code: ch03_lab.R ch03_lab.py ch03_linear_regression.py · Notes: Linear Regression
Code: ch04_classification.py ch04_lab.R ch04_lab.py · Notes: Classification
Code: ch05_lab.R ch05_lab.py ch05_resampling_methods.py · Notes: Resampling Methods
Code: ch06_lab.R ch06_lab.py ch06_model_selection_regularization.py · Notes: Linear Model Selection and Regularization
Code: ch07_lab.R ch07_lab.py ch07_moving_beyond_linearity.py · Notes: Moving Beyond Linearity
Code: ch08_lab.R ch08_lab.py ch08_tree_based_methods.py · Notes: Tree-Based Methods
Code: ch09_lab.R ch09_lab.py ch09_support_vector_machines.py · Notes: Support Vector Machines
Code: ch10_deep_learning.py ch10_lab.R ch10_lab.py · Notes: Deep Learning
Code: ch11_lab.R ch11_lab.py ch11_survival_analysis.py · Notes: Survival Analysis and Censored Data
Code: ch12_lab.R ch12_lab.py ch12_unsupervised_learning.py · Notes: Unsupervised Learning
Code: ch13_lab.R ch13_lab.py ch13_multiple_testing.py · Notes: Multiple Testing