Class MinMaxScaler
- All Implemented Interfaces:
AutoCloseable
optRange. the range defaults to 0...1.
After fitting the scaler the fitted values are attached to the same NDManager as the input array.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()detach()Detaches this MinMaxScaler fitted value from current NDManager's lifecycle.Computes the minimum and maximum to be used for later scaling.Computes the minimum and maximum to be used for later scaling.getMax()Returns the value of fittedMax.getMin()Returns the value of fittedMin.inverseTransform(NDArray data) Undoes the transformation of X according to feature_range.inverseTransformi(NDArray data) Undoes the transformation of X according to feature_range as an in-place operation.optRange(float minRange, float maxRange) Sets desired range of transformed data.Transforms the data using the previous calculated minimum and maximum.transformi(NDArray data) Transforms the data in-place using the previous calculated minimum and maximum.
-
Constructor Details
-
MinMaxScaler
public MinMaxScaler()
-
-
Method Details
-
fit
Computes the minimum and maximum to be used for later scaling.After fitting the scaler the fitted values are attached to the same NDManager as the input array. reusing the minMaxScaler in the context of other NDManager's is possible by
detach()the scaler from the NDManager.- Parameters:
data- used to compute the minimum and maximum used for later scalingaxises- minimum maximum computation along this axises- Returns:
- the fitted MinMaxScaler
-
fit
Computes the minimum and maximum to be used for later scaling.After fitting the scaler the fitted values are attached to the same NDManager as the input array. reusing the minMaxScaler in the context of other NDManager's is possible by
detach()the scaler from the NDManager.- Parameters:
data- used to compute the minimum and maximum used for later scaling- Returns:
- the fitted MinMaxScaler
-
transform
Transforms the data using the previous calculated minimum and maximum.if
fit()is not executed yet, then the minimum/maximum is computer based on the input data array and used for later computations. X_std = (X - X.min(axis=0)) / (X.max(axis=0) - X.min(axis=0)) X_scaled = X_std * (max - min) + min- Parameters:
data- to get transformed- Returns:
- the transformed data, the input array is not changed
-
transformi
Transforms the data in-place using the previous calculated minimum and maximum.if
fit()is not called before then the minimum/maximum is computer based on the input data array and used for later computations. X_std = (X - X.min(axis=0)) / (X.max(axis=0) - X.min(axis=0)) X_scaled = X_std * (max - min) + min- Parameters:
data- to get transformed- Returns:
- the transformed data (reference to the input data) the input array is changed in-place by this operation
-
inverseTransform
Undoes the transformation of X according to feature_range.- Parameters:
data- to get transformed- Returns:
- the transformed array
-
inverseTransformi
Undoes the transformation of X according to feature_range as an in-place operation.- Parameters:
data- to get transformed, the data get changed in-place- Returns:
- the transformed array
-
detach
Detaches this MinMaxScaler fitted value from current NDManager's lifecycle.this becomes un-managed and it is the user's responsibility to close this. Failure to close the resource might cause your machine to run out of native memory.
After fitting the scaler the fitted values are attached to the same NDManager as the input array.
Re-fitting the scaler after detaching doesn't re-attach the scaler to any NDManager.
- Returns:
- the detached MinMaxScaler (itself) - to use as a fluent API
-
optRange
Sets desired range of transformed data.- Parameters:
minRange- min value for desired rangemaxRange- max value for desired range- Returns:
- the configured MinMaxScaler
-
getMin
Returns the value of fittedMin.- Returns:
- the fittedMin value
-
getMax
Returns the value of fittedMax.- Returns:
- the fittedMax value
-
close
public void close()- Specified by:
closein interfaceAutoCloseable
-