Happy partial snow day! The following just guides you through installing python packages in an environment. This will be useful going forward.
Programming in lab will make use of Python notebooks (also called Jupyter notebooks). Python notebooks are a cell-based Python environment, meaning that your code is divided into cells that can be run in any order. The notebooks are backed by a Python kernel that maintains state between cell executions. Python notebooks are a very common programming environment for machine learning and data science. The cell-based execution and in-place plotting makes data exploration particularly convenient.
You will need Python 3 and a bunch of Python libraries. The simplest way to install these is to download and install conda via Miniforge.
ml
EnvironmentNext, make sure you’re in the lab01
directory and run
the following command. It will create a new conda
environment containing libraries you will need for this class:
$ conda env create -f environment.yml
Next, activate the new environment:
$ conda activate ml
You’re almost there! You just need to register the ml
conda environment to Jupyter.
$ python3 -m ipykernel install --user --name=ml
You have to select the kernel in the “Kernel > Change kernel…” menu in Jupyter every time you open a notebook.
That’s it! You can now start Jupyter like this:
$ jupyter lab
This should open up your browser to Jupyter lab with the contents of the current directory. If your browser does not open automatically, visit localhost:8888.
Every time you want to work on materials for this class, you will need to open a Terminal, and run:
$ cd PATH # Navigate to your project folder
$ conda activate ml
$ jupyter lab
The instructions for setting up a local environment and accompanying
environment specification (environment.yml
) are adapted
from the github repo (link) for Hands-on Machine Learning with
Scikit-Learn, Keras and TensorFlow (3rd edition).