predict¶
- TimeSeriesFoundationModel.predict(data: str | Path | DataFrame, *, target: str = 'target', id_column: str = 'item_id', timestamp_column: str = 'timestamp', known_covariates: str | Path | DataFrame | None = None, static_features: str | Path | DataFrame | None = None, prediction_length: int = 1, quantile_levels: list[float] | None = None, predictions_path: str | None = None, hyperparameters: dict[str, Any] | None = None, instance_type: str | None = None, framework_version: str = '1.6', wait: bool = True, backend_overrides: dict[str, dict[str, Any]] | None = None, **kwargs: Unpack[TrainingJobKwargs]) DataFrame | JobPredictionFuture[source]¶
Forecast the future values of
datain a one-off SageMaker job.- Parameters:
data (str | Path | pd.DataFrame) – Historical time series to forecast from, in long format, as a
pd.DataFrameor local/S3 path to a data file. See the TimeSeriesPredictor docs for the expected format.target (str, default = "target") – Name of the column with the values to forecast.
id_column (str, default = "item_id") – Name of the column with the ID of each time series.
timestamp_column (str, default = "timestamp") – Name of the column with the observation timestamps.
known_covariates (str | Path | pd.DataFrame | None, default = None) – Future values of the known covariates over the forecast horizon. All columns except
id_columnandtimestamp_columnare used as known covariates.static_features (str | Path | pd.DataFrame | None, default = None) – Static (time-independent) features describing each individual time series.
prediction_length (int, default = 1) – Number of time steps to forecast.
quantile_levels (list[float] | None, default = None) – Quantiles to forecast, as floats between 0 and 1. Defaults to
[0.1, 0.2, ..., 0.9].predictions_path (str | None, default = None) – S3 URL ending in
.csvor.parquetwhere the job writes the predictions, e.g.s3://my-bucket/predictions.csv. The SageMaker execution role needss3:PutObjectpermission for it. Defaults to{cloud_output_path}/{job_name}/predictions.csv. The predictions always use the column namesitem_idandtimestamp, regardless ofid_columnandtimestamp_column.hyperparameters (dict[str, Any] | None, default = None) – Model hyperparameters for inference. Overrides values passed to the constructor.
instance_type (str | None, default = None) – Instance type for the prediction job. Defaults to the model registry value.
framework_version (str, optional) – AutoGluon version, e.g. “1.6”. Uses the official AutoGluon DLC image for this version.
wait (bool, default = True) – If True, block until the job completes and return the forecasts. If False, return a
JobPredictionFutureimmediately; call its.status()to check progress and.result()to get the forecasts.
- Returns:
pd.DataFrame | JobPredictionFuture – Forecasts with
item_idandtimestampcolumns, ameancolumn, and one column per quantile level ifwait=True; aJobPredictionFutureotherwise.- Other Parameters:
backend_overrides (dict[str, dict[str, Any]] | None, default = None) – Raw SageMaker request fields for settings without a dedicated argument.
Keys: request names from the SageMaker API section below.
Values: request fields in PascalCase, as in the SageMaker API and boto3. Deep-merged over the request built by AutoGluon-Cloud; lists and other non-dict values replace the generated ones.
Example:
{"CreateTrainingJob": {"RetryStrategy": {"MaximumRetryAttempts": 2}}}
job_name (str | None, default = None) – Name of the training job that runs the prediction. Auto-generated if not set.
volume_size (int, default = 100) – Size in GB of the storage volume to use for the job.
custom_image_uri (str | None, default = None) – Custom container image URI. If set,
framework_versionis ignored.timeout (int, default = 86400) – Maximum job runtime in seconds. Defaults to 24 hours.
SageMaker API
CreateTrainingJob: runs the prediction as a training job (not a batch transform job) on
instance_type. Predictions are written topredictions_path.