This tutorial uses Jupyter notebooks with the R kernel. If you are using Anaconda Python, you already have Jupyter intalled. For non-Anaconda users, you can optionally install Python via Homebrew and then install Jupyter via pip
.
Note that the math (LaTeX) does not appear correctly when viewed directly on GitHub, so if you want the full experience, you should git clone
or download the zip file of this repository to run the tutorial locally. To git clone:
git clone https://github.com/ledell/useR-machine-learning-tutorial.git
Python is a requirement of Jupyter notebooks. It should be installed by default on most machines. If you are on a mac, you can use the built-in Python, however I'd recommend the Homebrew version instead. This will install Python 2.7.
# Homebrew
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
# Python 2.7
brew install python
brew install python-dev
PyPI is the [easiest way to install Python packages (it's the "CRAN" of Python). Do I need pip?
Python 2.7:
pip install -U jupyter
Python 3:
pip3 install -U jupyter
Install the IRkernel binary in R. More info here.
Note that pip
or pip3
may have installed Jupyter to a local directory which you
need to make visible to R. One option is to adjust PATH
before calling R
:
PATH="~/.local/bin/:$PATH" R
With R started that way, run these commands:
install.packages(c('repr', 'pbdZMQ', 'devtools'), repos = c(CRAN = "https://cran.rstudio.com"))
library(devtools)
devtools::install_github('IRkernel/IRdisplay')
devtools::install_github('IRkernel/IRkernel')
IRkernel::installspec()
At the command line:
cd useR-machine-learning-tutorial
jupyter notebook
This will bring up a directory listing in your browser, which allows you to click on any of the tutorial ipynb notebooks.