NumPy allowed · plain Python earns 10 bonus points
Implement the Population Stability Index, the standard real metric MLOps pipelines use to detect feature/label distribution drift between training and production.
Implement psi(expected_pct, actual_pct). Both lists give the fraction of data in each of the same N bins (they sum to 1 each). PSI = sum((actual[i]-expected[i]) * ln(actual[i]/expected[i])) over all bins. Treat any bin with 0 in either list as contributing 0 to the sum (skip it) to avoid a log(0) or division by zero.
psi(expected_pct: list[float], actual_pct: list[float]) -> float