mixle.stats.univariate.continuous.uniform module¶
Continuous uniform distributions over bounded intervals.
Reference: Johnson, Kotz & Balakrishnan, Continuous Univariate Distributions (2nd ed., Wiley, 1994/95).
- class UniformDistribution(low, high, name=None, keys=None)[source]
Bases:
SequenceEncodableProbabilityDistributionContinuous uniform distribution on [low, high].
- classmethod compute_capabilities()[source]
Describe backend support for generated uniform kernels.
- classmethod compute_declaration()[source]
Return the structured compute declaration for uniform distributions.
- 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(x, low, high, engine)[source]
Engine-neutral uniform 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 uniform parameters for a homogeneous mixture kernel.
- classmethod backend_stacked_log_density(x, params, engine)[source]
Return an
(n, k)matrix of uniform log densities.
- classmethod backend_stacked_sufficient_statistics(x, weights, params, engine)[source]
Return stacked Uniform sufficient statistics using engine-resident arrays.
- 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).
- sampler(seed=None)[source]
Return a sampler for drawing observations from this distribution.
- Parameters:
seed (int | None)
- Return type:
UniformSampler
- estimator(pseudo_count=None)[source]
Return an estimator for fitting this distribution from data.
- Parameters:
pseudo_count (float | None)
- Return type:
UniformEstimator
- dist_to_encoder()[source]
Return the data encoder used by this distribution for vectorized methods.
- Return type:
UniformDataEncoder
- class UniformSampler(dist, seed=None)[source]
Bases:
DistributionSamplerDraw iid uniform observations.
- Parameters:
dist (UniformDistribution)
seed (int | None)
- class UniformAccumulator(name=None, keys=None)[source]
Bases:
SequenceEncodableStatisticAccumulatorAccumulate weighted min/max support statistics.
- update(x, weight, estimate)[source]
Accumulate support bounds and count from one weighted 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 support bounds and count from encoded observations.
- seq_update_engine(x, weights, estimate, engine)[source]
Engine-resident accumulation of the weighted count (numpy or torch).
The support min/max are host scalar bookkeeping over the observed values.
- 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 uniform sufficient-statistic tuple.
- from_value(x)[source]
Replace accumulator contents from a sufficient-statistic tuple.
- scale(c)[source]
Scale observation count while preserving support bounds.
- Parameters:
c (float)
- Return type:
UniformAccumulator
- 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:
UniformDataEncoder
- class UniformAccumulatorFactory(name=None, keys=None)[source]
Bases:
StatisticAccumulatorFactoryFactory for UniformAccumulator.
- make()[source]
Create a fresh uniform accumulator.
- Return type:
UniformAccumulator
- class UniformEstimator(pseudo_count=None, suff_stat=None, min_width=1.0e-8, name=None, keys=None)[source]
Bases:
ParameterEstimatorMLE estimator for uniform support endpoints.
- Parameters:
- accumulator_factory()[source]
Return an accumulator factory for uniform support statistics.
- Return type:
UniformAccumulatorFactory