開始使用免費開始

MLflow projects 模組

你也可以用 Python 透過 mlflow projects 模組以程式方式執行 MLflow Projects。

在這個練習中,你會使用 projects 模組來執行一個 MLflow Project,為你的 "Insurance" 專案訓練模型。你會從 MLproject 檔案中定義 entry point,以執行訓練程式碼。你也會把實驗名稱設為 "Insurance",讓模型能正確記錄到 MLflow Tracking 中對應的實驗。

你可以在 IPython 殼層中執行 print(MLproject) 來閱讀 MLproject 檔案的內容。

本練習屬於課程

MLflow 入門

檢視課程

練習說明

  • mlflow projects 模組呼叫 run() 函式。
  • MLproject 檔案的 URI 設為目前工作目錄。
  • 依照 MLproject 檔案,將 entry point 設為 "main"
  • 將實驗名稱設為 "Insurance"

動手互動練習

試著完成這個範例程式碼,體驗一下這個練習。

import mlflow

# Set the run function from the MLflow Projects module
____.____.____(
  	# Set the URI as the current working directory
    ____='____',
    # Set the entry point to main
    ____='____',
    # Set the experiment name as Insurance
    ____='____',
    env_manager="local",
    synchronous=True,
)
編輯並執行程式碼