Skip to content

Use integer index arrays in score_agg_metrics - #248

Open
rpinho wants to merge 1 commit into
ArcInstitute:mainfrom
rpinho:fix-score-normalization
Open

rpinho wants to merge 1 commit into
ArcInstitute:mainfrom
rpinho:fix-score-normalization

Conversation

@rpinho

@rpinho rpinho commented Nov 16, 2026

Copy link
Copy Markdown

There's a bug in score_agg_metrics: when either normalization-index list is empty, NumPy creates a float64 array, and indexing with it raises IndexError.

Aggregates containing only mae, only discrimination_score_l1, or only overlap_at_N all fail. For mae with user=1 and baseline=2, or either other metric with user=0.75 and baseline=0.5, the metric score and avg_score should both be 0.5.

This sets dtype=int on both index arrays.

Test: test_score_single_normalization_group in tests/test_score.py fails on main in all three cases and passes here. Full suite: 55 passed; Ruff formatting and CLI help pass. ty check retains the same seven baseline diagnostics.

🤖 Generated with Claude Code

https://claude.ai/code/session_01LKxc9GKLwnyeV2jaZBxH9N

@gemini-code-assist gemini-code-assist Bot 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.

Code Review

This pull request updates src/cell_eval/_score.py to explicitly set the data type to int when creating numpy arrays for index tracking, and adds a new test case in tests/test_score.py to ensure score_agg_metrics correctly handles scenarios with single normalization groups. I have no feedback to provide as there were no review comments.

@rpinho

rpinho commented Nov 24, 2026

Copy link
Copy Markdown
Author

Let me know if you have any thoughts on this one.

This branch has not been deployed

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

1 participant