Weibull
DistributionWeibull(scale: Tensor | float, concentration: Tensor | float, validate_args: bool | None = None)Weibull distribution — a flexible family for lifetime and survival analysis.
Weibull(scale=λ, concentration=k) generalises both the Exponential
() and Rayleigh () distributions. It is widely
used for modelling time-to-failure data because the hazard rate
can increase, be constant,
or decrease depending on .
Parameters
scaleTensor | floatconcentrationTensor | floatvalidate_argsbool | None= NoneTrue, validate parameter constraints at construction time.Attributes
Notes
PDF:
Log-PDF:
Moments:
- Mean:
- Variance:
Entropy:
where is the Euler–Mascheroni constant.
Reparameterised sampling uses the inverse-CDF: for .
Examples
>>> import lucid
>>> from lucid.distributions import Weibull
>>> # Exponential(rate=1) as a special case
>>> dist_exp = Weibull(scale=1.0, concentration=1.0)
>>> dist = Weibull(scale=2.0, concentration=1.5)
>>> samples = dist.rsample((500,))Used by 2
Constructors
1__init__
→None__init__(scale: Tensor | float, concentration: Tensor | float, validate_args: bool | None = None)Properties
4Mean of the Weibull distribution: .
Returns
TensorMean values of shape batch_shape.
Mode of the Weibull distribution.
For the density decreases from the origin, so the
mode is 0. The reference framework evaluates the first formula
there too and answers nan or a meaningless positive number; this
answers 0.
Support of the Weibull distribution: .
Returns
ConstraintThe positive constraint, as in the reference framework. At
0 the density is infinite for and 0 for
, and the closed form is not evaluated there.
Instance methods
5Cumulative distribution function of the Weibull distribution.
The Exponential(1) CDF at ; 0 below 0.
Returns probabilities in .
Examples
>>> Weibull(scale=1.0, concentration=1.0).cdf(lucid.tensor(1.0))
tensor(0.6321)Entropy of the Weibull distribution.
where is the Euler-Mascheroni constant.
Returns
TensorEntropy values of shape batch_shape (nats).
Quantile function of the Weibull distribution.
Returns quantiles in .
Examples
>>> Weibull(scale=2.0, concentration=1.0).icdf(lucid.tensor(0.5))
tensor(1.386)Draw reparameterised samples via the inverse-CDF.
Uses for
. Gradients propagate
through both scale and concentration.
Parameters
sample_shapetuple[int, ...]= ()Returns
TensorNon-negative samples of shape (*sample_shape, *batch_shape).