Linear regression with scikit-learn and statsmodels

One of my favorite resources for learning about machine learning algorithms is the book Introduction to Statistical Learning (ISLR) by James, Witten, Hastie, and Tibshirani. I’m currently going through this book with my weekly math and stats book club, and I’ve been inspired by it to write some posts about implementing machine learning algorithms with Python, specifically the scikit-learn API. Some of these posts will be adapted from work I did over the summer of 2022, and others will be new work. I’ll share each post as a Jupyter notebook that has been converted to HTML. So, if you’re ready to learn more about linear regression using scikit-learn and statsmodels, click here!

In case you were wondering, I used nbconvert to convert the completed Jupyter notebook to HTML. In the command line, I just ran the following.

$ jupyter nbconvert --to HTML --template lab --theme dark LinearRegression.ipynb

The original Jupyter notebook is not held in the same repository as this website, so if you want to check it out, head over to the ML_algorithms repo on my GitHub.