Python

Materials for class on Monday, April 29, 2019

Contents

Tweet of the day

Altair is based on Vega and Vega-Lite, another creation by Jeff Heer and his lab. You can try Vega and Vega-lite here! There is also a vegalite R package.

Lab: Python+R (reticulate) in a Docker Container

1. Run RStudio’s ML Docker Image in one of these ways:

Did you know, this docker image also includes Machine Learning packages (for CPU) like h2o, tensorflow, and keras! It can expand to GPU environments too!

  1. Easiest option (free, no local install): play-with-docker

  2. Will take time to install (free): local Docker

  3. Will cost money: Digital Ocean Droplet

play-with-docker.com option

3. Open RStudio via port 8787

FYI: username: rstudio, pwd: whatever you chose

4. Importing python packages

5. Installing python packages

  1. Run this in RStudio terminal:
  1. Restart RStudio session (Session > Restart R)

  2. Run this in RStudio console:

Altair via Jupyter Docker install (“no R”)

1. Altair Jupyter notebook installation

2. Open the Jupyter notebook in port 8888

3. Open terminal via Jupyter and run:

See the folder “/altair-tutorial/notebooks/”.

5. Comment this out in Jupyter notebook.

1. Docker training

2. Altair tutorial jupyter notebooks, slides and video

3. Yihui’s thoughts on R-Python notebooks

4. Python reticulate configuration

5. RStudio reticulate cheatsheet