gluonts.torch.distributions.piecewise_linear module#

class gluonts.torch.distributions.piecewise_linear.PiecewiseLinear(gamma: torch.Tensor, slopes: torch.Tensor, knot_spacings: torch.Tensor, validate_args=False)[source]#

Bases: torch.distributions.distribution.Distribution

property batch_shape: torch.Size#

Returns the shape over which parameters are batched.

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

Returns the cumulative density/mass function evaluated at value.

Parameters

value (Tensor) –

crps(z: torch.Tensor) torch.Tensor[source]#
loss(z: torch.Tensor) torch.Tensor[source]#
static parametrize_knots(knot_spacings: torch.Tensor) torch.Tensor[source]#
static parametrize_slopes(slopes: torch.Tensor) torch.Tensor[source]#
quantile(u: torch.Tensor) torch.Tensor[source]#
quantile_internal(u: torch.Tensor, dim: Optional[int] = None) torch.Tensor[source]#
rsample(sample_shape: torch.Size = torch.Size([])) torch.Tensor[source]#

Generates a sample_shape shaped reparameterized sample or sample_shape shaped batch of reparameterized samples if the distribution parameters are batched.

class gluonts.torch.distributions.piecewise_linear.PiecewiseLinearOutput(num_pieces: int)[source]#

Bases: gluonts.torch.distributions.distribution_output.DistributionOutput

distr_cls#

alias of gluonts.torch.distributions.piecewise_linear.PiecewiseLinear

distribution(distr_args, loc: Optional[torch.Tensor] = None, scale: Optional[torch.Tensor] = None) gluonts.torch.distributions.piecewise_linear.PiecewiseLinear[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(gamma: torch.Tensor, slopes: torch.Tensor, knot_spacings: torch.Tensor) Tuple[torch.Tensor, torch.Tensor, 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.

class gluonts.torch.distributions.piecewise_linear.TransformedPiecewiseLinear(base_distribution: gluonts.torch.distributions.piecewise_linear.PiecewiseLinear, transforms: List[torch.distributions.transforms.AffineTransform], validate_args=None)[source]#

Bases: torch.distributions.transformed_distribution.TransformedDistribution

crps(y: torch.Tensor) torch.Tensor[source]#