TimeSeriesPredictor.predict¶
- TimeSeriesPredictor.predict(data: TimeSeriesDataFrame | DataFrame | Path | str, known_covariates: TimeSeriesDataFrame | DataFrame | Path | str | None = None, model: str | None = None, use_cache: bool = True, random_seed: int | None = 123) TimeSeriesDataFrame[source]¶
- Return quantile and mean forecasts for the given dataset, starting from the end of each time series. - Parameters:
- data (Union[TimeSeriesDataFrame, pd.DataFrame, Path, str]) – - Time series data to forecast with. - If - known_covariates_nameswere specified when creating the predictor,- datamust include the columns listed in- known_covariates_nameswith the covariates values aligned with the target time series.- If - train_dataused to train the predictor contained past covariates or static features, then- datamust also include them (with same column names and dtypes).- If provided data is an instance of pandas DataFrame, AutoGluon will attempt to automatically convert it to a - TimeSeriesDataFrame.
- known_covariates (Union[TimeSeriesDataFrame, pd.DataFrame, Path, str], optional) – - If - known_covariates_nameswere specified when creating the predictor, it is necessary to provide the values of the known covariates for each time series during the forecast horizon. That is:- The columns must include all columns listed in - known_covariates_names
- The - item_idindex must include all item ids present in- data
- The - timestampindex must include the values for- prediction_lengthmany time steps into the future from the end of each time series in- data
 - See example below. 
- model (str, optional) – Name of the model that you would like to use for prediction. By default, the best model during training (with highest validation score) will be used. 
- random_seed (int or None, default = 123) – If provided, fixes the seed of the random number generator for all models. This guarantees reproducible results for most models (except those trained on GPU because of the non-determinism of GPU operations). 
- use_cache (bool, default = True) – If True, will attempt to use the cached predictions. If False, cached predictions will be ignored. This argument is ignored if - cache_predictionswas set to False when creating the- TimeSeriesPredictor.
 
 - Examples - >>> print(data) target promotion price item_id timestamp A 2020-01-05 20 0 19.9 2020-01-06 40 1 9.9 2020-01-07 32 0 15.0 B 2020-03-01 13 0 5.0 2020-03-02 44 1 2.9 2020-03-03 72 1 2.9 >>> predictor = TimeSeriesPredictor(prediction_length=2, known_covariates_names=["promotion", "price"]).fit(data) >>> print(future_known_covariates) promotion price item_id timestamp A 2020-01-08 1 12.9 2020-01-09 1 12.9 B 2020-03-04 0 5.0 2020-03-05 0 7.0 >>> predictor.predict(data, known_covariates=future_known_covariates) mean item_id timestamp A 2020-01-08 30.2 2020-01-09 27.0 B 2020-03-04 17.1 2020-03-05 8.3