Skip to content

Add per-panelist consistency test via own-score permutation#469

Open
kgdunn wants to merge 2 commits into
mainfrom
claude/panel-consistency-permutation-ksh78i
Open

Add per-panelist consistency test via own-score permutation#469
kgdunn wants to merge 2 commits into
mainfrom
claude/panel-consistency-permutation-ksh78i

Conversation

@kgdunn

@kgdunn kgdunn commented Jul 23, 2026

Copy link
Copy Markdown
Owner

Summary

  • New 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.
  • For every panelist the product labels are permuted within each attribute (keeping the panelist's own score values, only reassigning which product got which), and two statistics are recomputed against that null: the mean eta-squared product effect, and the agreement with the leave-one-out panel consensus. A panelist with a real signal beats almost every reshuffle of their own scores (small permutation p-value); a noise rater is indistinguishable from their own permutations (p near 1).
  • Returns a PanelConsistency (per-panelist discrimination / p_discrimination, agreement / p_agreement, consistent, plus the inconsistent list). consistent gates 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 in panel_scorecard).
  • No simulation - the null is a reshuffle of the panelist's own values. Deterministic given 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 . and uv run mypy src/process_improve pass.

Checklist

  • Version bumped in pyproject.toml (MINOR: 1.58.0 -> 1.59.0, new public API; CITATION.cff synced)
  • Tests added or updated where relevant
  • ruff check . passes
  • CHANGELOG.md updated

🤖 Generated with Claude Code

https://claude.ai/code/session_018M9u5EpSjHa3mjNaYDJ7qq


Generated by Claude Code

`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

codecov Bot commented Jul 23, 2026

Copy link
Copy Markdown

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
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.

2 participants