gluonts.torch.distributions.binned_uniforms module#
- class gluonts.torch.distributions.binned_uniforms.BinnedUniforms(bins_lower_bound: float, bins_upper_bound: float, logits: Tensor, numb_bins: int = 100, validate_args: Optional[bool] = None)[source]#
Bases:
Distribution
Binned uniforms distribution.
- Parameters:
bins_lower_bound (float) – The lower bound of the bin edges
bins_upper_bound (float) – The upper bound of the bin edges
numb_bins (int) – The number of equidistance bins to allocate between bins_lower_bound and bins_upper_bound. Default value is 100.
logits (tensor) – the logits defining the probability of each bins. These are softmaxed. The tensor is of shape (*batch_shape,)
validate_args (bool) –
- arg_constraints = {'logits': Real()}#
- property bins_prob#
Returns the probability of the observed point to be in each of the bins bins_prob.shape: (*batch_shape, event_shape). event_shape is numb_bins
- cdf(x)[source]#
Cumulative density tensor for a tensor of data points x.
‘x’ is expected to be of shape (*batch_shape)
- expand(batch_shape, _instance=None)[source]#
Returns a new distribution instance (or populates an existing instance provided by a derived class) with batch dimensions expanded to batch_shape. This method calls
expand
on the distribution’s parameters. As such, this does not allocate new memory for the expanded distribution instance. Additionally, this does not repeat any args checking or parameter broadcasting in __init__.py, when an instance is first created.- Parameters:
batch_shape (torch.Size) – the desired expanded size.
_instance – new instance provided by subclasses that need to override .expand.
- Returns:
New distribution instance with batch dimensions expanded to batch_size.
- get_one_hot_bin_indicator(x, in_float=False)[source]#
‘x’ is to have shape (*batch_shape) which can be for example () or (32, ) or (32, 168, )
- has_rsample = False#
- icdf(quantiles)[source]#
Inverse cdf of a tensor of quantile quantiles ‘quantiles’ is of shape (*batch_shape) with values between (0.0, 1.0)
This is the function to be called from the outside.
- log_binned_p(x)[source]#
Log probability for a tensor of datapoints x.
‘x’ is to have shape (*batch_shape)
- property log_bins_prob#
- log_prob(x)[source]#
Log probability for a tensor of datapoints x.
‘x’ is to have shape (*batch_shape)
- rsample(sample_shape=torch.Size([]))[source]#
We do not have an implementation for the reparameterization trick yet.
- support = Real()#
- class gluonts.torch.distributions.binned_uniforms.BinnedUniformsOutput(bins_lower_bound: float, bins_upper_bound: float, num_bins: int)[source]#
Bases:
DistributionOutput
- distr_cls#
alias of
BinnedUniforms
- distribution(distr_args, loc: Optional[Tensor] = None, scale: Optional[Tensor] = None) BinnedUniforms [source]#
Construct the associated distribution, given the collection of constructor arguments and, optionally, a scale tensor.
- Parameters:
distr_args – Constructor arguments for the underlying Distribution type.
loc – Optional tensor, of the same shape as the batch_shape+event_shape of the resulting distribution.
scale – Optional tensor, of the same shape as the batch_shape+event_shape of the resulting distribution.
- classmethod domain_map(logits: Tensor) Tensor [source]#
Converts arguments to the right shape and domain.
The domain depends on the type of distribution, while the correct shape is obtained by reshaping the trailing axis in such a way that the returned tensors define a distribution of the right event_shape.
- property event_shape: Tuple#
Shape of each individual event compatible with the output object.