Package com.jml.preprocessing
Class Normalize
java.lang.Object
com.jml.preprocessing.Normalize
Contains methods for normalizing data. These include
 
     - min-max scaling in (0, 1)
     - min-max scaling in (a, b)
     - mean normalization
     - l2 normalization
     - l1 normalization
     - Z-score normalization
 - 
Method Summary
Modifier and TypeMethodDescriptionstatic double[]l1(double[] data)Normalizes the data by subtracting the mean and dividing by the L1-norm.static double[]l2(double[] data)Normalizes the data by subtracting the mean and dividing by the L2-norm.static double[][]l2(double[][] data)Normalizes each column of the data by subtracting the mean of that column and dividing by the L2-norm of that column.static double[]meanNormalize(double[] data)Applies meanNormalize normalization to the data.static double[]minMaxScale(double[] data)Applies min-max feature scaling to data.static double[]minMaxScale(double[] data, double a, double b)Applies min-max feature scaling to data.static double[]zScore(double[] data)Applies Z-score normalization to the dataset.static double[][]zScore(double[][] data)Applies Z-score normalization to the dataset. 
- 
Method Details
- 
minMaxScale
public static double[] minMaxScale(double[] data)Applies min-max feature scaling to data. This will rescale the data to be in [1, 0].
Also seeminMaxScale(double[], double, double).- Parameters:
 data- Dataset to apply normalization to.- Returns:
 - A copy of the dataset that has been normalized using min-max feature scaling.
 
 - 
minMaxScale
public static double[] minMaxScale(double[] data, double a, double b)Applies min-max feature scaling to data. This will rescale the data to be in [a, b].
Also seeminMaxScale(double[]).- Parameters:
 data- Dataset to apply normalization to.a- Minimum value of the rescaled dataset.b- Maximum value of the rescaled dataset.- Returns:
 - A copy of the dataset that has been normalized using min-max feature scaling.
 
 - 
meanNormalize
public static double[] meanNormalize(double[] data)Applies meanNormalize normalization to the data.- Parameters:
 data- Dataset to apply meanNormalize normalization to.- Returns:
 - A copy of the dataset which has been normalized using meanNormalize normalization.
 
 - 
l1
public static double[] l1(double[] data)Normalizes the data by subtracting the mean and dividing by the L1-norm.- Parameters:
 data- - data to normalize.- Returns:
 - The L1-normalized data.
 
 - 
l2
public static double[] l2(double[] data)Normalizes the data by subtracting the mean and dividing by the L2-norm.- Parameters:
 data- - data to normalize.- Returns:
 - The L2-normalized data.
 
 - 
l2
public static double[][] l2(double[][] data)Normalizes each column of the data by subtracting the mean of that column and dividing by the L2-norm of that column.- Parameters:
 data- - data to normalize.- Returns:
 - The L2-normalized data.
 
 - 
zScore
public static double[] zScore(double[] data)Applies Z-score normalization to the dataset.- Parameters:
 data- The dataset of interest.- Returns:
 - A copy of the dataset which has been normalized using Z-score normalization.
 
 - 
zScore
public static double[][] zScore(double[][] data)Applies Z-score normalization to the dataset.- Parameters:
 data- The dataset of interest.- Returns:
 - A copy of the dataset which has been normalized using Z-score normalization.
 
 
 -