get_forecaster#
- pymgrid.forecast.get_forecaster(forecaster, observation_space, forecast_shape, time_series=None, increase_uncertainty=False, relative_noise=False)[source]#
Get the forecasting function for the time series module.
Parameters#
- forecastercallable, float, “oracle”, or None, default None.
Function that gives a forecast n-steps ahead.
If
callable, must take as arguments(val_c: float, val_{c+n}: float, n: int), whereval_cis the current value in the time series:self.time_series[self.current_step]val_{c+n}is the value in the time series n steps in the futuren is the number of steps in the future at which we are forecasting.
The output
forecast = forecaster(val_c, val_{c+n}, n)must have the same sign as the inputsval_candval_{c+n}.If
float, serves as a standard deviation for a mean-zero gaussian noise function that is added to the true value.If
"oracle", gives a perfect forecast.If
None, no forecast.
- forecast_shapeint or tuple of int
Expected shape of forecasts. If an integer, will return forecasts of shape (shape, 1).
- observation_space
ModuleSpace Observation space; used to determine values to pad missing forecasts when we are forecasting past the end of the time series.
- time_series: ndarray[float] or None, default None.
The underlying time series.
If
callable(forecaster), used to validateUserDefinedForecaster.If
forecasteris numeric andrelative_noiseis true, the noise standard deviation will be defined relative to the mean of the time series.
- increase_uncertaintybool, default False
Whether to increase uncertainty for farther-out dates if using
GaussianNoiseForecaster. Ignored otherwise.- relative_noisebool, default False
Whether to define noise standard deviation relative to mean of time series if using
GaussianNoiseForecaster. Ignored otherwise.
Returns#
- forecaster
Forecaster The forecasting function.