AutoMLRun class

Definition

AutoMLRun has information of the experiment runs that correspond to the AutoML run.

This class can be used to manage, check status, and retrieve run details once a AutoML run is submitted.

AutoMLRun(experiment, run_id, **kwargs)
Inheritance
azureml._run_impl.run_base._RunBase
AutoMLRun

Parameters

experiment

The experiment associated to the run.

run_id
str

The id associated to the run.

Methods

cancel()

Cancel an AutoML run.

Return True if the AutoML run is canceled successfully.

cancel_iteration(iteration)

Cancel a particular child run.

continue_experiment(X=None, y=None, sample_weight=None, X_valid=None, y_valid=None, sample_weight_valid=None, data=None, label=None, columns=None, cv_splits_indices=None, spark_context=None, experiment_timeout_hours=None, experiment_exit_score=None, iterations=None, show_output=False, training_data=None, validation_data=None, **kwargs)

Continue an existing AutoML Experiment.

get_guardrails(to_console: bool = True) -> typing.Dict[str, typing.Any]

Print and returns detailed results from running Guardrail verification.

get_output(iteration: typing.Union[int, NoneType] = None, metric: typing.Union[str, NoneType] = None, return_onnx_model: bool = False, return_split_onnx_model: typing.Union[azureml.automl.core.onnx_convert.onnx_convert_constants.SplitOnnxModelName, NoneType] = None, **kwargs: typing.Any) -> typing.Tuple[_ForwardRef('AutoMLRun'), typing.Any]

Return the run and corresponding best pipeline that has already been tested.

If no input is provided get_output will return the best pipeline according to the primary metric. Alternatively, you can use either iteration or metric to retrieve a particular iteration or the best run per provided metric (respectively).

If you'd like to inspect the preprocessor(s) and algorithm (estimator) used, you can do so through Model.steps, similar to sklearn.pipeline.Pipeline.steps. For instance, the code below shows how to retrieve the estimator.


   best_run, model = parent_run.get_output()
   estimator = model.steps[-1]
get_run_sdk_dependencies(iteration=None, check_versions=True, **kwargs)

Get the SDK run dependencies for a given run.

pause()

Return True if the AutoML run is paused successfully.

register_model(model_name=None, description=None, tags=None, iteration=None, metric=None)

Register the model with AzureML ACI service.

resume()

Return True if the AutoML run is resumed successfully.

retry()

Return True if the AutoML run is retried successfully.

summary()

Get a table containing a summary of algorithms attempted and their scores.

wait_for_completion(show_output=False, wait_post_processing=False)

Wait for the completion of this run.

Returns the status object after the wait.

cancel()

Cancel an AutoML run.

Return True if the AutoML run is canceled successfully.

cancel()

Returns

None

cancel_iteration(iteration)

Cancel a particular child run.

cancel_iteration(iteration)

Parameters

iteration
int

Which iteration to cancel.

Returns

None

continue_experiment(X=None, y=None, sample_weight=None, X_valid=None, y_valid=None, sample_weight_valid=None, data=None, label=None, columns=None, cv_splits_indices=None, spark_context=None, experiment_timeout_hours=None, experiment_exit_score=None, iterations=None, show_output=False, training_data=None, validation_data=None, **kwargs)

Continue an existing AutoML Experiment.

continue_experiment(X=None, y=None, sample_weight=None, X_valid=None, y_valid=None, sample_weight_valid=None, data=None, label=None, columns=None, cv_splits_indices=None, spark_context=None, experiment_timeout_hours=None, experiment_exit_score=None, iterations=None, show_output=False, training_data=None, validation_data=None, **kwargs)

Parameters

X
DataFrame or ndarray or Dataflow

Training features.

default value: None
y
DataFrame or ndarray or Dataflow

Training labels.

default value: None
sample_weight
pandas.DataFrame pr numpy.ndarray or Dataflow

Sample weights for training data.

default value: None
X_valid
DataFrame or ndarray or Dataflow

validation features.

default value: None
y_valid
DataFrame or ndarray or Dataflow

validation labels.

default value: None
sample_weight_valid
DataFrame or ndarray or Dataflow

validation set sample weights.

default value: None
data
DataFrame

Training features and label.

default value: None
label
str

Label column in data.

default value: None
columns
list(str)

whitelist of columns in data to use as features.

default value: None
cv_splits_indices
ndarray

Indices where to split training data for cross validation. Each row is a separate cross fold and within each crossfold, provide 2 arrays, the first with the indices for samples to use for training data and the second with the indices to use for validation data. i.e [[t1, v1], [t2, v2], ...] where t1 is the training indices for the first cross fold and v1 is the validation indices for the first cross fold.

