gluonts.torch.distributions.distribution_output module#

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

Bases: gluonts.torch.distributions.distribution_output.DistributionOutput

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

alias of torch.distributions.beta.Beta

classmethod domain_map(concentration1: torch.Tensor, concentration0: 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#
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: gluonts.torch.distributions.output.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[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.

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

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

property forecast_generator: gluonts.model.forecast_generator.ForecastGenerator#
in_features: int#
loss(target: torch.Tensor, distr_args: Tuple[torch.Tensor, ...], loc: Optional[torch.Tensor] = None, scale: Optional[torch.Tensor] = None) torch.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: gluonts.torch.distributions.distribution_output.DistributionOutput

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

alias of torch.distributions.gamma.Gamma

classmethod domain_map(concentration: torch.Tensor, rate: 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#
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: gluonts.torch.distributions.distribution_output.DistributionOutput

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

alias of torch.distributions.laplace.Laplace

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

Bases: gluonts.torch.distributions.distribution_output.DistributionOutput

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

alias of torch.distributions.normal.Normal

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

Bases: gluonts.torch.distributions.distribution_output.DistributionOutput

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

alias of torch.distributions.poisson.Poisson

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(rate: 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#