ReinforcementLearningConfiguration Class

Represents configuration for reinforcement learning runs targeting Azure Machine Learning compute targets.

ReinforcementLearningConfiguration object encapsulates the information necessary to submit a reinforcement learning run in an experiment. It includes information about head, workers and compute targets to execute experiment runs on.

Inheritance
azureml._base_sdk_common.abstract_run_config_element._AbstractRunConfigElement
ReinforcementLearningConfiguration

Constructor

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

Parameters

head_configuration
Required

The configuration for head.

worker_configuration
WorkerConfiguration
Required

The configuration for the workers.

max_run_duration_seconds
int
Required

The maximum allowed time for the run in seconds. Azure ML will attempt to automatically cancel the job if it takes longer than this value.

cluster_coordination_timeout_seconds
int
Required

The maximum time in seconds that the job can take to start once it has passed the queued state.

source_directory
str
Required

The directory containing code or configuration for the head run.

framework
RLFramework
Required

Orchestration framework to be used in the experiment. The default is Ray version 0.8.0

Methods

load

Load a previously saved reinforcement learning run configuration file from an on-disk file.

If path points to a file, the ReinforcementLearningConfiguration is loaded from that file.

If path points to a directory, which should be a project directory, then the ReinforcementLearningConfiguration is loaded from <path>/.azureml/<name> or <path>/aml_config/<name>.

save

Save the ReinforcementLearningConfiguration to a file on disk.

A UserErrorException is raised when:

  • The ReinforcementLearningConfiguration can't be saved with the name specified.

  • No name parameter was specified.

  • No path parameter is invalid.

If path is of the format <dir_path>/<file_name> where <dir_path> is a valid directory, then the ReinforcementLearningConfiguration is saved at <dir_path>/<file_name>.

If path points to a directory, which should be a project directory, then the ReinforcementLearningConfiguration is saved at <path>/.azureml/<name> or <path>/aml_config/<name>.

This method is useful when editing the configuration manually or when sharing the configuration with the CLI.

load

Load a previously saved reinforcement learning run configuration file from an on-disk file.

If path points to a file, the ReinforcementLearningConfiguration is loaded from that file.

If path points to a directory, which should be a project directory, then the ReinforcementLearningConfiguration is loaded from <path>/.azureml/<name> or <path>/aml_config/<name>.

static load(path=None, name=None)

Parameters

path
str
default value: None

A user selected root directory for run configurations. Typically this is the Git Repository or the Python project root directory. For backward compatibility, the configuration will also be loaded from .azureml or aml_config sub directory. If the file is not in those directories, the file is loaded from the specified path. Path defaults to current working directory if not provided.

name
str
default value: None

The configuration file name.

Returns

The reinforcement learning run configuration object.

Return type

save

Save the ReinforcementLearningConfiguration to a file on disk.

A UserErrorException is raised when:

  • The ReinforcementLearningConfiguration can't be saved with the name specified.

  • No name parameter was specified.

  • No path parameter is invalid.

If path is of the format <dir_path>/<file_name> where <dir_path> is a valid directory, then the ReinforcementLearningConfiguration is saved at <dir_path>/<file_name>.

If path points to a directory, which should be a project directory, then the ReinforcementLearningConfiguration is saved at <path>/.azureml/<name> or <path>/aml_config/<name>.

This method is useful when editing the configuration manually or when sharing the configuration with the CLI.

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

Parameters

separate_environment_yaml
bool
default value: False

Indicates whether to save the Conda environment configuration. If True, the Conda environment configuration is saved to a YAML file named '_environment.yml'.

path
str
default value: None

A user selected root directory for run configurations. Typically this is the Git Repository or the Python project root directory. The configuration is saved to a sub directory named .azureml.

name
str
default value: None

[Required] The configuration file name.

Return type