pycaret.regression.predict_model#
- pycaret.regression.predict_model(estimator, data: DataFrame | None = None, round: int = 4, verbose: bool = True) DataFrame[source]#
This function predicts
Labelusing a trained model. Whendatais None, it predicts label on the holdout set.Example
>>> from pycaret.datasets import get_data >>> boston = get_data('boston') >>> from pycaret.regression import * >>> exp_name = setup(data = boston, target = 'medv') >>> lr = create_model('lr') >>> pred_holdout = predict_model(lr) >>> pred_unseen = predict_model(lr, data = unseen_dataframe)
- estimator: scikit-learn compatible object
Trained model object
- datapandas.DataFrame
Shape (n_samples, n_features). All features used during training must be available in the unseen dataset.
- round: int, default = 4
Number of decimal places to round predictions to.
- verbose: bool, default = True
When set to False, holdout score grid is not printed.
- Returns:
pandas.DataFrame
Warning
The behavior of the
predict_modelis changed in version 2.1 without backward compatibility. As such, the pipelines trained using the version (<= 2.0), may not work for inference with version >= 2.1. You can either retrain your models with a newer version or downgrade the version for inference.