Centred on Zero

Machine Learning in CodeMedium+10 XP+10

Centred on Zero

A running club has a table of members with columns on very different scales. You want to see one member's numbers after standard scaling.

Task: write standardise_row(table, row).

  • table is a dict mapping column names to lists of numbers.
  • Scale all of the table's columns with StandardScaler. Each column is centred on 0 and divided by its own spread.
  • Return the scaled values of row number row (counting from 0), as a list in column order, each rounded to 2 decimal places.

Examples

table = {"weight": [110, 130, 150, 160, 170], "sweet": [2, 3, 6, 7, 8]}
row = 0
returns [-1.58, -1.38]
table = {"km_per_week": [5, 20, 35, 50], "age": [25, 31, 40, 52], "races": [0, 2, 1, 5]}
row = 3
returns [1.34, 1.47, 1.6]

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