Skip to content

fix: return single bucket when all scores are identical in _compute_buckets#16

Open
sl628 wants to merge 1 commit into
IABTechLab:mainfrom
sl628:fix/analytics-uniform-scores
Open

fix: return single bucket when all scores are identical in _compute_buckets#16
sl628 wants to merge 1 commit into
IABTechLab:mainfrom
sl628:fix/analytics-uniform-scores

Conversation

@sl628

@sl628 sl628 commented Jun 2, 2026

Copy link
Copy Markdown

Closes #15

When all scores are identical, np.percentile() collapses all boundaries to the same value, causing buckets p0–p75 to return count=0/reduced_centroid=null while all records pile into the final bucket.

The fix runs PCA first, then checks if all scores are unique before computing percentiles. If all scores are identical, it returns a single p0-p100 bucket with the correct count and centroid.

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.

GET /analytics returns misleading bucket distribution when all scores are identical

1 participant