Skip to content

Align ARHMM initial sample history with likelihood lag order - #473

Open
AHMETHAKANBEZIR1 wants to merge 1 commit into
probml:mainfrom
AHMETHAKANBEZIR1:fix/arhmm-history-order
Open

AHMETHAKANBEZIR1 wants to merge 1 commit into
probml:mainfrom
AHMETHAKANBEZIR1:fix/arhmm-history-order

Conversation

@AHMETHAKANBEZIR1

Copy link
Copy Markdown

LinearAutoregressiveHMM.sample(..., prev_emissions=...) reads the supplied history in the opposite lag order from compute_inputs. The documented history is chronological (y[-L+1:0]), while the sampling scan expects newest-to-oldest lag blocks. Default zero history and one-lag models hide the discrepancy.

Reverse the initial history once on entry to the sampler, and clarify the shared oldest-to-newest convention in both docstrings. Keep the random keys, transition sampling, and subsequent scan updates unchanged.

For two lags, weights [2, 3] and history [1, 10], the first conditional mean should be 2*10 + 3*1 = 23; the existing sampler uses 2*1 + 3*10 = 32. With the same key, the sampled values differ by approximately 9.

Validation on Windows / Python 3.12.14 / JAX 0.12.0 / tfp-nightly 0.26.0-dev20261020, CPU:

  • New regressions on unchanged main: 8 failed / 5 controls passed; with this fix: 13 passed.
  • Cover 1/2/3 lags, scalar/vector emissions, eager/JIT execution, and explicit/omitted zero history. Each of five sampled timesteps is compared with its conditional distribution using independently assembled lag inputs and the same random keys.
  • Full pytest --cov=./: 250 passed (737 warnings), 81% coverage.
  • Configured docstring check: 99.2%, above the required 66%; git diff --check passes.

Prepared autonomously with OpenAI Codex, including code and tests; no independent human review is claimed.

Co-authored-by: OpenAI Codex <noreply@openai.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant