Repository navigation
Pair bidirectional states by their forward emissions - #89
Merged
Merged
Conversation
For the alternating biased coins the Eq. (15) graph has two closed components with the right stationary marginals and the same anatomy gap: the true joint and the one with the forward labels swapped. The tie fell to the repr of the reverse state labels, which depend on PYTHONHASHSEED, so five of the seeds 0-7 paired the forward states out of phase. _joint_pi_minimum_support now keeps only components whose forward states emit as the forward machine does before applying the anatomy-gap and support tie-breaks.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
BidirectionalEpsilonMachine.from_forwardpaired forward and reverse causal states according toPYTHONHASHSEEDfor the alternating biased coins. The Eq. (15) graph has two closed components with the right stationary marginals and the same anatomy gap: the true joint, and the joint with the forward labelsAandBswapped._build_eq15_graphweights edges by the reverse machine's probabilities alone, so both components are valid chains, and the tie fell to thereprof the reverse state labels. Five of the seeds 0–7 gave the swapped joint.forward_machine: started fromπ(A, ·) / π⁺(A), the bidirectional machine emitted withB's coin, so word probabilities given a forward state were off by up to 0.3, andPr(S⁺, S⁻)paired each forward state with the wrong reverse state._forward_emission_mismatchchecksΣ_γ π(α, γ) Pr(x | (α, γ)) = π⁺(α) Pr(x | α)for every forward stateαand symbolx._joint_pi_minimum_supportkeeps the marginal-matching components that pass it (exactly in symbolic mode, withinmarginal_tolotherwise) before the anatomy-gap and support tie-breaks, and falls back to the marginal-matching pool if none does.Test plan
tests/test_bidirectional_construction.py, three new tests: the emission check accepts the true component and rejects the swapped one (mismatch 0.15); the bidirectional machine reproducesPr(w | S⁺ = α)on all words of length 6; and the same check in subprocesses withPYTHONHASHSEED0–7. Without the fix, the emission and hash-seed tests fail.ruff check,ruff format --checkon the changed filesty check: exit 0, no diagnostics in the changed lines