Table Of Contents
Table Of Contents

gluonts.model.r_forecast package

class gluonts.model.r_forecast.RForecastPredictor(freq: str, prediction_length: int, method_name: str = 'ets', period: int = None, trunc_length: Optional[int] = None, params: Optional[Dict] = None)[source]

Bases: gluonts.model.predictor.RepresentablePredictor

Wrapper for calling the R forecast package.

The RForecastPredictor is a thin wrapper for calling the R forecast package. In order to use it you need to install R and run:

pip install 'rpy2>=2.9.*,<3.*'
R -e 'install.packages(c("forecast", "nnfor"), repos="")'
  • method – The method from rforecast to be used one of “ets”, “arima”, “tbats”, “croston”, “mlp”.
  • prediction_length – Number of time points to be predicted.
  • freq – The granularity of the time series (e.g. ‘1H’)
  • period – The period to be used (this is called frequency in the R forecast package), result to a tentative reasonable default if not specified (for instance 24 for hourly freq ‘1H’)
  • trunc_length – Maximum history length to feed to the model (some models become slow with very long series).
  • params – Parameters to be used when calling the forecast method default. Note that currently only output_type = ‘samples’ is supported.
predict(dataset: gluonts.dataset.common.Dataset, num_samples: int = 100, save_info: bool = False, **kwargs) → Iterator[gluonts.model.forecast.SampleForecast][source]

Compute forecasts for the time series in the provided dataset. This method is not implemented in this abstract class; please use one of the subclasses.

Parameters:dataset – The dataset containing the time series to predict.
Returns:Iterator over the forecasts, in the same order as the dataset iterable was provided.
Return type:Iterator[Forecast]