gluonts.torch.distributions.binned_uniforms 模块#

class gluonts.torch.distributions.binned_uniforms.BinnedUniforms(bins_lower_bound: float, bins_upper_bound: float, logits: torch.Tensor, numb_bins: int = 100, validate_args: Optional[bool] = None)[source]#

基类:torch.distributions.distribution.Distribution

分箱均匀分布。

参数
  • bins_lower_bound (float) – 分箱边界的下限

  • bins_upper_bound (float) – 分箱边界的上限

  • numb_bins (int) – 在 bins_lower_boundbins_upper_bound 之间分配的等距分箱数量。默认值为 100。

  • logits (tensor) – 定义每个分箱概率的 logits。这些经过 softmax 处理。张量形状为 (*batch_shape,)

  • validate_args (bool) –

arg_constraints = {'logits': Real()}#
property bins_prob#

返回观测点落在每个分箱中的概率。bins_prob.shape: (*batch_shape, event_shape)。event_shape 是 numb_bins

cdf(x)[source]#

数据点张量 x 的累积密度张量。

‘x’ 的形状应为 (*batch_shape)

entropy()[source]#

我们尚未实现熵计算。

enumerate_support(expand=True)[source]#

这是一个实数值分布。

expand(batch_shape, _instance=None)[source]#

返回一个新的分布实例(或填充派生类提供的现有实例),其批次维度扩展到 batch_shape。此方法在其参数上调用分布的 expand。因此,这不会为扩展的分布实例分配新内存。此外,这在首次创建实例时不会重复 __init__.py 中的任何参数检查或参数广播。

参数
  • batch_shape (torch.Size) – 期望的扩展大小。

  • _instance – 需要重写 .expand 的子类提供的新实例。

返回

批次维度扩展到 batch_size 的新分布实例。

get_one_hot_bin_indicator(x, in_float=False)[source]#

‘x’ 的形状应为 (*batch_shape),例如 ()、(32,) 或 (32, 168,)

has_rsample = False#
icdf(quantiles)[source]#

分位数张量 quantiles 的逆累积分布函数(Inverse cdf)。‘quantiles’ 的形状为 (*batch_shape),取值范围在 (0.0, 1.0) 之间

这是从外部调用的函数。

log_binned_p(x)[source]#

数据点张量 x 的对数概率。

‘x’ 的形状应为 (*batch_shape)

property log_bins_prob#
log_prob(x)[source]#

数据点张量 x 的对数概率。

‘x’ 的形状应为 (*batch_shape)

property mean#

返回分布的均值。

mean.shape : (*batch_shape,)

property median#

返回分布的中位数。

median.shape : (*batch_shape,)

property mode#

返回分布的众数。

mode.shape : (*batch_shape,)

pdf(x)[source]#

数据点张量 x 的概率。

‘x’ 的形状应为 (*batch_shape)

rsample(sample_shape=torch.Size([]))[source]#

我们尚未实现重参数化技巧。

sample(sample_shape=torch.Size([]))[source]#

返回分布的样本。

返回

样本形状为 (*sample_shape, *batch_shape)

support = Real()#
variance()[source]#

返回分布的方差。

class gluonts.torch.distributions.binned_uniforms.BinnedUniformsOutput(bins_lower_bound: float, bins_upper_bound: float, num_bins: int)[source]#

基类:gluonts.torch.distributions.distribution_output.DistributionOutput

distr_cls#

别名 gluonts.torch.distributions.binned_uniforms.BinnedUniforms

distribution(distr_args, loc: Optional[torch.Tensor] = None, scale: Optional[torch.Tensor] = None) gluonts.torch.distributions.binned_uniforms.BinnedUniforms[source]#

根据构造函数参数集合以及可选的缩放张量构造关联分布。

参数
  • distr_args – 底层分布类型的构造函数参数。

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

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

classmethod domain_map(logits: torch.Tensor) torch.Tensor[source]#

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

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

property event_shape: Tuple#

与输出对象兼容的每个独立事件的形状。