Skip to content

Commit

Permalink
Moved Jupyter guide to docs (#242)
Browse files Browse the repository at this point in the history
  • Loading branch information
tovbinm committed Mar 19, 2019
1 parent 45ce014 commit 418d485
Show file tree
Hide file tree
Showing 8 changed files with 105 additions and 102 deletions.
103 changes: 103 additions & 0 deletions docs/examples/Running-from-Jupyter-Notebook.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
# 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](http:https://beakerx.com/) Scala kernel for Jupyter

## Setup BeakerX on Linux / Ubuntu

Prerequisites:

* Python 3
* JDK 8

Installation using `pip`:

```$xslt
pip install beakerx
beakerx install
```

Installation using [Anaconda](https://www.anaconda.com/distribution/):

```$xslt
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](http:https://beakerx.com/documentation).

## Setup BeakerX on Mac with Docker

BeakerX provides a [docker container image](https://hub.docker.com/r/beakerx/beakerx/) on docker hub.

### Increase the RAM available to Docker container

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

![docker-settings][docker-settings]

[docker-settings]: https://github.com/salesforce/TransmogrifAI/raw/master/resources/docker_memory_settings.png

### Set TransmogrifAI_HOME

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

```bash
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:

```bash
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:https://localhost:8888/?token=<sometoken>
```

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

![notebook_home][notebook_home]

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

![helloworld_notebooks][helloworld_notebooks]

[notebook_home]: https://github.com/salesforce/TransmogrifAI/raw/master/resources/notebook_home.png
[helloworld_notebooks]: https://github.com/salesforce/TransmogrifAI/raw/master/resources/helloworld_notebooks.png


### Sample Notebooks

Following notebooks are currently available:

#### Titanic Binary Classification

[OpTitanicSimple.ipynb](http:https://localhost:8888/notebooks/helloworld-notebooks/OpTitanicSimple.ipynb)

![op_titanic][op_titanic]

#### Iris MultiClass Classification

[OpIris.ipynb](http:https://localhost:8888/notebooks/helloworld-notebooks/OpIris.ipynb)

![op_iris][op_iris]

[op_titanic]: https://github.com/salesforce/TransmogrifAI/raw/master/resources/op_titanic.png
[op_iris]: https://github.com/salesforce/TransmogrifAI/raw/master/resources/op_iris.png
1 change: 1 addition & 0 deletions docs/examples/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@ Examples
Time-Series-Aggregates-and-Joins
Conditional-Aggregation
Running-from-Spark-Shell
Running-from-Jupyter-Notebook
Bootstrap-Your-First-Project
103 changes: 1 addition & 102 deletions helloworld/notebooks/README.md
Original file line number Diff line number Diff line change
@@ -1,104 +1,3 @@
# TransmogrifAI on Jupyter

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

We are going to leverage [BeakerX](http:https://beakerx.com/) Scala kernel for Jupyter

## Setup BeakerX on Linux / Ubuntu

Prequisities :

* Apache Maven
* Python 3
* JDK 8

Installation using pip

```$xslt
sudo pip install beakerx
sudo beakerx install
```

Installation using conda

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

Reference : [BeakerX Documentation](http:https://beakerx.com/documentation)

## Setup BeakerX on Mac with Docker

BeakerX provides a [docker container image](https://hub.docker.com/r/beakerx/beakerx/) on docker hub.

Assuming your Transmogrify source code is downloaded at `/Users/rdua/work/github/rajdeepd/TransmogrifAI`. You can use
the `docker run` command to start the container.

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

### Increase the RAM available to Docker container

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


![docker-settings][docker-settings]

[docker-settings]: ./images/docker_memory_settings.png

### Set TransmogrifaiPATH

```bash
export TransmogrifaiPATH=<TransmogrifAI installation dir>
```

### Run the beakerx Container

```bash
docker run -p 8888:8888 -v $TransmogrifaiPATH/helloworld/notebooks:/home/beakerx/helloworld-notebooks \
-v $TransmogrifaiPATH/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:https://localhost:8888/?token=<sometoken>
```

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

![notebook_home][notebook_home]

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

![helloworld_notebooks][helloworld_notebooks]

[notebook_home]: ./images/notebook_home.png
[helloworld_notebooks]: ./images/helloworld_notebooks.png


### Sample Notebooks

Following notebooks are currently available

#### OpTitanicSimple

[OpTitanicSimple.ipynb](http:https://localhost:8888/notebooks/helloworld-notebooks/OpTitanicSimple.ipynb)

![op_titanic][op_titanic]

#### OpIris

[OpIris.ipynb](http:https://localhost:8888/notebooks/helloworld-notebooks/OpIris.ipynb)

![op_iris][op_iris]

[op_titanic]: ./images/op_titanic.png
[op_iris]: ./images/op_iris.png
Follow [this guide](https://docs.transmogrif.ai/en/stable/examples/Running-from-Jupyter-Notebook.html) to run TransmogrifAI from Jupyter Notebook.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes

0 comments on commit 418d485

Please sign in to comment.