Created
December 24, 2016 08:02
-
-
Save jovianlin/bc6cf9aa44199ba851cebed86ff1a057 to your computer and use it in GitHub Desktop.
StandardScaler implementation for standardizing data before model-training
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def normalize(train, test): | |
| mean, std = train.mean(), test.std() | |
| train = (train - mean) / std | |
| test = (test - mean) / std | |
| return train, test |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment