gluonts.mx.model.tpp.forecast 模块#
- class gluonts.mx.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]#
基类:
gluonts.model.forecast.Forecast
用于时间点过程推断的样本预测对象。与标准预测对象不同,因为它不实现固定长度的样本。每个样本的长度是可变的,保存在单独的
valid_length
属性中。重要的是,PointProcessSampleForecast 没有实现离散时间预测中可用的一些方法(例如
quantile
或plot
)。- 参数
samples – 多维样本数组,形状为 (样本数量, 最大预测长度, 目标维度)。目标维度等于 2,其中第一维包含到达间隔时间,第二维包含类别标记。
valid_length – 一个整数数组,表示
samples
中每个样本的有效长度。也就是说,valid_length[0] == 2
表示samples[0, ...]
的前两个条目是有效的“点”。start_date (pandas._libs.tslibs.period.Period) – 样本的起始时间戳
freq – 到达间隔时间的时间单位
prediction_interval_length (float) – 绘制样本所依据的预测区间长度。
item_id (Optional[str]) – 项目 ID,如果可用。
info (Optional[Dict]) – 包含附加信息的可选字典。
- property freq#
- property index: pandas.core.indexes.period.PeriodIndex#
- info: Optional[Dict]#
- item_id: Optional[str]#
- mean = None#
- plot(**kwargs)[source]#
使用
matplotlib
绘制中位数预测和预测区间。默认绘制 0.5 和 0.9 预测区间。可以通过设置 intervals 选择其他区间。
这会绘制到当前轴对象(通过
plt.gca()
),或者如果提供了ax
,则绘制到ax
。类似地,如果没有设置显式的color
,颜色会使用 matplotlib 的内部颜色循环。可以将
name
设置为中位数预测的label
。区间不会被标记,除非将show_label
设置为True
。
- prediction_interval_length: float#
- prediction_length: int = None#
- quantile(q: Union[float, str]) numpy.ndarray [source]#
从预测分布中计算分位数。
- 参数
q – 要计算的分位数。
- 返回值
预测范围内的分位数数值。
- 返回值类型
numpy.ndarray
- start_date: pandas._libs.tslibs.period.Period#