First Contact – jupyter notebook files

In my opinion, the best way to learn about a new python Framework in a very playful manner are prepared jupyter (former iPython) notebook files. Fortunately google is delivering a small but high quality set of notebooks along with the tensorflow github package.
The first notebook hello_tensorflow.ipynb explains the basic principles of working with Tensorflow-tensors and -operators. getting_started.ipynb walks through an example of a very simple neural network for linear regression with gradient descent. The last notebook mnist_from_scratch.ipynb applies Tensorflow to the actual Hello World of Machine Learning, the MNIST handwritten digit dataset.

If you want to use Tensorflow on a regular basis, there is no good performing alternative to using a native linux or Mac OS installation due to the lack of GPU support. Windows users who just want to take a glimpse at Tensorflow for learning or smaller research purposes however can do so easily by using Docker.

With the following setup, Tensorflow can be used on Windows hosts by using a docker-hostet Jupyter Notebook (former iPython Notebook) from the host browser with local .ipynb files.

Requirements

First, the following software has to be installed on the host. For those never worked with Docker, this short tutorial gives a good overview.

Instead of using VBoxManage you can use VirtualBox Manager by clicking Docker-Machine-VM->Settings->Network-Port Forwarding.

The next step is to share our hosts folder for .ipynb files. Therefore we have to stop the freshly created Docker-Machine and afterwards share the folder (in my case “jupyter_notebooks”) with the docker-machine by using the VBoxManage sharedfolder add command.

Like above, instead of VBoxManage you can use the VirtualBox Manager here: VM->Settings->Shared Folders->add

2. Start Docker-Machine and “wire up” the shared folders.

By using the following two commands, we start the preconfigured machine and connect to it via ssh.

1

docker-machine start default

1

docker-machine ssh default

Afterwards we create a target folder inside of the docker-machine and mount the previously shared folder.

1

sudo mkdir /VM_notebooks

1

sudo mount -t vboxsf win_ notebooks /VM_notebooks

Now you should be able to list the shared folders contents with

1

ls /VM_notebooks

3. Run Docker

As last step we can now create our docker container. Like before we forward ports 8888 and 6006 to the container by using the -p flag and again we share our folder by using -v. the source for our container is b.gcr.io/tensorflow/tensorflow from Google Container Registry. With -c we finally give the order to run Jupyter Notebook on our double-shared folder.