如何透過 JupyterHub 使用 Jupyter Notebook
透過本篇教學文章,您將瞭解如何透過 JupyterHub 使用 Jupyter Notebook 以及執行範例程式碼。
步驟一: 安裝 JupyterHub 並開啟 Notebook 伺服器
您可從 QTS App Center 安裝 JupyterHub 。

開啟並登入 JupyterHub。

點擊切換開關以切換成「開啟」,即可啟動 Notebook 伺服器。

畫面將顯示以下項目:
執行中: 檢查已啟動的執行個體
上傳: 上傳本機檔案到伺服器
新增: 開啟新的 Notebook、終端機或資料夾
管理員: 切換到管理員頁面(僅適用於管理員帳號)
登出 Jupyter Notebook

如果 Notebook 正在執行,請點擊[執行中]以檢視下列頁面。 您也可以點擊[關機]將其關閉。

系統管理員可以進入[管理員]頁面並存取使用者的 Notebook。

步驟二: 執行範例程式碼
在清單上選擇 "jupyter_example"。

開啟 "example.ipynb"。

Python 範例程式碼隨即在新的 Notebook 上開啟。
此程式可以透過 Keras 訓練卷積神經網路 (Convolutional Neural Network);這是一種高階神經網路 API,可用於 MNIST 資料集中的手寫數字辨識。
如需詳細資訊,請前往:
- Keras: https://keras.io/
- MNIST: http://yann.lecun.com/exdb/mnist/

已執行且儲存範例程式碼。 您也可以重新執行程式碼。
點擊[執行]以執行特定片段或循序執行。

點擊[單元](Cell)並選擇[全部執行],執行完整程式碼。

匯入 Keras 資源庫

匯入其他 Python 資源庫

載入 MNIST 資料集

隨機挑選和檢查影像-標籤組合

預先處理訓練集
調整訓練影像的形狀並將影響標準化

One-hot 編碼訓練標籤

逐層建立循序模型

使用 Adam 優化器,並選擇類別交叉熵 (categorical cross entropy) 作為訓練模型的目標函數。 下列程式碼會執行約數秒。

使用測試集評估模型。 雖然訓練集的準確度應高於 99%,此訓練集的準確度可能會些微降低。

最後會顯示測試結果。

相關教學文件:
留言
張貼留言
發表一下意見,互動一下唄!