commonpower.data_forecasting.forecasters.NoisyForecaster

class NoisyForecaster(frequency: timedelta = datetime.timedelta(seconds=3600), horizon: timedelta = datetime.timedelta(days=1), noise_bounds: float | list[float] = [-0.1, 0.1], k: int = 1, window_size: int = 3)[source]

Bases: Forecaster

This forecaster knows the true future values but applies a uniformly random noise to it. This means all time steps in the prediction horizon must be present in the data source.

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

  • noise_bounds (Union[float, list[float]], optional) – Lower and upper relative noise bounds. Defaults to [-0.1, 0.1].

  • k (int, optional) – Number of times to apply a moving average smoothing. Defaults to 1.

  • window_size (int, optional) – Window size for the moving average smoothing. Defaults to 3.

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)

property input_range: tuple[timedelta]

Returns the min and max timedelta of observations which are required for the prediction. To indicate a timestamp before the current time, the timedelta must be negative. The default is (-self.look_back, 0).

Returns:

tuple[timedelta] – (td before, td after)