Confidence calibration buckets
To check whether a churn model's confidence scores are calibrated, the eval groups predictions into ten confidence buckets and counts outcomes per bucket. Given equal-length lists scores (integers 0-100) and labels (0 or 1), assign each prediction to bucket floor(score / 10), except that a score of 100 goes into bucket 9. Return a list of exactly 10 rows, where row i is [count of predictions in bucket i, count of those with label 1]. Example: scores = [5, 95, 42, 100], labels = [0, 1, 1, 1] puts 5 in bucket 0, 42 in bucket 4, and 95 and 100 in bucket 9.
calibration_counts(scores: list[int], labels: list[int]) → list[list[int]][[5,95,42,100],[0,1,1,1]]out[[1,0],[0,0],[0,0],[0,0],[1,1],[0,0],[0,0],[0,0],[0,0],[2,2]]State your approach and its time/space complexity out loud before you optimize. Handle the edge cases (empty input, duplicates, overflow), and say why you chose this over the brute force. Green tests are the floor, not the grade.
[[5,95,42,100],[0,1,1,1]][[1,0],[0,0],[0,0],[0,0],[1,1],[0,0],[0,0],[0,0],[0,0],[2,2]]not run yetsample