gluonts.torch.distributions.distribution_output module#

class gluonts.torch.distributions.distribution_output.BetaOutput(beta: float = 0.0)[source]#

Bases: DistributionOutput

args_dim: Dict[str, int] = {'concentration0': 1, 'concentration1': 1}#
distr_cls#

alias of Beta

classmethod domain_map(concentration1: Tensor, concentration0: 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#
property value_in_support: float#

A float value that is valid for computing the loss of the corresponding output.

By default 0.0.

class gluonts.torch.distributions.distribution_output.DistributionOutput(beta: float = 0.0)[source]#

Bases: Output

Class to construct a distribution given the output of a network.

args_dim: Dict[str, int]#
distr_cls: type#
distribution(distr_args, loc: Optional[Tensor] = None, scale: Optional[Tensor] = None) 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.

domain_map(*args: 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_dim: int#

Number of event dimensions, i.e., length of the event_shape tuple, of the distributions that this object constructs.

property forecast_generator: ForecastGenerator#
in_features: int#
loss(target: Tensor, distr_args: Tuple[Tensor, ...], loc: Optional[Tensor] = None, scale: Optional[Tensor] = None) Tensor[source]#

Compute loss for target data given network output.

Parameters:
  • target – Values of the target time series for which loss is to be computed.

  • distr_args – Arguments that can be used to construct the output distribution.

  • loc – Location parameter of the distribution, optional.

  • scale – Scale parameter of the distribution, optional.

Returns:

Values of the loss, has same shape as target.

Return type:

loss_values

class gluonts.torch.distributions.distribution_output.GammaOutput(beta: float = 0.0)[source]#

Bases: DistributionOutput

args_dim: Dict[str, int] = {'concentration': 1, 'rate': 1}#
distr_cls#

alias of Gamma

classmethod domain_map(concentration: Tensor, rate: 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#
property value_in_support: float#

A float value that is valid for computing the loss of the corresponding output.

By default 0.0.

class gluonts.torch.distributions.distribution_output.LaplaceOutput(beta: float = 0.0)[source]#

Bases: DistributionOutput

args_dim: Dict[str, int] = {'loc': 1, 'scale': 1}#
distr_cls#

alias of Laplace

classmethod domain_map(loc: Tensor, scale: 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#
class gluonts.torch.distributions.distribution_output.NormalOutput(beta: float = 0.0)[source]#

Bases: DistributionOutput

args_dim: Dict[str, int] = {'loc': 1, 'scale': 1}#
distr_cls#

alias of Normal

classmethod domain_map(loc: Tensor, scale: 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#
class gluonts.torch.distributions.distribution_output.PoissonOutput(beta: float = 0.0)[source]#

Bases: DistributionOutput

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

alias of Poisson

distribution(distr_args, loc: Optional[Tensor] = None, scale: Optional[Tensor] = None) 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(rate: 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#