mixle.stats.univariate.discrete.point_mass module¶
Fixed point-mass distribution and estimator support.
This module implements a sequence-encodable Dirac distribution, including sampling, encoding, enumeration, backend scoring, and the estimator hooks needed for mixture and combinator use.
- class PointMassDistribution(value, name=None, keys=None)[source]
Bases:
SequenceEncodableProbabilityDistributionFixed Dirac/point-mass distribution assigning all mass to one value.
- classmethod compute_capabilities()[source]
Declare generic NumPy/Torch scoring support for fixed atoms.
- classmethod compute_declaration()[source]
Return the declaration for a fixed non-estimated atom.
- 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.
- backend_seq_log_density(x, engine)[source]
Engine-neutral vectorized log-density from encoded equality flags.
- classmethod backend_stacked_params(dists, engine)[source]
Return stacked point-mass parameters for identical fixed atoms.
- classmethod backend_stacked_log_density(x, params, engine)[source]
Return an
(n, k)matrix of point-mass log densities.
- classmethod backend_stacked_sufficient_statistics(x, weights, params, engine)[source]
Return per-component empty statistics for fixed point masses.
- sampler(seed=None)[source]
Return a sampler for drawing observations from this distribution.
- Parameters:
seed (int | None)
- Return type:
PointMassSampler
- estimator(pseudo_count=None)[source]
Return an estimator for fitting this distribution from data.
- Parameters:
pseudo_count (float | None)
- Return type:
PointMassEstimator
- dist_to_encoder()[source]
Return the data encoder used by this distribution for vectorized methods.
- Return type:
PointMassDataEncoder
- enumerator()[source]
Return an enumerator over the distribution support when available.
- Return type:
PointMassEnumerator
- class PointMassEnumerator(dist)[source]
Bases:
DistributionEnumeratorEnumerate the single atom of a PointMassDistribution.
- Parameters:
dist (PointMassDistribution)
- class PointMassSampler(dist, seed=None)[source]
Bases:
DistributionSamplerSampler returning the fixed atom.
- Parameters:
dist (PointMassDistribution)
seed (int | None)
- class PointMassAccumulator(value, keys=None)[source]
Bases:
SequenceEncodableStatisticAccumulatorAccumulator for a fixed point mass; no parameters are learned.
- update(x, weight, estimate)[source]
Ignore one observation because the atom is fixed.
- seq_update(x, weights, estimate)[source]
Ignore encoded observations because the atom is fixed.
- seq_update_engine(x, weights, estimate, engine)[source]
Ignore engine-resident observations because the atom is fixed.
- initialize(x, weight, rng)[source]
Ignore initialization observations because the atom is fixed.
- Parameters:
x (Any)
weight (float)
rng (RandomState | None)
- Return type:
None
- seq_initialize(x, weights, rng)[source]
Ignore encoded initialization observations because the atom is fixed.
- Parameters:
x (ndarray)
weights (ndarray)
rng (RandomState | None)
- Return type:
None
- combine(suff_stat)[source]
Return this accumulator because fixed atoms have no sufficient statistics.
- Parameters:
suff_stat (Any)
- Return type:
PointMassAccumulator
- value()[source]
Return
Nonebecause fixed atoms have no sufficient statistics.- Return type:
None
- from_value(x)[source]
Return this accumulator because there is no state to restore.
- Parameters:
x (Any)
- Return type:
PointMassAccumulator
- key_merge(stats_dict)[source]
Register the key with empty statistics when configured.
- key_replace(stats_dict)[source]
Ignore keyed replacements because there is no accumulator state.
- acc_to_encoder()[source]
Return the equality-mask encoder for this atom.
- Return type:
PointMassDataEncoder
- class PointMassAccumulatorFactory(value, keys=None)[source]
Bases:
StatisticAccumulatorFactoryFactory for PointMassAccumulator.
- make()[source]
Create an empty point-mass accumulator.
- Return type:
PointMassAccumulator
- class PointMassEstimator(value, pseudo_count=None, suff_stat=None, name=None, keys=None)[source]
Bases:
ParameterEstimatorEstimator that always returns the configured point mass.
- Parameters:
- accumulator_factory()[source]
Return a factory for point-mass no-op accumulators.
- Return type:
PointMassAccumulatorFactory