TabularPredictor.predict_multi¶
- TabularPredictor.predict_multi(data=None, models: List[str] | None = None, as_pandas: bool = True, transform_features: bool = True, inverse_transform: bool = True, *, decision_threshold: float | None = None) dict [source]¶
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 self.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, the out-of-fold prediction probabilities are used.
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 DataFrame if this is a multiclass problem, otherwise it is a Series. If the output is a DataFrame, the column order will be equivalent to predictor.class_labels.
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 predictor.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
- Return type:
Dictionary with model names as keys and model predictions as values.