Jupyter + Rails

Jupyter notebooks are a great alternative to the Rails console for building predictive models. Here’s how to get setup:

First, install Jupyter Notebook and ZeroMQ. With Homebrew, use:

brew install jupyter zeromq

Add to your Gemfile

group :development do
  gem 'iruby'
  gem 'ffi-rzmq'


iruby register --force

Start Jupyter

jupyter notebook

Create a notebook and add to the top

require "./config/environment"

If not at Rails root, use Dir.chdir("path/to/root") { require "./config/environment" }

And science away


Published June 19, 2018 · Tweet

You might also enjoy

XGBoost and LightGBM Come to Ruby

Scaling the Monolith

Artistic Style Transfer in Ruby

All code examples are public domain.
Use them however you’d like (licensed under CC0).