Skip to content
DeepForgeby svx
All problems
MediumML Fundamentalsml-121

Learning Curve Gap

Problem

Compute the gap between validation and training error at each learning-curve size: val_error - train_error element-wise.

Empty input returns [].

Hint

A shrinking positive gap suggests the model is starting to generalize.

Test cases

case 1
in: [[0.5,0.3,0.2],[0.6,0.5,0.45]]
expected: [0.09999999999999998,0.2,0.25]
case 2
in: [[1,2],[1,2]]
expected: [0,0]
case 3
in: [[0.9],[0.1]]
expected: [-0.8]
case 4
in: [[],[]]
expected: []
Starter codePython
def learning_curve_gap(train_errors, val_errors):
    # Your code here
    pass

4 test cases · run your code against them in the editor