Skip to content

feat(cast/explain): candidateScoreNonWinnerQMGap (76767676)#747

Merged
chitcommit merged 1 commit into
mainfrom
auto/76767676-cast-explain-non-winner-qm-am-gap
Jun 16, 2026
Merged

feat(cast/explain): candidateScoreNonWinnerQMGap (76767676)#747
chitcommit merged 1 commit into
mainfrom
auto/76767676-cast-explain-non-winner-qm-am-gap

Conversation

@chitcommit

Copy link
Copy Markdown
Contributor

Summary

  • Adds candidateScoreNonWinnerQMGap to buildCastExplanation(): absolute gap between non-winner quadratic mean and arithmetic mean (QM - AM)
  • Present whenever >= 3 candidates — no zero restriction
  • Always >= 0 by Power Mean inequality; zero when all non-winners tied
  • Variance identity: QMGap * (QM + AM) === stdDev^2 (from QM^2 - AM^2 = stdDev^2)
  • For n=3: sqrt((r^2+t^2)/2) - (r+t)/2
  • Additive-scale complement to candidateScoreNonWinnerQMToAMRatio

Test plan

  • 76767676-1: present when >= 3 candidates
  • 76767676-2: always finite and >= 0
  • 76767676-3: identity — gap + AM === QM
  • 76767676-4: for n=3 equals sqrt((r^2+t^2)/2) - (r+t)/2
  • 76767676-5: absent on cast:no_match
  • 76767676-6: absent when fewer than 3 candidates
  • 76767676-7: variance identity — gap*(QM+AM) === stdDev^2
  • 76767676-8: tool description documents candidateScoreNonWinnerQMGap

https://claude.ai/code/session_01VKBFeSfC62NKttk4spVHsB


Generated by Claude Code

Add candidateScoreNonWinnerQMGap: absolute gap between non-winner quadratic mean
and arithmetic mean (QM - AM). Always >= 0 by Power Mean inequality. Carries the
variance identity gap*(QM+AM) === stdDev^2, which follows from QM^2 - AM^2 = stdDev^2.
For n=3: sqrt((r^2+t^2)/2) - (r+t)/2. Additive complement to QMToAMRatio. 8 tests:
presence, bounds, identity (gap+AM=QM), n=3 formula, no_match absence, sub-threshold
absence, variance identity, and tool-description documentation.

https://claude.ai/code/session_01VKBFeSfC62NKttk4spVHsB
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@chitcommit chitcommit merged commit 43b8832 into main Jun 16, 2026
3 checks passed
@coderabbitai

coderabbitai Bot commented Jun 16, 2026

Copy link
Copy Markdown

Caution

Review failed

An error occurred during the review process. Please try again later.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch auto/76767676-cast-explain-non-winner-qm-am-gap

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

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