predict_proba_multi

TabularPredictor.predict_proba_multi(data: DataFrame = None, models: list[str] = None, as_pandas: bool = True, as_multiclass: bool = True, transform_features: bool = True, inverse_transform: bool = True, model_pred_probas: dict | None = None) dict[str, DataFrame] | dict[str, Series] | dict[str, ndarray][source]

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

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

predict_proba_dict[m] = predictor.predict_proba(data, model=m)

```

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

Parameters:
  • data (str or 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) prediction probabilities are returned, equivalent to: ``` predict_proba_dict = {} for m in models:

    predict_proba_dict[m] = predictor.predict_proba_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 pandas object (True) or numpy array (False). Pandas object is a pd.DataFrame if this is a multiclass problem or as_multiclass=True, otherwise it is a pd.Series. If the output is a pd.DataFrame, the column order will be equivalent to predictor.classes_.

  • as_multiclass (bool, default = True) –

    Whether to return binary classification probabilities as if they were for multiclass classification.

    Output will contain two columns, and if as_pandas=True, the column names will correspond to the binary class labels. The columns will be the same order as predictor.class_labels.

    If False, output will contain only 1 column for the positive class (get positive_class name via predictor.positive_class). Only impacts output for binary classification problems.

  • 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 prediction probabilities in the original format. If False (advanced), will return prediction probabilities in AutoGluon’s internal format.

  • model_pred_probas (dict, optional) – Precomputed prediction probabilities keyed by model name, in the format this method returns (i.e. the output of a previous predict_proba_multi call on the same data with the same as_multiclass and inverse_transform settings). Models present here are skipped instead of predicted with again, and their values feed any models that depend on them (e.g. stack ensembles). This makes repeated inference cheap when models are added after an initial prediction pass: ` pred_probas = predictor.predict_proba_multi(data)         # predicts every model once predictor.fit_extra(..., base_model_names=...)            # adds a stacker pred_probas = predictor.predict_proba_multi(data, model_pred_probas=pred_probas) # only the new stacker is predicted with; base model predictions are reused ` 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 prediction probabilities as values.

Return type:

dict