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.[gallery columns="1" size="large" ids="3659"]

  • Launch and log in to JupyterHub.[gallery columns="1" size="large" ids="3660"]

  • Click the switch from Off to "On" to start the Notebook server.[gallery columns="1" size="large" ids="3661"]

  • The interface will appear as following:



  1. "Running": Check started instances

  2. "Upload": Upload local files to the server

  3. "New": Open a new Notebook, terminal or folder

  4. "Admin": Switch to the admin page (administrator accounts only)

  5. Sign out of Jupyter Notebook[gallery columns="1" size="large" ids="3662"]



  • If a Notebook is running, click "Running" to view the following page. You can also click "Shutdown" to close it.[gallery columns="1" size="large" ids="3663"]

  • Administrators can enter the ""Admin" page and access a user's Notebook.[gallery columns="1" size="large" ids="3664"]


 

Step 2: Run example code

  • Choose "Jupyter_example" on the list.[gallery columns="1" size="large" ids="3666"]

  • Open "example.ipynb".[gallery columns="1" size="large" ids="3667"]

  • 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:
    Keras: https://keras.io/
    MNIST: http://yann.lecun.com/exdb/mnist/[gallery columns="1" size="large" ids="3670"]



  • 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.[gallery columns="1" size="large" ids="3671"]

    • Click "Cell" and choose "Run All" to execute complete code.[gallery columns="1" size="large" ids="3672"]

    • For more Notebook tutorials, visit http://jupyter.org/documentation





  • The program does the following:

    • At the beginning, required libraries are imported.
      Import Keras libraries[gallery columns="1" size="large" ids="3673"]

      Import other Python libraries

      [gallery columns="1" size="large" ids="3674"]

    • Load MNIST dataset[gallery columns="1" size="large" ids="3675"]

      Randomly pick and check an image-label pair

      [gallery columns="1" size="large" ids="3676"]

    • Preprocess the training set
      Reshape and normalize training images[gallery columns="1" size="large" ids="3677"]

      One-hot encode training labels

      [gallery columns="1" size="large" ids="3678"]

    • Create a Sequential Model layer by layer[gallery columns="1" size="large" ids="3679"]

    • 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.[gallery size="large" columns="1" ids="3680"]

    • 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.[gallery columns="1" size="large" ids="3682"]

    • Finally the testing results are displayed.[gallery columns="1" size="large" ids="3683"]








Fore more tutorial, please refer to https://qiot.qnap.com/blog/en/category/learn/
arrow
arrow
    文章標籤
    QNAP NAS AI JupyterHub
    全站熱搜

    tttt 發表在 痞客邦 留言(0) 人氣()