/agent

¿ⓧ_ⓧﮌ Life as confusion matrix ¿ⓧ_ⓧﮌ

Making machine learning accessible

Getting started with ML101

This is a getting started guide for beginners to Python who want to run through Francis Tseng's ML101 workshop notes.

Never ran a line of Python before? No problem.

You'll need:

  • Homebrew: a package manager for OS X
  • Python3: You will already have Python 2.7 on your computer but you'll want to use Python 3.5
  • Python module virtualenv: The virtual environment creates isolated Python environments for each of your projects. Consider this step to be best practice.

  1. Launch Terminal and install Python3 with Homebrew.
    brew install python3

  2. Clone ml101 onto your local machine.
    git clone https://github.com/frnsys/ml101.git

  3. Navigate into the notebooks folder.
    cd /your-directory-name/ml101/altai/notebooks

  4. Install the Python package virtualenv. Pip3 is Python3's package manager.
    sudo pip3 install virtualenv

  5. Create an instance of your virtualenv and call it "venv"
    virtualenv -p python3 venv

  6. Activate venv. After doing this, you will see (venv) preceeding each line in your Terminal output.
    source venv/bin/activate

  7. Navigate one level out of the current folder and install the requirements for each example. If you look in Finder, you'll see that there is a requirements.txt in the /altai folder
    cd ../
    pip install -r requirements.txt

  8. Run the iPython Jupyter Notebook. It is one of the dependencies specified in requirements.txt and was installed when you ran the previous command.
    jupyter notebook
    requirements

  9. To run a Python cell in Jupyter (these are marked with green borders), hit shift + enter when tabbed into it. The blue cells are Markdown and usually used for instructions.

  10. If you ever encounter an error when running cells, it could be because of a missing dependency. Use this command to install it in the /altair folder while you've got your virtualenv running. So the code will look something like the following. When the dependency is installed, you can run Notebook again.
    (venv) Users-MacBook-Pro:altai mac$ pip3 install blessings

Relaunching your environment

Say you closed your Terminal tab or restarted your computer. To get started up again, just navigate to the /ml101/altai/notebooks/ folder and reactivate the virtualenv.
source venv/bin/activate

Then you can continue working with Notebook by typing jupyter notebook.