All problems
Train-Serve Skew Ratio
Problem
Compute the worst relative train-serve feature skew: the maximum over features of abs(serve_mean - train_mean) / max(abs(train_mean), 1e-9). Compare only up to the shorter input; empty input returns 0.0.
Hint
Feature statistics that differ between training and serving pipelines cause silent degradation.
Test cases
case 1
in: [[1,2,3],[1.1,1.9,3.3]]
expected: 0.10000000000000009
case 2
in: [[0,5],[0,10]]
expected: 1
case 3
in: [[2],[2]]
expected: 0
case 4
in: [[],[]]
expected: 0
Starter codePython
def train_serve_skew(train_means, serve_means):
# Your code here
pass4 test cases · run your code against them in the editor