TrainingOutput Class

Defines a specialized output of certain PipelineSteps for use in a pipeline.

TrainingOutput enables an automated machine learning metric or model to be made available as a step output to be consumed by another step in an Azure Machine Learning Pipeline. Can be used with AutoMLStep or HyperDriveStep.

Initialize TrainingOutput.

param model_file: The specific model file to be included in the output. For HyperDriveStep only.

Inheritance
builtins.object
TrainingOutput

Constructor

TrainingOutput(type, iteration=None, metric=None, model_file=None)

Parameters

Name Description
type
Required
str

The type of training output. Possible values include: 'Metrics', 'Model'.

iteration
int

The iteration number of the correspond training model. This iteration number can be provided only with type 'Model'. Provide either the iteration parameter or the metric parameter, but not both.

Default value: None
metric
str

The metric to use to return the best training model. The metric can be provided only with type 'Model'. Provide either the iteration parameter or the metric parameter, but not both.

Default value: None
model_file
str

The specific model file to be included in the output. For HyperDriveStep only.

Default value: None
type
Required
str

The type of training output. Possible values include: 'Metrics', 'Model'.

iteration
Required
int

The iteration number of the correspond training model. This iteration number can be provided only with type 'Model'. Provide either the iteration parameter or the metric parameter, but not both.

metric
Required
str

The metric to use to return the best training model. The metric can be provided only with type 'Model'. Provide either the iteration parameter or the metric parameter, but not both.

Remarks

TrainingOutput is used with PipelineData when constructing a Pipeline to enable other steps to consume the metrics or models generated by an AutoMLStep or HyperDriveStep.

Use TrainingOutput when defining an AutoMLStep as follows:


   from azureml.pipeline.core import PipelineData, TrainingOutput

   metrics_data = PipelineData(name='metrics_data', datastore=ds,
                                pipeline_output_name='metrics_output',
                                training_output=TrainingOutput(type='Metrics'))
   model_data = PipelineData(name='model_data', datastore=ds,
                             pipeline_output_name='best_model_output',
                             training_output=TrainingOutput(type='Model'))
   automl_step = AutoMLStep(name='automl_step',
                            automl_config=automl_config,
                            inputs=[input_data],
                            outputs=[metrics_data, model_data])

See an example of using TrainingOutput and an AutoMlStep step in the notebook https://aka.ms/pl-automl.

Attributes

iteration

Get the iteration number of the correspond training model.

Returns

Type Description
int

The iteration number for training model.

metric

Get the metric for best training model.

Returns

Type Description
str

The metric name for the best training model.

model_file

Get a model file to be included in the output for the best training model.

Returns

Type Description
str

A particular file to be included in the output of the best training model.

type

Get the type of training output.

Returns

Type Description
str

Type of training output. Possible values include: 'Metrics', 'Model'.