gluonts.mx.distribution.poisson 模块#
- class gluonts.mx.distribution.poisson.Poisson(rate: Union[mxnet.ndarray.ndarray.NDArray, mxnet.symbol.symbol.Symbol])[source]#
基类:
gluonts.mx.distribution.distribution.Distribution
泊松分布,即指定区域内成功次数的分布。
- 参数
rate – 包含均值的张量,形状为 (*batch_shape, *event_shape)。
F –
- property F#
- arg_names: Tuple#
- property args: List#
- property batch_shape: Tuple#
分布所考虑的事件集合的布局。
从分布调用 sample() 会生成形状为 batch_shape + event_shape 的张量,而在此类样本上计算 log_prob (或更一般的 loss) 将生成形状为 batch_shape 的张量。
此属性通常仅在 mx.ndarray 模式下可用,此时可以访问分布参数的形状。
- property event_dim: int#
事件维度的数量,即 event_shape 元组的长度。
对于标量分布,此值为 0;对于向量分布,为 1;对于矩阵分布,为 2,依此类推。
- property event_shape: Tuple#
分布所考虑的每个独立事件的形状。
例如,标量分布的 event_shape = (),向量分布的 event_shape = (d, ),其中 d 是向量的长度,矩阵分布的 event_shape = (d1, d2),依此类推。
从分布调用 sample() 会生成形状为 batch_shape + event_shape 的张量。
此属性通常仅在 mx.ndarray 模式下可用,此时可以访问分布参数的形状。
- is_reparameterizable = False#
- log_prob(x: Union[mxnet.ndarray.ndarray.NDArray, mxnet.symbol.symbol.Symbol]) Union[mxnet.ndarray.ndarray.NDArray, mxnet.symbol.symbol.Symbol] [source]#
计算分布在 x 处的对数密度。
- 参数
x – 形状为 (*batch_shape, *event_shape) 的张量。
- 返回
形状为 batch_shape 的张量,包含 x 中每个事件的分布对数密度。
- 返回类型
Tensor
- property mean: Union[mxnet.ndarray.ndarray.NDArray, mxnet.symbol.symbol.Symbol]#
包含分布均值的张量。
- sample(num_samples: typing.Optional[int] = None, dtype=<class 'numpy.float32'>) Union[mxnet.ndarray.ndarray.NDArray, mxnet.symbol.symbol.Symbol] [source]#
从分布中抽取样本。
如果给定 num_samples,则输出的第一个维度将是 num_samples。
- 参数
num_samples – 要抽取的样本数量。
dtype – 样本的数据类型。
- 返回
包含样本的张量。如果 num_samples = None,则形状为 (*batch_shape, *eval_shape);否则形状为 (num_samples, *batch_shape, *eval_shape)。
- 返回类型
Tensor
- property stddev: Union[mxnet.ndarray.ndarray.NDArray, mxnet.symbol.symbol.Symbol]#
包含分布标准差的张量。
- class gluonts.mx.distribution.poisson.PoissonOutput[source]#
基类:
gluonts.mx.distribution.distribution_output.DistributionOutput
- args_dim: Dict[str, int] = {'rate': 1}#
- distr_cls#
- distribution(distr_args, loc: Optional[Union[mxnet.ndarray.ndarray.NDArray, mxnet.symbol.symbol.Symbol]] = None, scale: Optional[Union[mxnet.ndarray.ndarray.NDArray, mxnet.symbol.symbol.Symbol]] = None) gluonts.mx.distribution.poisson.Poisson [source]#
给定构造函数参数集合以及可选的尺度张量,构造相关的分布。
- 参数
distr_args – 底层分布类型的构造函数参数。
loc – 可选张量,形状与结果分布的 batch_shape+event_shape 相同。
scale – 可选张量,形状与结果分布的 batch_shape+event_shape 相同。
- classmethod domain_map(F, rate)[source]#
将参数转换为正确的形状和域。
域取决于分布类型,而正确的形状是通过重塑末尾轴获得的,以便返回的张量定义具有正确 event_shape 的分布。
- property event_shape: Tuple#
此对象构造的分布所考虑的每个独立事件的形状。
- gluonts.mx.distribution.poisson.ZeroInflatedPoissonOutput() gluonts.mx.distribution.mixture.MixtureDistributionOutput [source]#