public class MinMaxScaler
extends java.lang.Object
implements java.lang.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 and Description |
---|
MinMaxScaler() |
Modifier and Type | Method and Description |
---|---|
void |
close() |
MinMaxScaler |
detach()
Detaches this MinMaxScaler fitted value from current NDManager's lifecycle.
|
MinMaxScaler |
fit(NDArray data)
Computes the minimum and maximum to be used for later scaling.
|
MinMaxScaler |
fit(NDArray data,
int[] axises)
Computes the minimum and maximum to be used for later scaling.
|
NDArray |
getMax()
Returns the value of fittedMax.
|
NDArray |
getMin()
Returns the value of fittedMin.
|
NDArray |
inverseTransform(NDArray data)
Undoes the transformation of X according to feature_range.
|
NDArray |
inverseTransformi(NDArray data)
Undoes the transformation of X according to feature_range as an in-place operation.
|
MinMaxScaler |
optRange(float minRange,
float maxRange)
Sets desired range of transformed data.
|
NDArray |
transform(NDArray data)
Transforms the data using the previous calculated minimum and maximum.
|
NDArray |
transformi(NDArray data)
Transforms the data in-place using the previous calculated minimum and maximum.
|
public MinMaxScaler fit(NDArray data, int[] axises)
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.
data
- used to compute the minimum and maximum used for later scalingaxises
- minimum maximum computation along this axisespublic MinMaxScaler fit(NDArray data)
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.
data
- used to compute the minimum and maximum used for later scalingpublic NDArray transform(NDArray data)
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
data
- to get transformedpublic NDArray transformi(NDArray data)
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
data
- to get transformedpublic NDArray inverseTransform(NDArray data)
data
- to get transformedpublic NDArray inverseTransformi(NDArray data)
data
- to get transformed, the data get changed in-placepublic MinMaxScaler detach()
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.
public MinMaxScaler optRange(float minRange, float maxRange)
minRange
- min value for desired rangemaxRange
- max value for desired rangepublic NDArray getMin()
public NDArray getMax()
public void close()
close
in interface java.lang.AutoCloseable