Linear models demystified

A notebook to explain the power and interpretability of linear models. Hopefully this will make complex modelling packages like prophet seem less like magic.

This notebook is heavily inspired by this fantastic talk, along with this notebook investigating cycling patterns in Seattle

Installation

The best way to install this notebook is with miniconda (conda's little cousin).

  1. Download, and unzip, the folder from github (drop down from the "code" button)
  2. Download and install miniconda
  3. Open the anaconda prompt (or terminal if you know how) in the project folder
  4. create a new environment with the following command
conda env create -f environment.yaml 

Activate your newly created environment with the following:

conda activate linear_models

These steps should install all the necessary packages. If you get an error that says package not installed then run the following

python -m pip install [package-name]

VSCode

I use VSCode as my code editor since it is free and open-source. You can also use things like PyCharm (which I think is included at Trainline). The benefit of these editors is that you can open and view Jupyter notebooks without launching a full jupyter server. This makes it easier to edit and move files, you can change jupyter kernels easier and all round better coding experience.

You just need to install the Jupyter extension on VSCode and you should be able to the notebooks included here.

App

To create the web app, run

shinylive export three_models_app site

and then run locally with

python -m http.server --directory site 8008