gluonts.torch.distributions.negative_binomial module#

class gluonts.torch.distributions.negative_binomial.NegativeBinomial(total_count: Union[float, torch.Tensor], probs: Optional[Union[float, torch.Tensor]] = None, logits: Optional[Union[float, torch.Tensor]] = None, validate_args=None)[source]#

Bases: torch.distributions.negative_binomial.NegativeBinomial

Negative binomial distribution with total_count and probs or logits parameters.

Based on torch.distributions.NegativeBinomial, with added cdf and icdf methods.

cdf(value: torch.Tensor) torch.Tensor[source]#

Returns the cumulative density/mass function evaluated at value.

Parameters

value (Tensor) –

icdf(value: torch.Tensor) torch.Tensor[source]#

Returns the inverse cumulative density/mass function evaluated at value.

Parameters

value (Tensor) –

property scipy_nbinom#
class gluonts.torch.distributions.negative_binomial.NegativeBinomialOutput(beta: float = 0.0)[source]#

Bases: gluonts.torch.distributions.distribution_output.DistributionOutput

args_dim: Dict[str, int] = {'logits': 1, 'total_count': 1}#
distr_cls#

alias of gluonts.torch.distributions.negative_binomial.NegativeBinomial

distribution(distr_args, loc: Optional[torch.Tensor] = None, scale: Optional[torch.Tensor] = None) torch.distributions.distribution.Distribution[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(total_count: torch.Tensor, logits: torch.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.

in_features: int#