mixle.stats.compute.mixture_evidence module¶

Canonical non-finite evidence semantics for finite-mixture kernels.

class ImpossibleEvidencePolicy(*values)[source]

Bases: StrEnum

How an E-step handles a row outside every component’s support.

exception InvalidMixtureEvidenceError(rows, reason)[source]

Bases: ValueError

Raised when component scores cannot define a mixture posterior.

Parameters:
  • rows (Any)

  • reason (str)

Return type:

None

class MixtureEvidence(log_evidence, responsibilities, impossible)[source]

Bases: object

Normalized evidence and responsibilities under the canonical policy.

Parameters:
  • log_evidence (Any)

  • responsibilities (Any)

  • impossible (Any)

validated_probability_vector(values, label, *, size=None)[source]

Return an owned non-empty probability simplex with optional fixed size.

Parameters:
Return type:

ndarray

validated_row_probability_matrix(values, label, *, shape)[source]

Return an owned finite non-negative matrix whose rows are probability simplexes.

Parameters:
Return type:

ndarray

validated_column_probability_matrix(values, label, *, shape)[source]

Return an owned finite non-negative matrix whose columns are probability simplexes.

Parameters:
Return type:

ndarray

validated_joint_probability_matrix(values, label, *, shape)[source]

Return an owned non-empty probability simplex arranged as a fixed-shape matrix.

Parameters:
Return type:

ndarray

normalize_mixture_log_scores(weighted_log_scores)[source]

Normalize a NumPy (rows, components) weighted log-score matrix.

Impossible rows retain -inf evidence and receive all-zero responsibilities, so they cannot fabricate sufficient statistics. A unique +inf component is the exact winner. NaN scores and multiple +inf components are ambiguous and raise a typed error.

Parameters:

weighted_log_scores (Any)

Return type:

MixtureEvidence

normalize_engine_mixture_log_scores(weighted_log_scores, engine)[source]

Engine-preserving counterpart of normalize_mixture_log_scores().

Parameters:
  • weighted_log_scores (Any)

  • engine (Any)

Return type:

MixtureEvidence

raise_for_invalid_log_evidence(log_evidence)[source]

Raise the typed evidence error when a generated scorer reports NaN.

Parameters:

log_evidence (Any)

Return type:

None