An Introduction to Statistical Learning is a textbook by Gareth James, Daniela Witten, Trevor Hastie and Robert Tibshirani. Conceptual and applied exercises are provided at the end of each chapter covering supervised learning.
This repository contains my solutions to the labs and exercises as Jupyter Notebooks written in Python using:
Perhaps of most interest will be the recreation of some functions from the R language that I couldn't find in the Python ecosystem. These took me some time to reproduce but the implementation details are not essential to the concepts taught in the book so please feel free to reuse. For example, a reproduction of R's lm()
four-way diagnostic plot for linear regression in Chapter 3. Also, a collection of all required datasets is provided in .csv format.
Links to view each notebook below. The code is provided here.
Chapter 2 - Statistical Learning: Conceptual
Chapter 2 - Statistical Learning: Applied
Chapter 3 - Linear Regression: Conceptual
Chapter 3 - Linear Regression: Applied
Chapter 4 - Classification: Conceptual
Chapter 4 - Classification: Applied
Chapter 5 - Resampling Methods: Conceptual
Chapter 5 - Resampling Methods: Applied
Chapter 6 - Linear Model Selection and Regularization: Labs
Chapter 6 - Linear Model Selection and Regularization: Conceptual
Chapter 6 - Linear Model Selection and Regularization: Applied
Chapter 7 - Moving Beyond Linearity: Labs
Chapter 7 - Moving Beyond Linearity: Applied
Chapter 8 - Tree-Based Methods: Labs
Chapter 8 - Tree-Based Methods: Conceptual
Chapter 8 - Tree-Based Methods: Applied
Chapter 9 - Support Vetor Machines: Labs
Chapter 9 - Support Vetor Machines: Conceptual
Chapter 9 - Support Vetor Machines: Applied
Running the notebooks enables you to execute the code and play around with any interactive features.
To run:
cd
to this repojupyter notebook
to run the Jupyter server locally on your machine. It should launch in your browser.