What the Scaler Remembered

Machine Learning in CodeEasy+10 XP+10

What the Scaler Remembered

A fitted MinMaxScaler keeps two numbers for each column, and that's all it learns.

Task: write learned_ranges(table).

  • table is a dict mapping column names to lists of numbers.
  • Fit a MinMaxScaler on the table.
  • Return a dict that maps each column name to [smallest, largest], using the values the scaler learned (data_min_ and data_max_), as plain floats.

Examples

table = {"weight": [110, 130, 150, 160, 170], "sweet": [2, 3, 6, 7, 8]}
returns {'weight': [110.0, 170.0], 'sweet': [2.0, 8.0]}
table = {"temp": [-5.5, 12.0, 30.25], "rain": [0, 0, 14]}
returns {'temp': [-5.5, 30.25], 'rain': [0.0, 14.0]}

Hints

Solve it to unlock the solution

Once your code passes every test, a reference solution shows up here so you can compare it with yours.

solution.py
CtrlEnterto run