PythiloLesson 9 of 12 · progress kept in this browser

Keep small cohorts visible without overclaiming their scores

An aggregate score can improve while a cohort becomes substantially worse. A deployment report should retain both cohort counts and error measurements so a reviewer can see how much evidence supports each number. Hiding small cohorts entirely can hide an important coverage problem.

This exercise reports mean absolute error for every named cohort and marks whether it reaches a required count. That count is a reporting threshold, not a statistical guarantee. Compare confidence and missingness before making a release decision, and define cohorts before inspecting results to reduce selective reporting.

groups=["new","new","returning"]
errors=[1.,3.,10.]
print({g:sum(e for k,e in zip(groups,errors) if k==g) for g in set(groups)})
Your task

Implement cohort_mae(groups,truth,predicted,min_count). Return dict group->{n,mae,supported}. Require equal nonempty lengths, positive integer min_count and finite truth/predictions. supported means n>=min_count.