Skip to content

Instantly share code, notes, and snippets.

@andreaschandra
Created April 2, 2018 15:38
Show Gist options
  • Save andreaschandra/3d1134b68f0a9a5be5ca5b8f8d491e2d to your computer and use it in GitHub Desktop.
Save andreaschandra/3d1134b68f0a9a5be5ca5b8f8d491e2d to your computer and use it in GitHub Desktop.
# Sebelum mean removal
print("Mean = ", input.mean(), "\n", "Std deviation = ", input.std(axis = 0))
output:
Mean = 4.66666666667
Std deviation = [ 2.1602469 2.3570226 2.05480467]
# Sesudah mean removal
data_scaled = preprocessing.scale(input)
print("Mean = ", data_scaled)
print("Std deviation = ", data_scaled.std(axis = 0))
output:
Mean = [[ 0.46291005 -0.70710678 -0.16222142]
[-1.38873015 1.41421356 -1.13554995]
[ 0.9258201 -0.70710678 1.29777137]]
Std deviation = [ 1. 1. 1.]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment