gloria.Gloria.predict#

Gloria.predict(data=None, toml_path=None, **kwargs)[source]#

Generate forecasts from a fitted Gloria model.

Two usage patterns are supported:

  1. Explicit input dataframe - data contains future (or historical) timestamps plus any required external-regressor columns.

  2. Auto-generated future dataframe - leave data as None and supply the helper kwargs periods and/or include_history. This shortcut only works when the model has no external regressors.

Parameters:
  • data (Optional[pd.DataFrame], optional) – A pandas DataFrame containing timestamp and metric columns named according to self.timestamp_name and self.metric_name, respectively. If external regressors were added to the model, the respective columns must be present as well. If None, a future dataframe is produced with make_future_dataframe().

  • toml_path (Optional[Union[str, Path]], optional) – Path to a TOML file whose [predict] section should be merged into the configuration. Ignored when None.

  • periods (int) – Number of future steps to generate. Must be a positive integer. Measured in units of``self.sampling_period``. The default is 1.

  • include_history (bool, optional) – If True (default), the returned frame includes the historical dates that wereseen during fitting; if False it contains only the future portion.

  • self (Self)

  • kwargs (dict[str, Any])

Returns:

prediction – A dataframe containing timestamps, predicted metric, trend, and lower and upper bounds.

Return type:

pd.DataFrame

Notes

The configuration of the predict method via periods and include is composed in four layers, each one overriding the previous:

  1. Model defaults - the baseline configuration with defaults given above.

  2. Global TOML file - key-value pairs in the [predict] table of the TOML file passed to Gloria.from_toml() if the current Gloria instance was created this way.

  3. Local TOML file - key-value pairs in the [predict] table of the TOML file provided for toml_path.

  4. Keyword overrides - additional arguments supplied directly to the method take highest precedence.