ReinforcementLearningConfiguration 类

表示针对 Azure 机器学习计算目标的强化学习运行的配置。

ReinforcementLearningConfiguration 对象封装在试验中提交强化学习运行所需的信息。 它包括有关执行试验运行的头、辅助角色和计算目标的信息。

构造函数

ReinforcementLearningConfiguration(head_configuration, worker_configuration, max_run_duration_seconds=None, cluster_coordination_timeout_seconds=None, source_directory=None, _path=None, _name=None, framework=None)

参数

名称 说明
head_configuration
必需

头的配置。

worker_configuration
必需

辅助角色的配置。

max_run_duration_seconds
必需
int

运行允许的最大时间(以秒为单位)。 如果作业花费的时间超过此值,Azure ML 将尝试自动取消作业。

cluster_coordination_timeout_seconds
必需
int

作业在完成排队状态后可能需要花费的最大时间(以秒为单位)。

source_directory
必需
str

包含头运行代码或配置的目录。

framework
必需

要用于试验的业务流程框架。 默认值为 Ray 版本 0.8.0

方法

load

从磁盘文件加载以前保存的强化学习运行配置文件。

如果 path 指向某个文件,则从该文件加载 ReinforcementLearningConfiguration。

如果path指向应为项目目录的目录,则从 <path/.azureml/>name< 或 >path<>/aml_config/<name> 加载 ReinforcementLearningConfiguration。

save

将 ReinforcementLearningConfiguration 保存到磁盘上的文件。

UserErrorException在:

  • 无法使用指定的名称保存 ReinforcementLearningConfiguration。

  • name 指定参数。

  • path 参数无效。

如果 path 格式 <为 dir_path>/<file_name> ,其中 <dir_path> 是有效目录,则 ReinforcementLearningConfiguration 保存在 <dir_path>/<file_name>。

如果path指向应为项目目录的目录,则 ReinforcementLearningConfiguration 保存在 <path/.azureml/>name< 或 >path<>/aml_config/<name>。

此方法在手动编辑配置或与 CLI 共享配置时非常有用。

load

从磁盘文件加载以前保存的强化学习运行配置文件。

如果 path 指向某个文件,则从该文件加载 ReinforcementLearningConfiguration。

如果path指向应为项目目录的目录,则从 <path/.azureml/>name< 或 >path<>/aml_config/<name> 加载 ReinforcementLearningConfiguration。

static load(path=None, name=None)

参数

名称 说明
path
str

用户选择了运行配置的根目录。 通常,这是 Git 存储库或 Python 项目根目录。 为了向后兼容,配置也将从 .azureml 或aml_config子目录加载。 如果该文件不在这些目录中,则会从指定的路径加载该文件。 如果未提供,则路径默认为当前工作目录。

默认值: None
name
str

配置文件名称。

默认值: None

返回

类型 说明

强化学习运行配置对象。

save

将 ReinforcementLearningConfiguration 保存到磁盘上的文件。

UserErrorException在:

  • 无法使用指定的名称保存 ReinforcementLearningConfiguration。

  • name 指定参数。

  • path 参数无效。

如果 path 格式 <为 dir_path>/<file_name> ,其中 <dir_path> 是有效目录,则 ReinforcementLearningConfiguration 保存在 <dir_path>/<file_name>。

如果path指向应为项目目录的目录,则 ReinforcementLearningConfiguration 保存在 <path/.azureml/>name< 或 >path<>/aml_config/<name>。

此方法在手动编辑配置或与 CLI 共享配置时非常有用。

save(path=None, name=None, separate_environment_yaml=False)

参数

名称 说明
separate_environment_yaml

指示是否保存 Conda 环境配置。 如果为 True,Conda 环境配置将保存到名为“_environment.yml”的 YAML 文件。

默认值: False
path
str

用户选择了运行配置的根目录。 通常,这是 Git 存储库或 Python 项目根目录。 配置将保存到名为 .azureml 的子目录。

默认值: None
name
str

[必需]配置文件名称。

默认值: None

返回

类型 说明