Repository navigation
feat: persist leftover observed Y and expected E (v2.12.20) #526
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from 1 commit
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| # 2.12.20 — Leftover observed Y and expected E | ||
|
|
||
| ## Added | ||
|
|
||
| - Persist leftover observed score `Y` and expected score `E[Y|θ, item]` | ||
| on each closest/farthest leftover pair so leftover residual | ||
| `R = Y − E` is checkable (ADR 0168). Missing cells stay out of the | ||
| factorization. Existing leftover rows are derived; migration `0108` | ||
| deletes incomplete rows rather than inventing `Y` or `E`. | ||
| - After `make seed`, leftover pair badges name observed, expected, and | ||
| leftover residual above the member list. Click still opens that post. | ||
| Copy tells the buyer to check leftover residual equals observed minus | ||
| expected. Do not invent a leftover score or a second theta. |
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,66 @@ | ||
| # ADR 0168 — Persist leftover observed Y and expected E[Y|θ, item] | ||
|
|
||
| **Decision status:** Accepted | ||
| **Date:** 2026-08-24 | ||
|
|
||
| Amends [ADR 0048](0048-persist-lsirm-leftover-pairs.md) and | ||
| [ADR 0049](0049-leftover-pair-report-ui.md). Independent of leftover-map | ||
| coordinates, leftover criterion landing, leftover complete-case | ||
| coverage, leftover-map axis share, leftover comparison-strip reuse, | ||
| and two-axis leftover-map distance. | ||
|
|
||
| ## Context | ||
|
|
||
| ADR 0048 already computes leftover residual `R = Y − E[Y|θ, item]` | ||
| after IRT main effects (Jeon et al., 2021, eq. 3; Gabriel, 1971) and | ||
| persists closest/farthest pairs with `leftover_distance` and | ||
| `leftover_residual`. The buyer could see distance `d` but could not | ||
| check that residual identity: observed `Y` and expected `E` were | ||
| computed, then dropped. | ||
|
|
||
| Backfilling `Y = R` and `E = 0` would invent an expected score. | ||
| Persisting only `R` leaves the identity uncheckable. | ||
|
|
||
| ## Decision | ||
|
|
||
| Each leftover pair persists `leftover_observed_score` (`Y`) and | ||
| `leftover_expected_score` (`E[Y|θ, item]`) next to | ||
| `leftover_residual`. The check | ||
| `abs(R − (Y − E)) < 1e-9` is named | ||
| `leftover_pair_residual_identity`. Missing or non-finite cells never | ||
| become pairs. Existing leftover rows are derived: migration `0108` | ||
| deletes incomplete rows so rebuild/seed rewrites honest `Y` and `E` | ||
| instead of fabricating them. | ||
|
|
||
| Do not invent a leftover score. Do not invent a second theta. | ||
|
|
||
| After `make seed`, leftover pair badges name observed, expected, and | ||
| leftover residual above the member list. Click still opens that post. | ||
| Copy tells the buyer to check leftover residual equals observed minus | ||
| expected. | ||
|
|
||
| ## Consequences | ||
|
|
||
| `GET /api/reports/{grouping}/{period}` returns `leftover_observed_score` | ||
| and `leftover_expected_score` on each pair. Hidden posts stay hidden | ||
| through the same ABAC join as members. Migration `0108` upgrades | ||
| volumes that already applied `0012`. Fresh `0001` schema includes the | ||
| same columns and identity check. | ||
|
|
||
| ## Related | ||
|
|
||
| Does not mix into leftover persist-map, leftover criterion landing, | ||
| leftover complete-case coverage, leftover-map axis share, leftover | ||
| comparison-strip reuse, or two-axis leftover-map distance. Issues #79 | ||
| and #87 stay open. | ||
|
|
||
| ## References | ||
|
|
||
| Gabriel, K. R. (1971). The biplot graphic display of matrices with | ||
| application to principal component analysis. *Biometrika, 58*(3), | ||
| 453–467. https://doi.org/10.1093/biomet/58.3.453 | ||
|
|
||
| Jeon, M., Jin, I. H., Schweinberger, M., & Baugh, S. (2021). Mapping | ||
| unobserved item–respondent interactions: A latent space item response | ||
| model with interaction map. *Psychometrika, 86*(2), 378–403. | ||
| https://doi.org/10.1007/s11336-021-09762-5 |
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
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
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📝 Info: Residual identity check is float-safe
The check constraint
leftover_pair_residual_identityrequiresabs(R-(Y-E))<1e-9. In leftover_pairs.py,Rismatrix-expectedwhileYandEare the same operands, soRandY-Ediffer only by float epsilon (~1e-16). Rebuild/seed inserts cannot spuriously fail the constraint.Was this helpful? React with 👍 or 👎 to provide feedback.