commonpower.data_forecasting.forecasters.LookBackForecaster

class LookBackForecaster(frequency: timedelta = datetime.timedelta(seconds=3600), horizon: timedelta = datetime.timedelta(days=1))[source]

Bases: Forecaster

This forecaster predicts the last timestep of the horizon as the “current” value. Every timestep t until then is predicted as the value at time t-horizon.

Parameters:
  • frequency (timedelta, optional) – Frequency of generated forecasts. Defaults to timedelta(hours=1).

  • horizon (timedelta, optional) – Horizon to generate forecasts for. Defaults to timedelta(hours=24).

Methods

Attributes

input_range

Returns the min and max timedelta of observations which are required for the prediction.

is_uncertain

__call__(data: ndarray) ndarray[source]

Returns the forecast based on this data.

Parameters:

data (np.ndarray) – Data to use for the forecast.

Returns:

np.ndarray – Forecast of shape (n_horizon, n_vars)