ModelProxy Class

Note

This is an experimental class, and may change at any time. Please see https://aka.ms/azuremlexperimental for more information.

Proxy object for AutoML models that enables inference on remote compute.

Create an AutoML ModelProxy object to submit inference to the training environment.

Inheritance
builtins.object
ModelProxy

Constructor

ModelProxy(child_run, compute_target=None)

Parameters

Name Description
child_run
Required

The child run from which the model will be downloaded.

compute_target
Required

Overwrite for the target compute to inference on.

Methods

forecast

Submit a job to run forecast on the model for the given values.

forecast_quantiles

Submit a job to run forecast_quantiles on the model for the given values.

predict

Submit a job to run predict on the model for the given values.

predict_proba

Submit a job to run predict_proba on the model for the given values.

test

Retrieve predictions from the test_data and compute relevant metrics.

forecast

Submit a job to run forecast on the model for the given values.

forecast(X_values: Any, y_values: Any | None = None) -> Tuple[AbstractDataset, AbstractDataset]

Parameters

Name Description
X_values
Required

Input test data to run forecast on.

y_values

Input y values to run the forecast on.

Default value: None

Returns

Type Description

The forecast values.

forecast_quantiles

Submit a job to run forecast_quantiles on the model for the given values.

forecast_quantiles(X_values: Any, y_values: Any | None = None, forecast_destination: Any | None = None, ignore_data_errors: bool = False) -> AbstractDataset

Parameters

Name Description
X_values
Required

Input test data to run forecast on.

y_values

Input y values to run the forecast on.

Default value: None
forecast_destination
<xref:pandas.Timestamp>

Forecast_destination: a time-stamp value. Forecasts will be made all the way to the forecast_destination time, for all grains. Dictionary input { grain -> timestamp } will not be accepted. If forecast_destination is not given, it will be imputed as the last time occurring in X_pred for every grain.

Default value: None
ignore_data_errors

Ignore errors in user data.

Default value: False

predict

Submit a job to run predict on the model for the given values.

predict(values: Any) -> AbstractDataset

Parameters

Name Description
values
Required

Input test data to run predict on.

Returns

Type Description

The predicted values.

predict_proba

Submit a job to run predict_proba on the model for the given values.

predict_proba(values: Any) -> AbstractDataset

Parameters

Name Description
values
Required

Input test data to run predict on.

Returns

Type Description

The predicted values.

test

Retrieve predictions from the test_data and compute relevant metrics.

test(test_data: AbstractDataset, include_predictions_only: bool = False) -> Tuple[AbstractDataset, Dict[str, Any]]

Parameters

Name Description
test_data
Required

The test dataset.

include_predictions_only

Whether or not to only include the predictions as part of the predictions.csv output.

If this parameter is True then the output CSV columns look like (forecasting is the same as regression):

Classification => [predicted values], [probabilities]

Regression => [predicted values]

else (default):

Classification => [original test data labels], [predicted values], [probabilities], [features]

Regression => [original test data labels], [predicted values], [features]

The [original test data labels] column name = [label column name] + "_orig".

The [predicted values] column name = [label column name] + "_predicted".

The [probabilities] column names = [class name] + "_predicted_proba".

The [features] column names = [feature column name] + "_orig".

If the test_data does not include a target column then [original test data labels] will not be in the output dataframe.

Default value: False

Returns

Type Description

A tuple containing the predicted values and the metrics.