class_docstr: Wrapper for calling the `R forecast package
  <http://pkg.robjhyndman.com/forecast/>`_.
  
  In order to use it you need to install R and rpy2. You also need the R `forecast` package which
  can be installed by running:
  
      R -e 'install.packages(c("forecast", "nnfor"), repos="https://cloud.r-project.org")' # noqa
  
  Parameters
  ----------
  freq
      The granularity of the time series (e.g. '1H')
  prediction_length
      Number of time points to be predicted.
  method_name
      The method from rforecast to be used one of
      "ets", "arima", "tbats", "croston", "mlp", "thetaf".
  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.
      For `output_type`, 'mean' and `quantiles` are supported (depending
      on the underlying R method).
class_docstr_tok: ["Wrapper","for","calling","the","`","R","forecast","package","<","http",":","\/\/pkg.robjhyndman.com\/forecast\/",">","`","_",".","In","order","to","use","it","you","need","to","install","R","and","rpy2",".","You","also","need","the","R","`","forecast","`","package","which","can","be","installed","by","running",":","R","-e","'install.packages","(","c","(","``","forecast","''",",","``","nnfor","''",")",",","repos=","''","https",":","\/\/cloud.r-project.org","''",")","'","#","noqa","Parameters","--","--","--","--","--","freq","The","granularity","of","the","time","series","(","e.g",".","'1H","'",")","prediction_length","Number","of","time","points","to","be","predicted",".","method_name","The","method","from","rforecast","to","be","used","one","of","``","ets","''",",","``","arima","''",",","``","tbats","''",",","``","croston","''",",","``","mlp","''",",","``","thetaf","''",".","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",".","For","`","output_type","`",",","'mean","'","and","`","quantiles","`","are","supported","(","depending","on","the","underlying","R","method",")","."]
code: def _forecast_dict_to_obj(
      self,
      forecast_dict: Dict,
      forecast_start_date: pd.Timestamp,
      item_id: Optional[str],
      info: Optional[Dict],
  ) -> QuantileForecast:
      stats_dict = {"mean": forecast_dict["mean"]}
  
      if "quantiles" in forecast_dict:
          stats_dict.update(forecast_dict["quantiles"])
  
      forecast_arrays = np.array(list(stats_dict.values()))
  
      assert forecast_arrays.shape[1] == self.prediction_length
  
      return QuantileForecast(
          forecast_arrays=forecast_arrays,
          forecast_keys=list(stats_dict.keys()),
          start_date=forecast_start_date,
          item_id=item_id,
          info=info,
      )
  
file_path: gluonts/src/gluonts/ext/r_forecast/_univariate_predictor.py
imports: from typing import Dict, Optional, Any
  import numpy
  import pandas
  from gluonts.core.component import validated
  from gluonts.model.forecast import QuantileForecast
  from .None import RBasePredictor
  from .util import unlist, quantile_to_interval_level, interval_to_quantile_level
label_desc: Use image node_id 5 for calling the RForecastPredictor obj's underlying member method code with example usage: obj._forecast_dict_to_obj(forecast_dict, forecast_start_date, item_id, info) and returns: QuantileForecast