Setup Jupyter and other Machine Learning tools on macOS

Jupyter Notebook is an interactive environment for running code in the browser. It allows you to create interactive documents that contain live code, rich text elements and visualizations. It's also a widely used tool for Data Scientists to make prototypes or demonstrations.

ref:
http://jupyter.org/

Install

$ brew install freetype gcc libffi libpng openssl pkg-config
$ pip install -U \
  cython \
  numpy \
  scipy \
  graphviz \
  matplotlib \
  bokeh \
  seaborn \
  pydotplus \
  scikit-learn \
  nltk \
  pandas \
  pydataset \
  jupyter

$ pip install https://github.com/ipython-contrib/jupyter_contrib_nbextensions/tarball/master && \
  jupyter contrib nbextension install --user

# start your notebook server
$ jupyter notebook

ref:
https://jupyter.readthedocs.io/en/latest/running.html#running
https://github.com/ipython-contrib/jupyter_contrib_nbextensions

Or you could just download Anaconda and install it.
https://www.continuum.io/downloads#osx

Configuration

in ~/.ipython/profile_default/ipython_config.py

c = get_config()

c.InteractiveShell.ast_node_interactivity = 'all'

# c.InteractiveShellApp.matplotlib = 'notebook'
c.InteractiveShellApp.matplotlib = 'inline'

Usage

# show image
from IPython.display import Image
Image('iris.png')

# show pdf
from IPython.display import IFrame
IFrame('iris.pdf', width='100%', height=700)