Skip to content

FIX: krippendorff_alpha NaN for unpairable identical ratings - #2844

Merged
Roman Lutz (romanlutz) merged 2 commits into
microsoft:mainfrom
ManoharPaturi:fix/krippendorff-unpairable-identical-ratings
Sep 26, 2026
Merged

Roman Lutz (romanlutz) merged 2 commits into
microsoft:mainfrom
ManoharPaturi:fix/krippendorff-unpairable-identical-ratings

Conversation

@ManoharPaturi

Copy link
Copy Markdown
Contributor

Fixes #2843.

reordered the early returns so the no-pairable-ratings check runs before the single-category perfect-agreement exit, making any dataset without pairable ratings return NaN consistently with the docstring and with the existing differing-ratings behavior.

verified with a 1000-case differential fuzz against an independent reference implementation (0 mismatches), a regression test that fails on main, the full krippendorff suite (47 green) and the 2693-test scorer-evaluation suite. ruff clean.

…ntical ratings

The num_categories == 1 early return reported perfect agreement before
the total_n == 0 degenerate check, so data where every item is rated by
a single rater (no pairable coincidences) produced alpha = 1.0 whenever
all ratings happened to be identical. The statistic is undefined in that
case; the docstring already promises NaN for undefined input.

Move the single-category early return after the coincidence construction
so unpairable data reaches the existing total_n == 0 NaN path while
pairable identical ratings still return 1.0.
Copilot AI balanced review requested due to automatic review settings September 25, 2026 16:24

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@romanlutz
Roman Lutz (romanlutz) added this pull request to the merge queue Sep 26, 2026
Merged via the queue into microsoft:main with commit c78a34a Sep 26, 2026
49 checks passed
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.

krippendorff_alpha reports 1.0 instead of NaN for single-rater identical ratings

3 participants