Basically, take a matrix and change it so that its mean is equal to 0 and variance is 1. I\'m using numpy\'s arrays so if it can already do it it\'s better, but I can implem
Use sklearn.preprocessing.scale
.
http://scikit-learn.org/stable/modules/generated/sklearn.preprocessing.scale.html
Here is an example.
>>> from sklearn import preprocessing
>>> import numpy as np
>>> X_train = np.array([[ 1., -1., 2.],
... [ 2., 0., 0.],
... [ 0., 1., -1.]])
>>> X_scaled = preprocessing.scale(X_train)
>>> X_scaled
array([[ 0. ..., -1.22..., 1.33...],
[ 1.22..., 0. ..., -0.26...],
[-1.22..., 1.22..., -1.06...]])
http://scikit-learn.org/stable/modules/preprocessing.html#standardization-or-mean-removal-and-variance-scaling