default value: None
spark_context
SparkContext

Spark context, only applicable when used inside azure databricks/spark environment.

default value: None
experiment_timeout_hours
float

How many additional hours to run for this experiment for.

default value: None
experiment_exit_score
int

Terminates the experiment when this score is reached.

default value: None
iterations
int

How many additional iterations to run for this experiment.

default value: None
show_output
bool

Flag whether to print output to console.

default value: False
training_data
Dataflow or DataFrame

Input training data.

default value: None
validation_data
Dataflow or DataFrame

Validation data.

default value: None

Returns

AutoML parent run.

Return type

get_guardrails(to_console: bool = True) -> typing.Dict[str, typing.Any]

Print and returns detailed results from running Guardrail verification.

get_guardrails(to_console: bool = True) -> typing.Dict[str, typing.Any]

get_output(iteration: typing.Union[int, NoneType] = None, metric: typing.Union[str, NoneType] = None, return_onnx_model: bool = False, return_split_onnx_model: typing.Union[azureml.automl.core.onnx_convert.onnx_convert_constants.SplitOnnxModelName, NoneType] = None, **kwargs: typing.Any) -> typing.Tuple[_ForwardRef('AutoMLRun'), typing.Any]

Return the run and corresponding best pipeline that has already been tested.

If no input is provided get_output will return the best pipeline according to the primary metric. Alternatively, you can use either iteration or metric to retrieve a particular iteration or the best run per provided metric (respectively).

If you'd like to inspect the preprocessor(s) and algorithm (estimator) used, you can do so through Model.steps, similar to sklearn.pipeline.Pipeline.steps. For instance, the code below shows how to retrieve the estimator.


   best_run, model = parent_run.get_output()
   estimator = model.steps[-1]
get_output(iteration: typing.Union[int, NoneType] = None, metric: typing.Union[str, NoneType] = None, return_onnx_model: bool = False, return_split_onnx_model: typing.Union[azureml.automl.core.onnx_convert.onnx_convert_constants.SplitOnnxModelName, NoneType] = None, **kwargs: typing.Any) -> typing.Tuple[_ForwardRef('AutoMLRun'), typing.Any]

Parameters

iteration
int

The iteration number of the corresponding run and fitted model to return.

metric
bool

The metric to use to when selecting the best run and fitted model to return.

return_onnx_model

This method will return the converted ONNX model, if user indicated the enable_onnx_compatible_models config.

Returns

The run, the corresponding fitted model.

Return type

Run, Model

get_run_sdk_dependencies(iteration=None, check_versions=True, **kwargs)

Get the SDK run dependencies for a given run.

get_run_sdk_dependencies(iteration=None, check_versions=True, **kwargs)

Parameters

iteration
int

The iteration number of the fitted run that going to be retrieved. If None, retrieve the parent environment.

default value: None
check_versions
bool

If True, check the versions with current env. If False, pass.

default value: True

Returns

The dict of dependencies from those retrieved from RunHistory.

Return type

pause()

Return True if the AutoML run is paused successfully.

pause()

register_model(model_name=None, description=None, tags=None, iteration=None, metric=None)

Register the model with AzureML ACI service.

register_model(model_name=None, description=None, tags=None, iteration=None, metric=None)

Parameters

model_name
str

Name of the model being deployed.

default value: None
description
str

Description for the model being deployed.

default value: None
tags
dict

Tags for the model being deployed.

default value: None
iteration
int

Override for which model to deploy. Deploys the model for a given iteration.

default value: None
metric
str

Override for which model to deploy. Deploys the best model for a different metric.

default value: None

Returns

The registered model object.

Return type

Model

resume()

Return True if the AutoML run is resumed successfully.

resume()

retry()

Return True if the AutoML run is retried successfully.

retry()

summary()

Get a table containing a summary of algorithms attempted and their scores.

summary()

Returns

Pandas DataFrame containing AutoML model statistics.

Return type

wait_for_completion(show_output=False, wait_post_processing=False)

Wait for the completion of this run.

Returns the status object after the wait.

wait_for_completion(show_output=False, wait_post_processing=False)

Parameters

show_output
bool

show_output=True shows the run output on sys.stdout.

default value: False
wait_post_processing
bool

wait_post_processing=True waits for the post processing to complete after the run completes.

default value: False

Returns

The status object.

Return type

Attributes

run_id

Return run id of the current run.

Returns

run id of the current run.

Return type

str

local_model_path

local_model_path = 'model.pkl'

local_onnx_model_path

local_onnx_model_path = 'model.onnx'