Code RoomFeature normalization axis error
MediumPrep Room Coding #2257

Feature normalization axis error

Code reviewCode quality & reviewMid–Senior~16 min

Review this Python feature-normalization function.

Downstream models trained on this perform worse than on raw features. What's the bug?

What a strong answer looks like

Separate real bugs from style. Rank issues by severity, point at the root cause rather than the symptom, and suggest a concrete fix, specific and kind.

0:00 of about 16 min
Mark a line and say what kind of problem it is.0 findings
1import numpy as np
2 
3def normalize_features(X):
4 # X shape: (n_samples, n_features); scale each FEATURE to mean 0, std 1
5 mean = X.mean(axis=1, keepdims=True)
6 std = X.std(axis=1, keepdims=True)
7 return (X - mean) / std
Which questions mattered is sealed until you submit. Telling you now would just be handing over the edge cases.