Add per-panelist consistency test via own-score permutation#469
Open
kgdunn wants to merge 2 commits into
Open
Conversation
`panel_consistency` scores each panelist against a reshuffle of their own scores: the product labels are permuted within each attribute (keeping the panelist's own values, only reassigning which product got which), and the mean eta-squared product effect plus the agreement with the leave-one-out panel consensus are recomputed. The null is built entirely from the panelist's own data - no simulated reference. A panelist carrying a real, reproducible signal beats almost every reshuffle (small p-value); a noise rater is indistinguishable from its own permutations. Returns a PanelConsistency with per-panelist discrimination / agreement and their permutation p-values, plus a `consistent` flag gated on the discrimination p-value (agreement is reported but not gated, since a reproducible rater may still rank products differently from the panel). Deterministic given random_state. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018M9u5EpSjHa3mjNaYDJ7qq
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Add a test with a rater who discriminates over products the rest of the panel never rated, so agreement cannot be formed while discrimination still can. This exercises the two branch arcs (undefined agreement in the permutation loop, and a cell with no leave-one-out consensus) that the balanced-panel tests did not reach. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018M9u5EpSjHa3mjNaYDJ7qq
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
process_improve.sensory.panel_consistency: a per-panelist reliability test that separates raters carrying a real, reproducible product signal from those whose scores are noise - built entirely from each panelist's own data.PanelConsistency(per-panelistdiscrimination/p_discrimination,agreement/p_agreement,consistent, plus theinconsistentlist).consistentgates on the discrimination p-value (does the panelist separate the products beyond their own noise); agreement is reported but not gated, since a reproducible rater can still rank the products differently from the panel (that is disagreement, a separate axis already inpanel_scorecard).random_state.Test plan
uv run pytest tests/test_sensory.py --no-cov(59 passed). New tests: a random rater is flagged inconsistent with the highest discrimination p-value while the strong genuine raters clear their own-permutation null; degenerate panelists (a flat rater with no variance, a single-product rater) return NaN p-values and are not consistent; output is seed-stable and a non-positive permutation count raises.uv run ruff check .anduv run mypy src/process_improvepass.Checklist
pyproject.toml(MINOR:1.58.0->1.59.0, new public API;CITATION.cffsynced)ruff check .passesCHANGELOG.mdupdated🤖 Generated with Claude Code
https://claude.ai/code/session_018M9u5EpSjHa3mjNaYDJ7qq
Generated by Claude Code