mixle.stats.combinator.ignored module¶
Distribution wrapper that keeps a child’s parameters fixed during estimation.
IgnoredDistribution delegates the child’s likelihood, sampling, and encoding
unchanged; only its accumulator is a no-op, so the child contributes to model
scores but is not re-estimated.
- class IgnoredDistribution(dist, name=None)[source]
Bases:
SequenceEncodableProbabilityDistributionFixed-parameter wrapper that delegates the wrapped distribution’s likelihood exactly.
- Parameters:
dist (SequenceEncodableProbabilityDistribution | None)
name (str | None)
- compute_capabilities()[source]
Return the compute capabilities delegated from the wrapped distribution.
- compute_declaration()[source]
Return a declaration that marks this wrapper as carrying no estimable statistics.
- get_prior()[source]
Delegate to the wrapped distribution’s
get_prior(Ignored owns no prior).- Return type:
- set_prior(prior)[source]
Delegate to the wrapped distribution’s
set_prior;Nonekeeps existing behavior.- Parameters:
prior (Any)
- Return type:
None
- expected_log_density(x)[source]
Delegate prior-expected log-density to the wrapped distribution.
- Parameters:
x (T)
- Return type:
- seq_expected_log_density(x)[source]
Delegate vectorized prior-expected log-density to the wrapped distribution.
- Parameters:
x (E)
- Return type:
- density(x)[source]
Evaluate the density of the IgnoredDistribution at x.
- Parameters:
x (T) – Type corresponding to attribute ‘dist’.
- Returns:
Density of attribute ‘dist’ at x
- Return type:
- log_density(x)[source]
Evaluate the log-density of the IgnoredDistribution at x.
- Parameters:
x (T) – Type corresponding to attribute ‘dist’.
- Returns:
log-density of attribute ‘dist’ at x.
- seq_log_density(x)[source]
Return vectorized log-density values for sequence-encoded observations.
- Parameters:
x (E)
- Return type:
- backend_seq_log_density(x, engine)[source]
Engine-neutral vectorized log-density delegated to the wrapped distribution.
- classmethod backend_stacked_params(dists, engine)[source]
Return stacked child parameters for homogeneous ignored-wrapper mixtures.
- classmethod backend_stacked_log_density(x, params, engine)[source]
Return an
(n, k)matrix of delegated child log densities.
- classmethod backend_stacked_sufficient_statistics(x, weights, params, engine)[source]
Return empty legacy statistics for each ignored component.
- sampler(seed=None)[source]
Return a sampler for drawing observations from this distribution.
- Parameters:
seed (int | None)
- Return type:
IgnoredSampler
- estimator(pseudo_count=None)[source]
Return an estimator for fitting this distribution from data.
- Parameters:
pseudo_count (float | None)
- Return type:
IgnoredEstimator
- dist_to_encoder()[source]
Return the data encoder used by this distribution for vectorized methods.
- Return type:
IgnoredDataEncoder
- class IgnoredSampler(dist, seed=None)[source]
Bases:
DistributionSamplerSampler that delegates exactly to the fixed wrapped distribution.
- Parameters:
dist (IgnoredDistribution)
seed (int | None)
- class IgnoredAccumulator(encoder=NullDataEncoder(), name=None)[source]
Bases:
SequenceEncodableStatisticAccumulatorNo-op accumulator used when a wrapped distribution should not update during estimation.
- Parameters:
encoder (DataSequenceEncoder | None)
name (str | None)
- update(x, weight, estimate)[source]
Ignore a single weighted observation.
- Parameters:
x (T)
weight (float)
estimate (IgnoredDistribution | None)
- Return type:
None
- seq_update(x, weights, estimate)[source]
Ignore a batch of encoded observations.
- Parameters:
x (E)
weights (ndarray)
estimate (IgnoredDistribution | None)
- Return type:
None
- seq_update_engine(x, weights, estimate, engine)[source]
Ignore a batch of engine-resident observations.
- Return type:
None
- initialize(x, weight, rng)[source]
Ignore a single initialization observation.
- Parameters:
x (T)
weight (float)
rng (RandomState | None)
- Return type:
None
- seq_initialize(x, weight, rng)[source]
Ignore a batch of initialization observations.
- Parameters:
x (E)
weight (ndarray)
rng (RandomState | None)
- Return type:
None
- combine(suff_stat)[source]
Return this accumulator because ignored statistics have no state.
- Parameters:
suff_stat (Any)
- Return type:
IgnoredAccumulator
- value()[source]
Return
Nonebecause ignored statistics are intentionally empty.- Return type:
None
- from_value(x)[source]
Return this accumulator because there is no state to restore.
- Parameters:
x (Any)
- Return type:
IgnoredAccumulator
- key_merge(stats_dict)[source]
Perform no keyed merge because ignored statistics have no state.
- key_replace(stats_dict)[source]
Perform no keyed replacement because ignored statistics have no state.
- acc_to_encoder()[source]
Return the encoder associated with the wrapped distribution.
- Return type:
IgnoredDataEncoder
- class IgnoredAccumulatorFactory(encoder=NullDataEncoder(), name=None)[source]
Bases:
StatisticAccumulatorFactoryCreate no-op accumulators for ignored distributions.
- Parameters:
encoder (DataSequenceEncoder | None)
name (str | None)
- make()[source]
Create an ignored-distribution accumulator.
- Return type:
IgnoredAccumulator
- class IgnoredEstimator(dist=None, pseudo_count=None, suff_stat=None, keys=None, name=None)[source]
Bases:
ParameterEstimatorEstimator that returns the wrapped distribution unchanged inside an ignored wrapper.
- Parameters:
- accumulator_factory()[source]
Return a factory that creates no-op ignored accumulators.
- get_prior()[source]
Delegate to the wrapped distribution’s
get_prior(Ignored estimates nothing of its own).- Return type:
- class IgnoredDataEncoder(encoder=NullDataEncoder())[source]
Bases:
DataSequenceEncoderEncoder that delegates to the wrapped distribution’s encoder.
- Parameters:
encoder (DataSequenceEncoder | None)
- seq_encode(x)[source]
Encode observations with the wrapped distribution’s encoder.
- row_count(x)[source]
Return the wrapped encoder’s row count for a payload this wrapper produced.
seq_encodereturns the child payload verbatim, so the child encoder is the only authority on that layout. Without this delegation the abstract default had to guess the leading count from the payload’s shape, and for every child whose encoding is not a single aligned block it guessed nothing and raisedNotImplementedErrornaming this class – which killed the frozen/identifier column path outright (a pandas datetime column, an identifier string column, anypd.NA-bearing column: each encodes to a categorical(indices, levels)pair whose two members have different lengths whenever the level count differs from the row count). The crash surfaced fromseq_encode’s row-conservation check, so it took downoptimize/Model.fitfor the exact tables the frozen-column stand-in exists to support.