gluonts.model.tpp.forecast module

class gluonts.model.tpp.forecast.PointProcessSampleForecast(samples: Union[mxnet.ndarray.ndarray.NDArray, numpy.ndarray], valid_length: Union[mxnet.ndarray.ndarray.NDArray, numpy.ndarray], start_date: pandas._libs.tslibs.timestamps.Timestamp, freq: str, prediction_interval_length: float, item_id: Optional[str] = None, info: Optional[Dict] = None)[source]

Bases: gluonts.model.forecast.Forecast

Sample forecast object used for temporal point process inference. Differs from standard forecast objects as it does not implement fixed length samples. Each sample has a variable length, that is kept in a separate valid_length attribute.

Importantly, PointProcessSampleForecast does not implement some methods (such as quantile or plot) that are available in discrete time forecasts.

  • samples – A multidimensional array of samples, of shape (number_of_samples, max_pred_length, target_dim). The target_dim is equal to 2, where the first dimension contains the inter-arrival times and the second - categorical marks.

  • valid_length – An array of integers denoting the valid lengths of each sample in samples. That is, valid_length[0] == 2 implies that only the first two entries of samples[0, ...] are valid “points”.

  • start_date – Starting timestamp of the sample

  • freq – The time unit of interarrival times

  • prediction_interval_length – The length of the prediction interval for which samples were drawn.

  • item_id – Item ID, if available.

  • info – Optional dictionary of additional information.

as_json_dict(config: gluonts.model.forecast.Config) → dict[source]
dim() → int[source]

Returns the dimensionality of the forecast object.

property index
mean = None

Plots the median of the forecast as well as confidence bounds. (requires matplotlib and pandas).

  • prediction_intervals (float or list of floats in [0, 100]) – Confidence interval size(s). If a list, it will stack the error plots for each confidence interval. Only relevant for error styles with “ci” in the name.

  • show_mean (boolean) – Whether to also show the mean of the forecast.

  • color (matplotlib color name or dictionary) – The color used for plotting the forecast.

  • label (string) – A label (prefix) that is used for the forecast

  • output_file (str or None, default None) – Output path for the plot file. If None, plot is not saved to file.

  • args – Other arguments are passed to main plot() call

  • kwargs – Other keyword arguments are passed to main plot() call

prediction_interval_length: float = None
prediction_length = None
quantile(q: Union[float, str]) → numpy.ndarray[source]

Computes a quantile from the predicted distribution.


q – Quantile to compute.


Value of the quantile across the prediction range.

Return type