gluonts.mx.distribution.gamma module#
- class gluonts.mx.distribution.gamma.Gamma(alpha: Union[mxnet.ndarray.ndarray.NDArray, mxnet.symbol.symbol.Symbol], beta: Union[mxnet.ndarray.ndarray.NDArray, mxnet.symbol.symbol.Symbol])[source]#
Bases:
gluonts.mx.distribution.distribution.Distribution
Gamma distribution.
- Parameters
alpha – Tensor containing the shape parameters, of shape (*batch_shape, *event_shape).
beta – Tensor containing the rate parameters, of shape (*batch_shape, *event_shape).
F –
- property F#
- arg_names: Tuple#
- property args: List#
- property batch_shape: Tuple#
Layout of the set of events contemplated by the distribution.
Invoking sample() from a distribution yields a tensor of shape batch_shape + event_shape, and computing log_prob (or loss more in general) on such sample will yield a tensor of shape batch_shape.
This property is available in general only in mx.ndarray mode, when the shape of the distribution arguments can be accessed.
- property event_dim: int#
Number of event dimensions, i.e., length of the event_shape tuple.
This is 0 for distributions over scalars, 1 over vectors, 2 over matrices, and so on.
- property event_shape: Tuple#
Shape of each individual event contemplated by the distribution.
For example, distributions over scalars have event_shape = (), over vectors have event_shape = (d, ) where d is the length of the vectors, over matrices have event_shape = (d1, d2), and so on.
Invoking sample() from a distribution yields a tensor of shape batch_shape + event_shape.
This property is available in general only in mx.ndarray mode, when the shape of the distribution arguments can be accessed.
- is_reparameterizable = False#
- log_prob(x: Union[mxnet.ndarray.ndarray.NDArray, mxnet.symbol.symbol.Symbol]) Union[mxnet.ndarray.ndarray.NDArray, mxnet.symbol.symbol.Symbol] [source]#
Compute the log-density of the distribution at x.
- Parameters
x – Tensor of shape (*batch_shape, *event_shape).
- Returns
Tensor of shape batch_shape containing the log-density of the distribution for each event in x.
- Return type
Tensor
- property mean: Union[mxnet.ndarray.ndarray.NDArray, mxnet.symbol.symbol.Symbol]#
Tensor containing the mean of the distribution.
- sample(num_samples: typing.Optional[int] = None, dtype=<class 'numpy.float32'>) Union[mxnet.ndarray.ndarray.NDArray, mxnet.symbol.symbol.Symbol] [source]#
Draw samples from the distribution.
If num_samples is given the first dimension of the output will be num_samples.
- Parameters
num_samples – Number of samples to to be drawn.
dtype – Data-type of the samples.
- Returns
A tensor containing samples. This has shape (*batch_shape, *eval_shape) if num_samples = None and (num_samples, *batch_shape, *eval_shape) otherwise.
- Return type
Tensor
- property stddev: Union[mxnet.ndarray.ndarray.NDArray, mxnet.symbol.symbol.Symbol]#
Tensor containing the standard deviation of the distribution.
- class gluonts.mx.distribution.gamma.GammaOutput[source]#
Bases:
gluonts.mx.distribution.distribution_output.DistributionOutput
- args_dim: Dict[str, int] = {'alpha': 1, 'beta': 1}#
- distr_cls#
alias of
gluonts.mx.distribution.gamma.Gamma
- classmethod domain_map(F, alpha, beta)[source]#
Maps raw tensors to valid arguments for constructing a Gamma distribution.
- Parameters
F –
alpha – Tensor of shape (*batch_shape, 1)
beta – Tensor of shape (*batch_shape, 1)
- Returns
Two squeezed tensors, of shape (*batch_shape): both have entries mapped to the positive orthant.
- Return type
Tuple[Tensor, Tensor]
- property event_shape: Tuple#
Shape of each individual event contemplated by the distributions that this object constructs.
- property value_in_support: float#
A float that will have a valid numeric value when computing the log- loss of the corresponding distribution; by default 0.0.
This value will be used when padding data series.