fit_predict_proba

TabularCloudPredictor.fit_predict_proba(train_data: str | Path | DataFrame, test_data: str | Path | DataFrame, *, predictor_init_args: Dict[str, Any], predictor_fit_args: Dict[str, Any] | None = None, include_predict: bool = True, leaderboard: bool = True, framework_version: str = 'latest', job_name: str | None = None, instance_type: str = 'ml.m5.2xlarge', instance_count: int = 1, volume_size: int = 256, custom_image_uri: str | None = None, wait: bool = True, predictions_path: str | None = None, backend_kwargs: Dict | None = None) Tuple[Series, DataFrame | Series] | DataFrame | Series | None[source]

Fit and predict probabilities in a single SageMaker training job.

Identical to fit_predict() but returns class probabilities. For regression the probabilities are identical to the predictions (same as predict_proba()).

Parameters:
  • train_data (Union[str, pathlib.Path, pd.DataFrame]) – Training data, as a DataFrame or local/S3 path to a data file.

  • test_data (Union[str, pathlib.Path, pd.DataFrame]) – Data to predict on. Must contain every feature column present in train_data.

  • predictor_init_args (dict) – Init args for the predictor.

  • predictor_fit_args (Optional[dict], default = None) – Additional fit args forwarded to TabularPredictor.fit().

  • include_predict (bool, default = True) – Whether to return the predictions along with the probabilities. Comes for free — the job always computes both.

  • leaderboard (bool, default = True) – Whether to include the leaderboard in the output artifact.

  • framework_version (str, default = latest) – Training container version of autogluon. If custom_image_uri is set, this argument is ignored.

  • job_name (str, default = None) – Name of the launched training job. If None, CloudPredictor will create one with prefix ag-cloudpredictor.

  • instance_type (str, default = 'ml.m5.2xlarge') – Instance type the predictor will be trained on with SageMaker.

  • instance_count (int, default = 1) – Number of instances used to fit the predictor.

  • volume_size (int, default = 256) – Size in GB of the EBS volume to use for storing input data during training.

  • custom_image_uri (Optional[str], default = None) – Custom container image URI. If set, framework_version is ignored.

  • wait (bool, default = True) – Whether the call should wait until the job completes.

  • predictions_path (Optional[str]) – S3 URL where predictions will be written by the training container. Defaults to {cloud_output_path}/{job_name}/predictions.csv.

  • backend_kwargs (Optional[dict], default = None) – Backend-specific arguments. Same keys as fit().

Returns:

If include_predict is True, returns (prediction, predict_probability); otherwise just predict_probability. Returns None when wait is False; fetch later via get_fit_predict_proba_results().

Return type:

Optional[Union[Tuple[pd.Series, Union[pd.DataFrame, pd.Series]], Union[pd.DataFrame, pd.Series]]]