fix(identification): warn once per posterior on weak max-share identification - #229
Draft
thomaspinder wants to merge 1 commit into
Draft
fix(identification): warn once per posterior on weak max-share identification#229thomaspinder wants to merge 1 commit into
thomaspinder wants to merge 1 commit into
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## feat/145-max-share-identification #229 +/- ##
=================================================================
Coverage 95.1% 95.1%
=================================================================
Files 45 45
Lines 3240 3247 +7
Branches 397 397
=================================================================
+ Hits 3082 3089 +7
Misses 113 113
Partials 45 45 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
thomaspinder
force-pushed
the
feat/145-max-share-identification
branch
2 times, most recently
from
July 29, 2026 21:10
f06fbe5 to
5d5d731
Compare
thomaspinder
marked this pull request as draft
July 29, 2026 22:01
`MaxShare._warn_weakly_identified` ran on every `identify()` call and embedded the eigenvalue ratio to 3 dp. Under time-varying volatility the ratio moves with `L_t`, so `shock_matrix(at="all")`'s per-t loop produced a distinct message each period and Python's warnings registry deduped nothing — up to T warnings for one call. The singular and explosive warnings already fire once, via `_spectral_cache`, but the degeneracy check depends on `L` and so cannot ride on that cache directly. Track the cache key of the posterior the warning last fired for in a new `_warned_weak_for` private attr and warn only on the first crossing per posterior. `_band_eigen` now returns that key alongside the eigen quantities, and both it and `_spectral_accumulator` derive it from a shared `_cache_key` helper so the memoised sweep and the one-shot warning agree on what "the same posterior" means. The message says it is warned once per posterior and points at `max_share_diagnostics` for the per-period picture; the per-call eigen-ratio diagnostics are unchanged. Fixes #202 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Egjd7ToFeb9TQqFnfRQZxV
thomaspinder
force-pushed
the
fix/202-weak-id-warning-dedup
branch
from
July 29, 2026 22:08
70b9836 to
1f58493
Compare
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
Follow-up on the max-share branch (#200), stacked on
feat/145-max-share-identification:MaxShare's weak-identification warning fired peridentify()call with the eigen ratio embedded to 3 dp — undershock_matrix(at="all")with time-varying volatility the ratio varies with each period's Cholesky factor, defeating the warnings-registry dedup (measured: 76 warnings on one call). It now warns once per posterior, keyed alongside the spectral cache, on the first crossing rather than the first call (a healthy first period doesn't spend the posterior's one warning). The message states the once-per-posterior semantics and points atmax_share_diagnostics()with an explicitLfor the per-period picture. Per-call eigen-ratio diagnostics unchanged.Tests include a ramped time-varying-volatility stub (all 199 periods weak, ~76 distinct ratios) pinning exactly one warning, a first-crossing-not-first-call pin, a fresh-posterior re-warn pin, and the constant-volatility regression pin. Reverting only the dedup guard fails 3 tests with the original 76-warning behaviour.
Closes #202
Gates
88 identification/pipeline tests green; branch fast suite 583 passed; ruff/ty clean.
🤖 Generated with Claude Code
https://claude.ai/code/session_01Egjd7ToFeb9TQqFnfRQZxV