Given a table (list of rows, all the same length) and a method, scale each column:
"minmax": (x − min) / (max − min); a constant column becomes all 0.0"zscore": (x − mean) / population standard deviation; a constant column becomes all 0.0Round results to 4 decimals and return the scaled table in row form. Also return the parameters needed
to scale new data later: {"rows": [...], "params": [[a, b], ...]} where [a, b] is [min, max] or
[mean, std] per column (rounded to 4 decimals).
Implement scale. Input: rows: list[list[float]], method: str. Returns: dict.
def scale(rows: list[list[float]], method: str) -> dict:
return {"rows": rows, "params": []}
Run executes the public tests. Submit grades against public and hidden tests.
Given a table (list of rows, all the same length) and a method, scale each column:
"minmax": (x − min) / (max − min); a constant column becomes all 0.0"zscore": (x − mean) / population standard deviation; a constant column becomes all 0.0Round results to 4 decimals and return the scaled table in row form. Also return the parameters needed
to scale new data later: {"rows": [...], "params": [[a, b], ...]} where [a, b] is [min, max] or
[mean, std] per column (rounded to 4 decimals).
Implement scale. Input: rows: list[list[float]], method: str. Returns: dict.
def scale(rows: list[list[float]], method: str) -> dict:
return {"rows": rows, "params": []}
Run executes the public tests. Submit grades against public and hidden tests.