开始使用免费开始使用

MLflow projects 模块

您也可以使用 Python 通过 mlflow projects 模块以编程方式运行 MLflow Projects。

在本练习中,您将使用 projects 模块运行一个 MLflow Project,为您的 "Insurance" 项目训练模型。您将根据 MLproject 文件设置入口点来执行训练代码。您还将把实验名称设置为 "Insurance",以便将模型正确记录到 MLflow Tracking 中对应的实验。

您可以在 IPython shell 中执行 print(MLproject) 来查看 MLproject 文件的内容。

本练习是课程的一部分

MLflow 入门

查看课程

练习说明

  • mlflow projects 模块调用 run() 函数。
  • MLproject 文件的 URI 设置为当前工作目录。
  • 按照 MLproject 文件将入口点设置为 "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,
)
编辑并运行代码