gluonts.mx.distribution.student_t 模块#

class gluonts.mx.distribution.student_t.StudentT(mu: Union[mxnet.ndarray.ndarray.NDArray, mxnet.symbol.symbol.Symbol], sigma: Union[mxnet.ndarray.ndarray.NDArray, mxnet.symbol.symbol.Symbol], nu: Union[mxnet.ndarray.ndarray.NDArray, mxnet.symbol.symbol.Symbol], F=None)[source]#

基类: gluonts.mx.distribution.distribution.Distribution

学生 t 分布。

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

  • sigma – 包含标准差的张量,形状为 (*batch_shape, *event_shape)

  • nu – 包含分布自由度的非负张量,形状为 (*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 中每个事件的分布对数密度。

返回类型

张量

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)

返回类型

张量

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

包含分布标准差的张量。

class gluonts.mx.distribution.student_t.StudentTOutput[source]#

基类: gluonts.mx.distribution.distribution_output.DistributionOutput

args_dim: Dict[str, int] = {'mu': 1, 'nu': 1, 'sigma': 1}#
distr_cls#

别名 gluonts.mx.distribution.student_t.StudentT

classmethod domain_map(F, mu, sigma, nu)[source]#

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

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

property event_shape: Tuple#

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