Transformation

Documentation for the transformation module.

mlearn.algorithms.transform.standardize(x)[source]

Perform z-transformation to get standard score of input matrix.

Parameters:x (numpy.array) – Input matrix to be standardized.
Returns:x_stand – Standardized matrix.
Return type:numpy.array

Notes

\[z = \frac{x - \mu}{\sigma}\]

References

[1]https://en.wikipedia.org/wiki/Standard_score

Examples

>>> # The input matrix
>>> x = np.array([[1, 11, 104],
                  [1, 15, 99],
                  [1, 22, 89],
                  [1, 27, 88]])
>>> standardize(x)
[[ 0.         -1.25412576  1.33424877]
 [ 0.         -0.60683505  0.59299945]
 [ 0.          0.52592371 -0.88949918]
 [ 0.          1.3350371  -1.03774904]]