commonpower.data_forecasting.forecasters.PersistenceForecaster

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

Bases: Forecaster

This forecaster predicts all future timesteps with the value look_back before, i.e., every value is predicted as the value at time t-look_back.

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).

  • look_back (timedelta, optional) – Look back time to use for predictions. 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)