gluonts.mx.distribution.neg_binomial 模块#

class gluonts.mx.distribution.neg_binomial.NegativeBinomial(mu: Union[mxnet.ndarray.ndarray.NDArray, mxnet.symbol.symbol.Symbol], alpha: Union[mxnet.ndarray.ndarray.NDArray, mxnet.symbol.symbol.Symbol])[source]#

负二项分布,即独立伯努利试验序列中成功次数的分布。

参数

mu – 包含均值的张量,形状为 (*batch_shape, *event_shape)
  • alpha – 形状参数的张量,形状为 (*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 的张量。

is_reparameterizable = False#

property event_dim: int#

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) 的张量。

mu – 包含均值的张量,形状为 (*batch_shape, *event_shape)

返回

形状为 batch_shape 的张量,包含 x 中每个事件的分布对数密度。

返回类型

张量

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 – 要抽取的样本数量。

mu – 包含均值的张量,形状为 (*batch_shape, *event_shape)
  • dtype – 样本的数据类型。

  • 包含样本的张量。如果 num_samples = None,其形状为 (*batch_shape, *eval_shape);否则为 (num_samples, *batch_shape, *eval_shape)

形状为 batch_shape 的张量,包含 x 中每个事件的分布对数密度。

property stddev: Union[mxnet.ndarray.ndarray.NDArray, mxnet.symbol.symbol.Symbol]#

张量

property mean: Union[mxnet.ndarray.ndarray.NDArray, mxnet.symbol.symbol.Symbol]#

包含分布标准差的张量。

class gluonts.mx.distribution.neg_binomial.NegativeBinomialOutput[source]#

Bases: gluonts.mx.distribution.distribution_output.DistributionOutput

args_dim: Dict[str, int] = {'alpha': 1, 'mu': 1}#

distr_cls#
别名: gluonts.mx.distribution.neg_binomial.NegativeBinomial

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.neg_binomial.NegativeBinomial[source]#

给定构造函数参数集合以及可选的尺度张量,构造关联的分布。

distr_args – 基础 Distribution 类型的构造函数参数。

mu – 包含均值的张量,形状为 (*batch_shape, *event_shape)
  • loc – 可选张量,形状与结果分布的 batch_shape+event_shape 相同。

  • scale – 可选张量,形状与结果分布的 batch_shape+event_shape 相同。

  • classmethod domain_map(F, mu, alpha)[source]#

将参数转换为正确的形状和域。

域取决于分布类型,而正确的形状是通过重塑尾部轴获得的,以便返回的张量定义具有正确 event_shape 的分布。

property event_shape: Tuple#

此对象构建的分布所考虑的每个独立事件的形状。

gluonts.mx.distribution.neg_binomial.ZeroInflatedNegativeBinomialOutput() gluonts.mx.distribution.mixture.MixtureDistributionOutput[source]#

下一页
gluonts.mx.distribution.piecewise_linear module
上一页
gluonts.mx.distribution.nan_mixture module