Standardize¶
Status: Stable
documented, exercised by the test suite and/or worked examples, with no known limitations recorded.
Description¶
Standardize[data] shifts each column of data to zero mean and rescales it to unit sample standard deviation (divisor n-1, matching StandardDeviation). A flat list is treated as n observations of one variable. A constant column becomes exactly 0 rather than Indeterminate.
Examples (3)¶
Every input below was run against the current Mathilda build and its output recorded.
Basic examples (3)¶
In[1]:= Standardize[{1., 2., 3., 4.}]
Out[1]= {-1.1619, -0.387298, 0.387298, 1.1619}
In[2]:= Standardize[{{1., 10.}, {2., 20.}, {3., 30.}}]
Out[2]= {{-1.0, -1.0}, {0.0, 0.0}, {1.0, 1.0}}
In[3]:= Standardize[{{1., 5.}, {2., 5.}, {3., 5.}}]
Out[3]= {{-1.0, 0.0}, {0.0, 0.0}, {1.0, 0.0}}
Implementation notes¶
- Columns are variables, rows are observations. A flat list is treated as
nobservations of one variable, not one observation ofn. - The divisor is
n - 1(the sample standard deviation), matchingStandardDeviation— soStandardize[x]agrees with(x - Mean[x])/StandardDeviation[x]written out by hand. A mismatch here would be invisible on the mean but not on the scale. - A constant column becomes exactly
0, notIndeterminate. Zero variance carries no information, so "no deviation from the mean" is the honest value; dividing by the zero standard deviation would propagateIndeterminatethrough every reduction over the row.
Attributes: Protected.
References¶
See also: StandardDeviation
- Source:
src/ml/pca.c - Specification:
docs/spec/builtins/machine-learning.md - Tests:
tests/test_ml_pca.c