mixle.stats.univariate.continuous.weibull module¶
Two-parameter Weibull distributions over positive real values.
Reference: Johnson, Kotz & Balakrishnan, Continuous Univariate Distributions (2nd ed., Wiley, 1994/95).
- class WeibullDistribution(shape, scale, name=None, keys=None)[source]
Bases:
SequenceEncodableProbabilityDistributionWeibull distribution with shape > 0 and scale > 0 on x >= 0.
- classmethod compute_capabilities()[source]
Describe backend support for generated Weibull kernels.
- classmethod compute_declaration()[source]
Return the structured compute declaration for Weibull distributions.
- static backend_legacy_sufficient_statistics(x, params, engine)[source]
Return per-row Weibull sufficient statistics in accumulator order.
- density(x)[source]
Return the probability density or mass at a single observation.
- log_density(x)[source]
Return the log-density or log-mass at a single observation.
- seq_log_density(x)[source]
Return vectorized log-density values for sequence-encoded observations.
- static backend_log_density_from_params(vals, log_vals, shape, scale, engine)[source]
Engine-neutral Weibull log-density from explicit parameters.
- backend_seq_log_density(x, engine)[source]
Engine-neutral vectorized log-density for encoded data.
- classmethod backend_stacked_params(dists, engine)[source]
Return stacked Weibull parameters for a homogeneous mixture kernel.
- classmethod backend_stacked_log_density(x, params, engine)[source]
Return an
(n, k)matrix of Weibull log densities.
- cdf(x)[source]
Cumulative distribution function
P(X <= x)(exact). The continuous ‘index of’ a value.
- quantile(q)[source]
Inverse CDF
F^{-1}(q): the value at cumulative-probability indexq(continuous unranking).
- entropy()[source]
Differential entropy gamma*(1 - 1/shape) + log(scale/shape) + 1.
- Return type:
- sampler(seed=None)[source]
Return a sampler for drawing observations from this distribution.
- Parameters:
seed (int | None)
- Return type:
WeibullSampler
- estimator(pseudo_count=None)[source]
Return an estimator for fitting this distribution from data.
- Parameters:
pseudo_count (float | None)
- Return type:
WeibullEstimator
- dist_to_encoder()[source]
Return the data encoder used by this distribution for vectorized methods.
- Return type:
WeibullDataEncoder
- class WeibullSampler(dist, seed=None)[source]
Bases:
DistributionSamplerDraw iid Weibull observations.
- Parameters:
dist (WeibullDistribution)
seed (int | None)
- class WeibullAccumulator(name=None, keys=None)[source]
Bases:
SequenceEncodableStatisticAccumulatorAccumulate weighted first and second moments for Weibull estimation.
- 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:
weights (ndarray)
rng (RandomState | None)
- Return type:
None
- combine(suff_stat)[source]
Merge another Weibull 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:
WeibullDataEncoder
- class WeibullAccumulatorFactory(name=None, keys=None)[source]
Bases:
StatisticAccumulatorFactoryFactory for WeibullAccumulator.
- make()[source]
Create a fresh Weibull accumulator.
- Return type:
WeibullAccumulator
- class WeibullEstimator(pseudo_count=None, suff_stat=None, min_shape=1.0e-3, max_shape=1.0e3, min_scale=1.0e-12, name=None, keys=None)[source]
Bases:
ParameterEstimatorMoment estimator for Weibull shape and scale.
- Parameters:
- accumulator_factory()[source]
Return an accumulator factory for Weibull moment statistics.
- Return type:
WeibullAccumulatorFactory