gloria.Gloria.predict#
- Gloria.predict(data=None, toml_path=None, **kwargs)[source]#
Generate forecasts from a fitted
Gloria
model.Two usage patterns are supported:
Explicit input dataframe -
data
contains future (or historical) timestamps plus any required external-regressor columns.Auto-generated future dataframe - leave
data
asNone
and supply the helper kwargsperiods
and/orinclude_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
andself.metric_name
, respectively. If external regressors were added to the model, the respective columns must be present as well. IfNone
, a future dataframe is produced withmake_future_dataframe()
.toml_path (Optional[Union[str, Path]], optional) – Path to a TOML file whose
[predict]
section should be merged into the configuration. Ignored whenNone
.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; ifFalse
it contains only the future portion.self (Self)
- 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
andinclude
is composed in four layers, each one overriding the previous:Model defaults - the baseline configuration with defaults given above.
Global TOML file - key-value pairs in the
[predict]
table of the TOML file passed toGloria.from_toml()
if the current Gloria instance was created this way.Local TOML file - key-value pairs in the
[predict]
table of the TOML file provided fortoml_path
.Keyword overrides - additional arguments supplied directly to the method take highest precedence.