Back to questions
JuniorTheoryCommon
What does this program print?
import numpy as np
train = np.array([[100.0, 1.0], [300.0, 3.0], [100.0, 1.0], [300.0, 3.0]])
live = np.array([[350.0, 4.0], [350.0, 4.0]])
shift = np.abs(live.mean(axis=0) - train.mean(axis=0)) / train.std(axis=0)
print(round(shift[0], 1), round(shift[1], 1))1.5 2.0
- Expecting
1.3 1.7: numpy'sstddivides by the number of rows, not by rows minus one, so the training spreads are100and1, and the shifts are1.5and2.0. - Expecting
0.75 1.0: the standard deviation is not the range, so values100and300around the mean200give a deviation of100, not200.
- Which of the two features moved more, judging by raw units and by deviations?
- Why is the spread taken from the training set rather than from the new rows?