All problems
Lookahead Interpolation
Problem
Perform one Lookahead interpolation step.
Given fast weights, slow weights, and alpha, compute slow_new = slow + alpha * (fast - slow) elementwise, and set fast_new = slow_new. Return [slow_new, fast_new] as two lists.
Hint
Fast weights snap back to the interpolated slow weights after the update.
Test cases
case 1
in: [[2,4],[1,1],0.5]
expected: [[1.5,2.5],[1.5,2.5]]
case 2
in: [[0,0],[2,-2],0.25]
expected: [[1.5,-1.5],[1.5,-1.5]]
case 3
in: [[1,2,3],[1,2,3],0.9]
expected: [[1,2,3],[1,2,3]]
Starter codePython
def lookahead_interpolate(fast, slow, alpha):
# Returns [slow_new, fast_new]
# Your code here
pass3 test cases · run your code against them in the editor