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
orplot
) that are available in discrete time forecasts.- Parameters
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 ofsamples[0, ...]
are valid “points”.start_date (pandas._libs.tslibs.period.Period) – Starting Timestamp of the sample
freq – The time unit of interarrival times
prediction_interval_length (float) – The length of the prediction interval for which samples were drawn.
item_id (Optional[str]) – Item ID, if available.
info (Optional[Dict]) – Optional dictionary of additional information.
- as_json_dict(config: gluonts.model.forecast.Config) dict [source]#
- property freq#
- property index: pandas.core.indexes.period.PeriodIndex#
- info: Optional[Dict]#
- item_id: Optional[str]#
- mean: numpy.ndarray = None#
- plot(**kwargs)[source]#
Plots the median of the forecast as well as confidence bounds. (requires matplotlib and pandas).
- Parameters
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#
- prediction_length: int = None#
- quantile(q: Union[float, str]) numpy.ndarray [source]#
Computes 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#