standardize

Standardize the dataset so that each column has its mean as 0. It gives equal weight to all features.

Syntax

[scaled_X, parameters] = standardize(X)

Inputs

X
Input data to be standardized.
Type: double
Dimension: vector | matrix

Outputs

scaled_X
Standardized input records.
Type: double
Dimension: vector | matrix
parameters
Struct containing mean and standard deviation of all columns.
mu: mean of each feature.
sigma: standard deviation of each feature.
Type: double | integer
Dimension: struct

Example

Usage of standardize

X = [1, -1, 2;
	 2, 0, 0;
	 0, 1, -1];
[X_scaled, parameters] = standardize(X);
> X_scaled
X_scaled = [Matrix] 3 x 3
0.00000 -1.22474 1.33631
1.22474 0.00000 -0.26726
-1.22474 1.22474 -1.06904
> parameters
parameters = struct [
mu: [Matrix] 1 x 3
1.00000 0.00000 0.33333
sigma: [Matrix] 1 x 3
0.81650 0.81650 1.24722
]

Comments

Output 'parameters' can be used by standardizetransform function.