開始使用免費開始

建立多步驟工作流程:模型工程

MLflow Projects 模組可以用來執行多步驟的工作流程。你可以用一個 Python 程式來協調所有步驟,並把前一步的結果傳遞給下一步。

在這個練習中,你會開始建立一個多步驟工作流程,用來管理 ML 生命週期中的模型工程(Model Engineering)與模型評估(Model Evaluation)步驟。你會對 model_engineering 這個 entry point 使用 MLflow Projects 模組的 run() 方法,並傳入用於模型訓練的超參數。你也會擷取 run_id 的輸出並指定給一個變數,之後可作為參數傳給流程中的 model_evaluation 步驟。

你在前一步建立的 MLproject 可在 IPython Shell 中以 print(MLproject) 檢視。MLflow 模組已匯入。

本練習屬於課程

MLflow 入門

檢視課程

練習說明

  • 將 MLflow Projects 模組的 run() 方法指派給名為 model_engineering 的變數。
  • 將 entry point 參數設為 "model_engineering"
  • 設定模型訓練的參數:將 "n_jobs" 設為 2"fit_intercept" 設為 False
  • model_engineeringrun_id 屬性指定給名為 model_engineering_run_id 的變數。

動手互動練習

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

# Set run method to model_engineering
____ = ____.____.____(
    uri='./',
    # Set entry point to model_engineering
    ____='____',
    experiment_name='Insurance',
    # Set the parameters for n_jobs and fit_intercept
    parameters={
        '____': ____, 
        '____': ____
    },
    env_manager='local'
)

# Set Run ID of model training to be passed to Model Evaluation step
____ = ____.____
print(model_engineering_run_id)
編輯並執行程式碼