predict

TabularCloudPredictor.predict(test_data: str | DataFrame, test_data_image_column: str | None = None, predictor_path: str | None = None, framework_version: str | None = None, job_name: str | None = None, instance_type: str = 'ml.m5.2xlarge', instance_count: int = 1, custom_image_uri: str | None = None, wait: bool = True, predictions_path: str | None = None, backend_overrides: dict[str, dict[str, Any]] | None = None) → Series | None

Batch inference. When minimizing latency isn’t a concern, then the batch transform functionality may be easier, more scalable, and more appropriate. If you want to minimize latency, deploy an endpoint with deploy() instead.

Parameters:
  • test_data (str | pd.DataFrame) – The test data to be inferenced. Can be a pd.DataFrame, or a local path to a csv.

  • test_data_image_column (str, default = None) – If test_data involves image modality, you must specify the column name corresponding to image paths. The path MUST be an abspath

  • predictor_path (str) – Path to the predictor tarball you want to use to predict. Path can be both a local path or a S3 location. If None, will use the most recent trained predictor trained with fit().

  • framework_version (str, optional) – AutoGluon version, e.g. “1.6”. Inference uses the official AutoGluon DLC image for this version. Defaults to the version used by fit(). If custom_image_uri is set, this argument will be ignored.

  • job_name (str, default = None) – Name of the launched training job. If None, CloudPredictor creates one with a predictor-specific prefix.

  • instance_count (int, default = 1,) – Number of instances used to do batch transform.

  • instance_type (str, default = 'ml.m5.2xlarge') – Instance to be used for batch transform.

  • wait (bool, default = True) – Whether to wait for batch transform to complete. To be noticed, the function won’t return immediately because there are some preparations needed prior transform.

  • predictions_path (str | None, default = None) – S3 prefix under which the batch transform job writes its results (<predictions_path>/<input file>.out). Defaults to {cloud_output_path}/batch_transform/<timestamp>/results.

  • 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: {"CreateTransformJob": {"BatchStrategy": "SingleRecord", "MaxPayloadInMB": 20}}

Returns:

pd.Series | None – Predict results in pd.Series if wait is True None if wait is False

SageMaker API

  • CreateModel: registers the predictor artifact and inference image as a SageMaker model.

  • CreateTransformJob: runs batch inference on instance_count x instance_type. Results are written to predictions_path.

The model is deleted when the job finishes. With wait=False it is kept; delete it with DeleteModel.