nimble.calculate.meanStandardDeviationNormalize

nimble.calculate.meanStandardDeviationNormalize(values1, values2=None)

Subtract the mean and divide by standard deviation for each element.

The normalization of values1 is calculated by subtracting its mean and dividing by its standard deviation. The mean and standard deviation of values1 are also used for the calculation on each element in values2, when applicable. This normalization is also known as “Standardization” and “Z-score normalization”.

Examples

>>> lst1 = [[1], [2], [3], [4], [5]]
>>> X1 = nimble.data(lst1)
>>> meanStandardDeviationNormalize(X1)
<Matrix 5pt x 1ft
       0
   ┌───────
 0 │ -1.414
 1 │ -0.707
 2 │  0.000
 3 │  0.707
 4 │  1.414
>
>>> lst2 = [[3], [2], [6]]
>>> X2 = nimble.data(lst2)
>>> norm1, norm2 = meanStandardDeviationNormalize(X1, X2)
>>> norm2
<Matrix 3pt x 1ft
       0
   ┌───────
 0 │  0.000
 1 │ -0.707
 2 │  2.121
>