CS 445 Machine Learning

Fall 2020

This document outlines how to config a workstatiion with all the required software for Machine Learning. This document outlines how to create this environment on one of the following environments:

Limited MS Windows Support

In theory, Python and the required packages should run in a Windows environment, however, limited assistance will be available for Windows installations.

Configuring a Development Environment

This document contains the procedure for building a programming/development environment for this machine learning class.

Install Python and Setting up a Virtual Environment (venv) on Ubuntu/Mint

This class will utilize Python 3, and recommends Python 3.8. To get Python3.8, you can simply use apt-get if you running Ubuntu/Mint 20.

                sudo apt-get update
                sudo apt-get install python3-distutils python3-pip python3-dev python3-venv
            

Install Python on a MAC

Settup up a Virtual Python Environment (venv)

A virutal python environment allows the installation of packages and tools that are only visable in that environment. It avoids conflicts between packages. To create a virtual environment, follow these steps:

                cd # places you in your home directory
                python3 -m venv cs445_venv
         
To activate your virtual environment, execute the following command:

                source $HOME/cs445_venv/bin/activate
            
After sourcing this file, your prompt should now be prefixed with (cs445_venv). You will probably want this environment setup each time use start the shell, which can be accomplished by adding this to your .bashrc file for Ubuntu/Mint or your .bash_profile file on Mac.

Install Python ToolSets

The remaining steps install Python software packages utilizing pip (a package manager for Python). For this class, I highly recommend creating a virtual python environment (as detailed in the prior step). The following procedure will work on Mac or Ubuntu. First, start a terminal window by click on the black screen icon, located in the bottom left corner (for me, it is the 4th small icon from the left). Next, make sure you venv environment is active by doing one of the following commands:
  • which python command (make sure that path is to the python link in your venv)
  • Notice that your shell prompt has the venv environment name prefixd in the front (as shown in the image of the terminal window from the prior section)
Next, run the following commands, which will install the required packages.
            
                pip install --upgrade pip
                pip install wheel
                pip install setuptools
                pip install numpy
                pip install matplotlib
                pip install notebook
                pip install pandas
                pip install PyQt5
                pip install seaborn
                pip install sklearn
                pip install tensorflow
                pip install Keras
                pip install tensorflow_datasets
                # NEW STUFF TO Fix Validate in nbgrader
                pip install nbgrader
                jupyter nbextension install --sys-prefix --py nbgrader
                jupyter nbextension enable --user validate_assignment/main --section=notebook
                jupyter serverextension enable --user nbgrader.server_extensions.validate_assignment

            
        

Install the PyCharm IDE

PyCharm provides a nice language aware editor, a linter (something that checks your syntax as you type), and a nice debugger. Other IDE's that are popular are Spyder (especially popular with computational biologists), and MS Visual Code. This procedure focuses on PyCharm. To obtain a copy of PyCharm and install it, follow these steps:
  1. Register for a free version of PyCharm professional. Visit https://www.jetbrains.com/student/. Typically it takes less than 5 minutes for a license to get approved.
  2. After being approved, create your JetBrains account. You will need this to register your copy of PyCharm.
  3. Download the PROFESSIONAL version of pycharm from https://www.jetbrains.com/pycharm/download. At the welcome screen, select activate new license with: JetBrains account
When first starting PyCharm, you will need to pick an interpreter. Make sure to pick the virtual environment ($HOME/cs445_venv). The image below shows where I changed the location and selected to use an existing interpreter. You can also control where you project files will be kept. I would strongly recommend storing these files where they will be routinely backed up. When I use a VM, I setup a mount point/directory from my Mac (which gets backed up). I would also recommend using GIT (since it will provide another layer of safety and utility).