用于记录与检索数据的 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)