Skip to content
DeepForgeby svx
All problems

Observation Normalization Stats

Problem

Compute per-feature normalization statistics for a batch of observation vectors.

Return [means, stds] where each standard deviation uses the population formula (divide by n) plus epsilon to avoid division by zero. An empty batch returns [[], []].

Hint

These statistics feed (obs - mean) / std for input normalization.

Test cases

case 1
in: [[[1,2],[3,4],[5,6]]]
expected: [[3,4],[1.632993171855452,1.632993171855452]]
case 2
in: [[[5]]]
expected: [[5],[1e-8]]
case 3
in: [[]]
expected: [[],[]]
case 4
in: [[[1,1],[1,1]]]
expected: [[1,1],[1e-8,1e-8]]
Starter codePython
def obs_norm_stats(observations, epsilon=1e-8):
    # Your code here
    pass

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