gluonts.torch.model.forecast module#

class gluonts.torch.model.forecast.DistributionForecast(distribution: torch.distributions.distribution.Distribution, start_date: pandas._libs.tslibs.period.Period, item_id: Optional[str] = None, info: Optional[Dict] = None)[source]#

Bases: gluonts.model.forecast.Forecast

A Forecast object that uses a distribution directly.

This can for instance be used to represent marginal probability distributions for each time point – although joint distributions are also possible, e.g. when using MultiVariateGaussian).

Parameters
  • distribution

    Distribution object. This should represent the entire prediction length, i.e., if we draw num_samples samples from the distribution, the sample shape should be

    samples = trans_dist.sample(num_samples) samples.shape -> (num_samples, prediction_length)

  • start_date (pandas._libs.tslibs.period.Period) – start of the forecast

  • info (Optional[Dict]) – additional information that the forecaster may provide e.g. estimated parameters, number of iterations ran etc.

info: Optional[Dict]#
item_id: Optional[str]#
property mean: numpy.ndarray#

Forecast mean.

property mean_ts: pandas.core.series.Series#

Forecast mean, as a pandas.Series object.

prediction_length: int#
quantile(level: Union[float, str]) numpy.ndarray[source]#

Compute a quantile from the predicted distribution.

Parameters

q – Quantile to compute.

Returns

Value of the quantile across the prediction range.

Return type

numpy.ndarray

start_date: pandas._libs.tslibs.period.Period#
to_sample_forecast(num_samples: int = 200) gluonts.model.forecast.SampleForecast[source]#