Premium problem30. Overall Accuracy Across Subgroups

Medium Locked

Overall accuracy is the law of total probability in disguise:

P(correct)=∑iP(correct∣group i) P(group i)P(\text{correct}) = \sum_i P(\text{correct} \mid \text{group } i)\,P(\text{group } i)

Here you are given raw counts per group rather than proportions, so convert them to weights first. Return the overall accuracy.

Input

group_sizes = [700, 300]
group_accuracies = [0.95, 0.6]

Output

0.845

Premium problem

This one's part of Premium. Unlock the full Probability track plus every other premium problem on the site.

Implement solve(...)