mixle.stats.univariate.continuous.gumbel module¶
Gumbel distributions for extreme-value maxima.
Observations are real-valued floats. A Gumbel distribution with location loc (mu) and scale
beta > 0 has log-density
log(f(x; mu, beta)) = -log(beta) - z - exp(-z), z = (x - mu) / beta,
on the whole real line. It models the distribution of maxima; the mean is mu + beta*gamma (gamma the Euler-Mascheroni constant) and the variance is (pi^2 / 6) * beta^2, which the moment estimator inverts.
The per-row log-density lowers cleanly to the shared symbolic kernel, so the family gets generated
NumPy, Torch, and Numba scoring through backend_log_density_from_params.
Reference: Johnson, Kotz & Balakrishnan, Continuous Univariate Distributions (2nd ed., Wiley, 1994/95).
- class GumbelDistribution(loc=0.0, scale=1.0, name=None, keys=None)[source]
Bases:
SequenceEncodableProbabilityDistributionGumbel (extreme value type I) distribution with location loc and scale beta > 0.
- classmethod compute_capabilities()[source]
Describe backend support for generated Gumbel kernels.
- classmethod compute_declaration()[source]
Return the structured compute declaration for Gumbel distributions.
- static backend_legacy_sufficient_statistics(x, params, engine)[source]
Return per-row Gumbel sufficient statistics in accumulator order.
- static backend_log_density_from_params(x, loc, scale, engine)[source]
Engine-neutral Gumbel log-density from explicit parameters.
- density(x)[source]
Return the probability density at a single observation.
- log_density(x)[source]
Return the log-density at a single observation.
- seq_log_density(x)[source]
Return vectorized log-density values for sequence-encoded observations.
- backend_seq_log_density(x, engine)[source]
Engine-neutral vectorized log-density for encoded data.
- classmethod backend_stacked_params(dists, engine)[source]
Return stacked Gumbel parameters for a homogeneous mixture kernel.
- classmethod backend_stacked_log_density(x, params, engine)[source]
Return an
(n, k)matrix of Gumbel log densities.
- classmethod backend_stacked_sufficient_statistics(x, weights, params, engine)[source]
Return stacked Gumbel sufficient statistics using engine-resident arrays.
- sampler(seed=None)[source]
Return a sampler for drawing observations from this distribution.
- Parameters:
seed (int | None)
- Return type:
GumbelSampler
- estimator(pseudo_count=None)[source]
Return a moment estimator for fitting this distribution from data.
- Parameters:
pseudo_count (float | None)
- Return type:
GumbelEstimator
- dist_to_encoder()[source]
Return the data encoder used by this distribution for vectorized methods.
- Return type:
GumbelDataEncoder
- class GumbelSampler(dist, seed=None)[source]
Bases:
DistributionSamplerDraw iid Gumbel observations.
- Parameters:
dist (GumbelDistribution)
seed (int | None)
- class GumbelAccumulator(keys=None)[source]
Bases:
SequenceEncodableStatisticAccumulatorAccumulate weighted first and second moments for Gumbel estimation.
- Parameters:
keys (str | None)
- update(x, weight, estimate)[source]
Accumulate weighted first and second moments for one observation.
- initialize(x, weight, rng)[source]
Initialize statistics from one observation.
- Parameters:
x (float)
weight (float)
rng (RandomState | None)
- Return type:
None
- seq_update(x, weights, estimate)[source]
Accumulate weighted first and second moments from encoded data.
- seq_initialize(x, weights, rng)[source]
Initialize statistics from encoded observations.
- Parameters:
x (ndarray)
weights (ndarray)
rng (RandomState | None)
- Return type:
None
- combine(suff_stat)[source]
Merge another Gumbel sufficient-statistic tuple.
- value()[source]
Return accumulated sum, second moment sum, and count.
- from_value(x)[source]
Replace accumulator contents from a sufficient-statistic tuple.
- key_merge(stats_dict)[source]
Merge keyed statistics into
stats_dictwhen keys are configured.
- key_replace(stats_dict)[source]
Replace this accumulator from keyed statistics when available.
- acc_to_encoder()[source]
Return the encoder used by this accumulator.
- Return type:
GumbelDataEncoder
- class GumbelAccumulatorFactory(keys=None)[source]
Bases:
StatisticAccumulatorFactoryFactory for GumbelAccumulator.
- Parameters:
keys (str | None)
- make()[source]
Create a fresh Gumbel accumulator.
- Return type:
GumbelAccumulator
- class GumbelEstimator(pseudo_count=None, suff_stat=None, min_scale=1.0e-8, name=None, keys=None)[source]
Bases:
ParameterEstimatorMoment estimator for the Gumbel location and scale.
Inverts the Gumbel moments:
beta = sqrt(6 * var) / piandloc = mean - beta * gammawhere gamma is the Euler-Mascheroni constant.- Parameters:
- accumulator_factory()[source]
Return an accumulator factory for Gumbel moment statistics.
- Return type:
GumbelAccumulatorFactory