Skip to content
DeepForgeby svx
All problems
MediumTime Seriests-249

RevIN Normalize

Problem

Apply reversible instance normalization to a window: subtract the mean and divide by the population standard deviation.

Return a list of zeros when the standard deviation is zero, and an empty list for an empty window.

Hint

RevIN normalizes each input window and reverses the transform on the output.

Test cases

case 1
in: [[1,2,3]]
expected: [-1.224744871391589,0,1.224744871391589]
case 2
in: [[5,5,5]]
expected: [0,0,0]
case 3
in: [[1,1,2,2]]
expected: [-1,-1,1,1]
case 4
in: [[]]
expected: []
Starter codePython
def revin_normalize(window):
    # Your code here
    pass

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