predict_multi

TabularPredictor.predict_multi(data: DataFrame = None, models: list[str] = None, as_pandas: Literal[True] = True, transform_features: bool = True, inverse_transform: bool = True, decision_threshold: float = None, model_pred_probas: dict | None = None) dict[str, Series][source]
TabularPredictor.predict_multi(data: DataFrame = None, models: list[str] = None, *, as_pandas: Literal[False], transform_features: bool = True, inverse_transform: bool = True, decision_threshold: float = None, model_pred_probas: dict | None = None) dict[str, ndarray]

Returns a dictionary of predictions where the key is the model name and the value is the model’s prediction probabilities on the data.

Equivalent output to: ``` predict_dict = {} for m in models:

predict_dict[m] = predictor.predict(data, model=m)

```

Note that this will generally be much faster than calling TabularPredictor.predict() separately for each model because this method leverages the model dependency graph to avoid redundant computation.

Parameters:
  • data (DataFrame, default = None) –

    The data to predict on. If None:

    If self.has_val, the validation data is used. Else, prediction is skipped and the out-of-fold (OOF) predictions are returned, equivalent to: ``` predict_dict = {} for m in models:

    predict_dict[m] = predictor.predict_oof(model=m)

    ```

  • models (list[str], default = None) – The list of models to get predictions for. If None, all models that can infer are used.

  • as_pandas (bool, default = True) – Whether to return the output of each model as a pd.Series (True) or np.ndarray (False).

  • transform_features (bool, default = True) –

    If True, preprocesses data before predicting with models. If False, skips global feature preprocessing.

    This is useful to save on inference time if you have already called data = predictor.transform_features(data).

  • inverse_transform (bool, default = True) – If True, will return predictions in the original format. If False (advanced), will return predictions in AutoGluon’s internal format.

  • decision_threshold (float, default = None) – The decision threshold used to convert prediction probabilities to predictions. Only relevant for binary classification, otherwise ignored. If None, defaults to 0.5. Valid values are in the range [0.0, 1.0] You can obtain an optimized decision_threshold by first calling TabularPredictor.calibrate_decision_threshold(). Useful to set for metrics such as balanced_accuracy and f1 as 0.5 is often not an optimal threshold. Predictions are calculated via the following logic on the positive class: 1 if pred > decision_threshold else 0

  • model_pred_probas (dict, optional) – Precomputed prediction probabilities keyed by model name: the output of a previous TabularPredictor.predict_proba_multi() call on the same data (for regression, a previous predict_multi output). Models present here are skipped instead of predicted with again, and their values feed any models that depend on them (e.g. stack ensembles). Probabilities are required because label predictions cannot seed dependent models; the predictions returned for seeded models are derived from the provided probabilities (respecting decision_threshold). Only valid when data is provided. The caller is responsible for the values matching data; row counts are validated, contents cannot be.

Returns:

Dictionary with model names as keys and model predictions as values.

Return type:

dict[str, pd.Series] | dict[str, np.ndarray]