Running from Jupyter Notebook

In this section we will look at how TransmogrifAI can be run within Scala notebooks on Jupyter.

We are going to leverage BeakerX Scala kernel for Jupyter

Setup BeakerX on Linux / Ubuntu

Prerequisites:

  • Python 3
  • JDK 8

Installation using pip:

pip install beakerx
beakerx install

Installation using Anaconda:

conda create -y -n beakerx 'python>=3'
source activate beakerx
conda config --env --add pinned_packages 'openjdk=8.0.152'
conda install -y -c conda-forge ipywidgets beakerx

Reference : BeakerX Documentation.

Setup BeakerX on Mac with Docker

BeakerX provides a docker container image on docker hub.

Increase the RAM available to Docker container

Increase the Memory available to docker containers from the docker UI as shown below

https://github.com/salesforce/TransmogrifAI/raw/master/resources/docker_memory_settings.pngdocker-settings

Set TransmogrifAI_HOME

Assuming your Transmogrify source code is downloaded at /Users/johndoe/TransmogrifAI run the command:

export TransmogrifAI_HOME="/Users/johndoe/TransmogrifAI"

We need the directory above so that we can mount sample notebooks and dataset into the container using docker volumes.

Run the BeakerX Container

You can use the docker run command to start the container as follows:

docker run -p 8888:8888 -v $TransmogrifAI_HOME/helloworld/notebooks:/home/beakerx/helloworld-notebooks \
-v $TransmogrifAI_HOME/helloworld:/home/beakerx/helloworld --name transmogrifai-container beakerx/beakerx

This will download the image (which takes a few minutes first time) and start the container. It will also publish the url and the token to access the container

Sample url is shown below.

http://localhost:8888/?token=<sometoken>

On opening the image in the browser you will notice that in the home page

https://github.com/salesforce/TransmogrifAI/raw/master/resources/notebook_home.pngnotebook_home

“helloworld-notebooks” mounted folder (/home/beakerx/helloworld-notebooks) is where all our samples are located.

https://github.com/salesforce/TransmogrifAI/raw/master/resources/helloworld_notebooks.pnghelloworld_notebooks

Sample Notebooks

Following notebooks are currently available:

Titanic Binary Classification

OpTitanicSimple.ipynb

https://github.com/salesforce/TransmogrifAI/raw/master/resources/op_titanic.pngop_titanic

Iris MultiClass Classification

OpIris.ipynb

https://github.com/salesforce/TransmogrifAI/raw/master/resources/op_iris.pngop_iris