pub fn standardize(x: &Array2<f64>) -> Array2<f64>Expand description
Standardizes data to have zero mean and unit variance
This function transforms input data by subtracting the mean and dividing by the standard deviation for each feature, resulting in standardized data where each feature has a mean of 0 and a standard deviation of 1.
§Parameters
x- A 2D array where rows represent samples and columns represent features
§Returns
Array2<f64>- A standardized 2D array with the same shape as the input
§Implementation Details
- Calculates mean and standard deviation for each feature column
- Handles cases where standard deviation is zero (or very small) by setting it to 1.0
- Applies the z-score transformation: (x - mean) / std_dev