flexmeasures.data.models.forecasting.custom_models.base_model
Classes
- class flexmeasures.data.models.forecasting.custom_models.base_model.BaseModel(max_forecast_horizon: int, probabilistic: bool, auto_regressive: bool, use_past_covariates: bool, use_future_covariates: bool, ensure_positive: bool = False, *args, **kwargs)
Base model for multi-horizon forecasting.
This class serves as a foundation for forecasting models that predict multiple time steps into the future. It supports probabilistic forecasting.
Design principles for forecasting pipeline: - This design follows the fixed viewpoint forecasting paradigm: each forecasting cycle retrains
the model(s) on an extended training window, then generates predictions.
A cycle consists of training on a chosen window of historical data (the train period), followed by generating forecasts over the predict period.
self.models typically stores one model per forecast horizon, so that each step into the future can be predicted independently. This is why a dependency exists between self.max_forecast_horizon and the number of models.
Each model must implement both fit() and predict().
self._setup() is called during initialization to prepare these models (subclasses must implement it).
Parameters are validated by ForecasterParametersSchema, which is also a good place to learn more about configuration and expected inputs.
- Attributes:
max_forecast_horizon (int): Maximum forecast horizon, indicating the number of steps ahead to predict. probabilistic (bool): Whether the model produces probabilistic forecasts.
- Note:
Predictions from this model (or its subclasses) will never yield negative values if ensure_positive=True, as any negative predictions are automatically set to zero.