Code Room
Code reviewMediumcr-g633
Subject Feature engineeringLevel Mid–Senior~16 minCommon in Code quality & review interviewsIndustries Software development

Question

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.

Talk through your review
Code to reviewpython
import numpy as np def normalize_features(X):    # X shape: (n_samples, n_features); scale each FEATURE to mean 0, std 1    mean = X.mean(axis=1, keepdims=True)    std = X.std(axis=1, keepdims=True)    return (X - mean) / std
Run or narrate your approach, then ask the coach.