In this tutorial, you will learn how to use Jupyter Notebook via JupyterHub, and run an example code.
Step 1: Install JupyterHub and open the Notebook server
- JupyterHub can be installed from the QTS App Center.
Launch and log in to JupyterHub.
Click the switch from Off to “On” to start the Notebook server.
The interface will appear as following:
- “Running”: Check started instances
“Upload”: Upload local files to the server
“New”: Open a new Notebook, terminal or folder
“Admin”: Switch to the admin page (administrator accounts only)
Sign out of Jupyter Notebook
If a Notebook is running, click “Running” to view the following page. You can also click “Shutdown” to close it.
Administrators can enter the “”Admin” page and access a user’s Notebook.
Step 2: Run example code
- Choose “Jupyter_example” on the list.
A Python example code will be opened on a new Notebook.
This program can train a Convolutional Neural Network via Keras, which is a high-level neural networks API, for handwritten digit recognition in MNIST dataset.
For more information, visit:
The example code has been executed and saved. You can also run it again.
- Click “Run” to execute a specific section or run it sequentially.
Click “Cell” and choose “Run All” to execute complete code.
For more Notebook tutorials, visit http://jupyter.org/documentation
The program does the following:
- At the beginning, required libraries are imported.
- Import Keras libraries
Import other Python libraries
Load MNIST dataset: Randomly pick and check an image-label pair
Preprocess the training set: Reshape and normalize training images / One-hot encode training labels
Create a Sequential Model layer by layer
Use the Adam optimizer and choose categorical cross entropy as the objective function to train the model. The following part runs for a few seconds.
Evaluate the model using the test set. Although the accuracy on training set is higher than 99%, the accuracy on the test set may slightly decrease.
Finally the testing results are displayed.