Class Scaler
java.lang.Object
smile.math.Scaler
- All Implemented Interfaces:
Serializable, Function
-
Field Summary
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondoublef(double x) Computes the value of the function at x.doubleinv(double x) Computes the value of the inverse function at x.static Scalerminmax(double[] data) Returns the scaler that map the values into the range [0, 1].static ScalerReturns the scaler.static Scalerstandardizer(double[] data) Returns the standardize scaler to 0 mean and unit variance.static Scalerstandardizer(double[] data, boolean robust) Returns the standardize scaler to 0 mean and unit variance.static Scalerwinsor(double[] data) Returns the scaler that map the values into the range [0, 1].static Scalerwinsor(double[] data, double lower, double upper) Returns the scaler that map the values into the range [0, 1].
-
Constructor Details
-
Scaler
public Scaler(double scale, double offset, boolean clip) Constructor.- Parameters:
scale- the scaling factor.offset- the offset.clip- if true, clip the value in [0, 1].
-
-
Method Details
-
f
-
inv
-
minmax
Returns the scaler that map the values into the range [0, 1].- Parameters:
data- the training data.- Returns:
- the scaler.
-
winsor
Returns the scaler that map the values into the range [0, 1]. The values greater than the 95% percentile are replaced with the upper limit, and those below the 5% percentile are replace with the lower limit.- Parameters:
data- the training data.- Returns:
- the scaler.
-
winsor
Returns the scaler that map the values into the range [0, 1]. The values greater than the specified upper limit are replaced with the upper limit, and those below the lower limit are replace with the lower limit.- Parameters:
data- the training data.lower- the lower limit in terms of percentiles of the original distribution (e.g. 5th percentile).upper- the upper limit in terms of percentiles of the original distribution (e.g. 95th percentile).- Returns:
- the scaler.
-
standardizer
Returns the standardize scaler to 0 mean and unit variance.- Parameters:
data- The training data.- Returns:
- the scaler.
-
standardizer
Returns the standardize scaler to 0 mean and unit variance.- Parameters:
data- The training data.robust- If true, scale by subtracting the median and dividing by the IQR.- Returns:
- the scaler.
-
of
-