gloria.Gloria.predict#
- Gloria.predict(data=None, toml_path=None, **kwargs)[source]#
Generate forecasts from a fitted
Gloriamodel.Two usage patterns are supported:
Explicit input dataframe -
datacontains future (or historical) timestamps plus any required external-regressor columns.Auto-generated future dataframe - leave
dataasNoneand supply the helper kwargsperiodsand/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_nameandself.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; ifFalseit 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
periodsandincludeis 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.