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

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

X_values
AbstractDataset or DataFrame or ndarray
Required

Input test data to run forecast on.

y_values
AbstractDataset or DataFrame or ndarray
default value: None

Input y values to run the forecast on.

Returns

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

X_values
AbstractDataset
Required

Input test data to run forecast on.

y_values
default value: None

Input y values to run the forecast on.

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

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.

ignore_data_errors
bool
default value: False

Ignore errors in user data.

predict

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

predict(values: Any) -> AbstractDataset

Parameters

values
AbstractDataset or DataFrame or ndarray
Required

Input test data to run predict on.

Returns

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

values
AbstractDataset or DataFrame or ndarray
Required

Input test data to run predict on.

Returns

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

test_data
Required

The test dataset.

include_predictions_only
default value: False

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.

Returns

A tuple containing the predicted values and the metrics.