easy end_to_end

Feature Normalization Pipeline

Implement a feature normalization pipeline that supports both z-score normalization and min-max normalization.

Z-score normalization (standardization): $$x_{norm} = \frac{x - \mu}{\sigma + \epsilon}$$ where $\mu$ and $\sigma$ are computed per-feature (column-wise), $\epsilon = 10^{-7}$.

Min-Max normalization: $$x_{norm} = \frac{x - x_{min}}{x_{max} - x_{min} + \epsilon}$$ where min/max are per-feature, $\epsilon = 10^{-7}$.

Input:

  • x: data matrix of shape (N, D) — N samples, D features
  • method: string, either “zscore” or “minmax”

Output: Normalized data of shape (N, D).

Hints

normalization preprocessing feature-engineering pipeline
Detecting runtime...