gluonts.torch.distributions.piecewise_linear module#

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

Bases: Distribution

property batch_shape: Size#

Returns the shape over which parameters are batched.

cdf(z: Tensor) Tensor[source]#

Returns the cumulative density/mass function evaluated at value.

Parameters:

value (Tensor) –

crps(z: Tensor) Tensor[source]#
loss(z: Tensor) Tensor[source]#
static parametrize_knots(knot_spacings: Tensor) Tensor[source]#
static parametrize_slopes(slopes: Tensor) Tensor[source]#
quantile(u: Tensor) Tensor[source]#
quantile_internal(u: Tensor, dim: Optional[int] = None) Tensor[source]#
rsample(sample_shape: Size = torch.Size([])) 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: DistributionOutput

distr_cls#

alias of PiecewiseLinear

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

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

Bases: TransformedDistribution

crps(y: Tensor) Tensor[source]#