使用 MLflow 記錄與擷取資料
MLflow 是用來管理機器學習生命週期的開源平台。它可用於追蹤實驗、將程式碼封裝成可重現的執行,以及分享與部署模型。在接下來的練習中,你會為心臟病模型的訓練實驗記錄一些參數。mlflow 已匯入,且已為你載入訓練好的心臟病 model。
本練習屬於課程
端到端機器學習
練習說明
- 初始化一個名為
"Logistic Regression Heart Disease Prediction"的 MLflow 實驗。 - 啟動一次執行,並記錄訓練後模型的係數與截距。
動手互動練習
試著完成這個範例程式碼,體驗一下這個練習。
# Initialize the MLflow experiment
____.____("Logistic Regression Heart Disease Prediction")
# Start a run, log model coefficients and intercept
with ____.____:
for idx, coef in enumerate(model.coef_[0]):
____.____(f"coef_{idx}", ____)
____.____("intercept", model.intercept_[0])
run_id = mlflow.active_run().info.run_id
print(run_id)