Skip to content
DeepForgeby svx
All problems
EasyOptimizationop-375

Parameter Update Relative Change

Problem

The relative parameter change is ||w_new - w_old|| / max(||w_old||, eps).

Given the two parameter vectors and eps, return the relative change.

Hint

Use the Euclidean norms of the update and of the old parameters.

Test cases

case 1
in: [[1,0],[1,1]]
expected: 1
case 2
in: [[1,1],[1,1]]
expected: 0
case 3
in: [[0,0],[3,4]]
expected: 5000000000000
Starter codePython
def parameter_update_relative_change(w_old, w_new, eps=1e-12):
    # Your code here
    pass

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