Skip to content

Instantly share code, notes, and snippets.

@jovianlin
Created December 24, 2016 08:02
Show Gist options
  • Select an option

  • Save jovianlin/bc6cf9aa44199ba851cebed86ff1a057 to your computer and use it in GitHub Desktop.

Select an option

Save jovianlin/bc6cf9aa44199ba851cebed86ff1a057 to your computer and use it in GitHub Desktop.
StandardScaler implementation for standardizing data before model-training
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