Min-Max Scaler

easy
Unit 4 · Preprocessing & Features0/3 to milestone

Scale every feature into [0, 1] using statistics learned on the training data only.

Implement a class MinMaxScaler with:

  • fit(X): store each column's min and max, return self
  • transform(X): (X - min) / (max - min). A constant column (max == min) maps to 0.
  • inverse_transform(Z): undo the scaling

Test data can fall outside the training range, so transformed values may be below 0 or above 1. That's expected.

#preprocessing#scaling2 visible + 1 hidden tests
solution.py · Python 3.13
Loading editor…
Run your code to see results. ⌘↵ to run · ⌘⇧↵ to submit
Min-Max Scaler · TechGradify