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', custom_image_uri: str | None = None, wait: bool = True, **backend_kwargs) → DataFrame | JobPredictionFuture[source]

Run batch prediction for time series.

Parameters:
  • data (str | Path | pd.DataFrame) – Historical time series to forecast from, in long format, as a pd.DataFrame or local/S3 path to a data file. See the TimeSeriesPredictor docs for the expected format.

  • target (str, default = "target") – Name of the column that contains the target values to forecast.

  • id_column (str, default = "item_id") – Name of the column with the unique identifier of each time series (item).

  • 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. Covariate column names are inferred from the columns (excluding id_column and timestamp_column).

  • static_features (str | Path | pd.DataFrame | None, default = None) – Static (time-independent) features describing each individual time series.

  • prediction_length (int, default = 1) – Forecast horizon: how many time steps into the future the model should predict.

  • quantile_levels (list[float] | None, default = None) – List of increasing decimals between 0 and 1 specifying which quantiles to estimate. Defaults to [0.1, 0.2, ..., 0.9].

  • predictions_path (str | None, default = None) – S3 URL where predictions will be written by the prediction job (e.g. s3://my-bucket/runs/2024-05-01/predictions.csv). The container’s SageMaker execution role must have s3:PutObject permission for this location. Defaults to {cloud_output_path}/{job_name}/predictions.csv. Predictions use AutoGluon’s canonical column names item_id and timestamp, regardless of the id_column / timestamp_column passed in.

  • 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. If None, uses registry default.

  • framework_version (str, default = "1.6") – AutoGluon version, e.g. “1.6”. Uses the official AutoGluon DLC image for this version.

  • custom_image_uri (str | None, default = None) – Custom Docker image URI for the container.

  • wait (bool, default = True) – If True, block and return a pd.DataFrame. If False, return a JobPredictionFuture immediately — call .result() on it later to retrieve the pd.DataFrame, or .status() to check progress.

  • **backend_kwargs (Any) –

    Additional SageMaker arguments:

    • job_name: Name of the training job that runs the prediction. Auto-generated if not set.

    • volume_size: Size in GB of the storage volume to use for the job. Defaults to 100.

    • backend_overrides: 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}}}

Returns:

pd.DataFrame | JobPredictionFuture – pd.DataFrame if wait=True; a JobPredictionFuture otherwise.

SageMaker API

  • CreateTrainingJob: runs the prediction as a training job (not a batch transform job) on instance_type. Predictions are written to predictions_path.