PythiloLesson 1 of 12 · progress kept in this browser

Train-only Standardization

Fit the centre and population deviation on training values only. Reuse both statistics for validation; a constant training column uses scale one.

train = [0, 2]
mean = sum(train) / len(train)
print([(value-mean) / 1 for value in [1, 3]])
Your task

normalize(train, values) returns values standardized with the training mean and population standard deviation. train is nonempty. Use scale 1 for a constant column.