lstein.utils.minmaxscale¶
- lstein.utils.minmaxscale(x: ndarray, xmin: float, xmax: float, xmin_ref: float = None, xmax_ref: float = None) ndarray[source]¶
applies min-max-scaling to x
function to apply min-max-scaling onto x
will rescale x to the interval xmin, xmax
considers xmin_ref, xmax_ref as reference boundaries of the original dataset that x is a part of
similar to [sklearn.processing.MinMaxScaler()](https://scikit-learn.org/stable/modules/generated/sklearn.preprocessing.MinMaxScaler.html)
- Parameters
- x
np.ndarray
feature to be transformed
- xmin
float
lower bound of the target range
- xmax
float
upper bound of the target range
- xmin_ref
float, optional
lower bound of the original range
- the default is None
will consider x to be representing the original range
will be set to np.nanmin(x)
- xmax_ref
float, optional
upper bound of the original range
- the default is None
will consider x to be representing the original range
will be set to np.nanmax(x)
Raises
- Returns
- x_scaled
np.ndarray
same shape as x
x after the transformation
- Dependencies
numpy
typing