mixle.stats.latent.markov_stopping moduleΒΆ

Shared validation and bounded-failure contracts for stopping-time Markov models.

exception HiddenMarkovNonterminationError(*, mode, max_steps, last_state=None)[source]

Bases: RuntimeError

Raised when bounded stopping-time sampling does not reach its terminal event.

Parameters:
  • mode (str)

  • max_steps (int)

  • last_state (int | None)

Return type:

None

validated_state_ids(values, n_states, *, context, field)[source]

Return exact in-range state IDs without lossy integer coercion.

Parameters:
Return type:

frozenset[int] | None

validated_terminal_states(values, n_states, *, context)[source]

Return exact in-range terminal state IDs without lossy integer coercion.

Parameters:
Return type:

frozenset[int] | None

validated_terminal_values(values, *, context)[source]

Return an owned non-empty set of terminal emissions.

Parameters:
Return type:

frozenset[Any] | None

validate_terminal_reachability(initial, transitions, terminal_states, *, context)[source]

Require every initially reachable state to have a positive-probability path to termination.

Parameters:
Return type:

None

validated_terminal_step_cap(value)[source]

Return an exact positive stopping-time sampling bound.

Parameters:

value (Any)

Return type:

int

require_terminal_reached(reached, *, mode, max_steps, last_state=None)[source]

Raise the typed bounded-sampling failure when the stop event was not reached.

Parameters:
  • reached (bool)

  • mode (str)

  • max_steps (int)

  • last_state (int | None)

Return type:

None