Tensorflow-Jupyter Notebook on Magalix

TensorFlow is an open source software library for numerical computation using data flow graphs. The graph nodes represent mathematical operations, while the graph edges represent the multidimensional data arrays (tensors) that flow between them. It is a symbolic math library and also used for machine learning applications such as neural networks.

Jupyter notebook is a web-based notebook environment for interactive computing.

Jupyter notebook, the language-agnostic evolution of IPython notebook

The jupyteryter notebook is a language-agnostic HTML notebook application for Project Jupyter. In 2015, Jupyter notebook was released as a part of The Big Split™ of the IPython codebase. IPython 3 was the last major monolithic release containing both language-agnostic code, such as the IPython notebook, and language specific code, such as the IPython kernel for Python.

Installation

You can install tensorflow-jupyter-notebook on Magalix by few simple steps:

  1. Create new app
  2. Select tensorflow-jupyter template from the data science templates
  3. You can now get the running application URL from the console, by clicking Endpoints

  4. Since access to the Jupyter notebook server means access to running arbitrary code, it is important to restrict access to the notebook server. For this reason, notebook introduces token-based authentication that is on by default. When token authentication is enabled, the notebook uses a token to authenticate requests. This token can be provided to login to the notebook server in three ways:

    • in the Authorization header, e.g.::
      ** Authorization: token abcdef...
    • In a URL parameter, e.g.::
      ** http://app.magalix.cloud:8888/tree/?token=abcdef...
    • In the password field of the login form that will be shown to you if you are not logged in.

When you start a notebook server with token authentication enabled (default), a token is generated to use for authentication. This token is logged to the terminal so that you can copy/paste the URL into your browser::

[I 11:59:16.597 NotebookApp] The Jupyter Notebook is running at: http://localhost:8888/?token=c8de56fa4deed24899803e93c227592aef6538f93025fe01

You can find the token in the log section at Magalix console

Running Jupyter Notebook

After login you will be able to view the ipynb getting-started files

The IPython Notebook is an interactive computational environment, in which you can combine code execution, text, mathematics, plots.

Now let’s start working with it, click on the first notebook sample, 1_hello_tensorflow.ipyng

The notebook will be opened in a new browser tab.

Please select the suitable kernel, by clicking kernel, then select change kernel and choose either python2 or 3 based on the used code

The notebook is split into cells, either python code or test. You can execute a cell by clicking it and then press Shift + Enter, the code in the selected cell will run and the output of the cell will be displayed beneath the selected cell

You can add/remove cells as you want.
It is a good idea to go through the three sample files before moving forward to the next section (training models)

Training and Test Sample Models

There are a lot of online-tutorial to get started and be productive with TensorFlow.
You can start by downloading the tutorial files from this one: https://github.com/nlintz/TensorFlow-Tutorials

Please upload the ipynb files to our TensorFlow instance using the Notebook url.

Now are are ready to start the different uploaded samples . For example the second sample “02_logistic_regression.ipynb” sample is a sample to create digits from images in MNIST datasets using TensorFlow.

By clicking the NoteBook file name, it will open a new tab with the file.

Select Python2 as a kernel from the Kernel menu

then run each code block in the notebook to produce output/

Now let’s extract the data sets and model predictions and train the model using TensorFLow GradientDescentOptimizer