pycaret.time_series.predict_model#
- pycaret.time_series.predict_model(estimator, fh=None, X=None, return_pred_int=False, alpha: float | None = None, coverage: float | List[float] = 0.9, round: int = 4, verbose: bool = True) DataFrame[source]#
This function forecast using a trained model. When
fhis None, it forecasts using the same forecast horizon used during the training.Example
>>> from pycaret.datasets import get_data >>> airline = get_data('airline') >>> from pycaret.time_series import * >>> exp_name = setup(data = airline, fh = 12) >>> arima = create_model('arima') >>> pred_holdout = predict_model(arima) >>> pred_unseen = predict_model(finalize_model(arima), fh = 24)
- estimator: sktime compatible object
Trained model object
- fh: int, default = None
Number of points from the last date of training to forecast. When fh is None, it forecasts using the same forecast horizon used during the training.
- X: pd.DataFrame, default = None
Exogenous Variables to be used for prediction. Before finalizing the estimator, X need not be passed even when the estimator is built using exogenous variables (since this is taken care of internally by using the exogenous variables from test split). When estimator has been finalized and estimator used exogenous variables, then X must be passed.
- return_pred_int: bool, default = False
When set to True, it returns lower bound and upper bound prediction interval, in addition to the point prediction.
- alpha: Optional[float], default = None
The alpha (quantile) value to use for the point predictions. Refer to the “point_alpha” description in the setup docstring for details.
- coverage: Union[float, List[float]], default = 0.9
The coverage to be used for prediction intervals. Refer to the “coverage” description in the setup docstring for details.
- 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