minmax_scale#

class usencrypt.ai.preprocessing.minmax_scale(X, feature_range=(0, 1), axis=0)#

Transforms the given input data using its minimum and maximum values. For any input data \(x\), this is defined as:

\[\text{X}_{\text{scaled}} = \frac{\text{X}-\text{X}_{\min}}{\text{X}_{\max}-\text{X}_{\min}}\]
Parameters
  • X (list or numpy.ndarray) – The input data to scale.

  • feature_range (tuple) – The specified range of the transformed data. Defaults to (0, 1)

  • axis (int) – Specifies the axis of X along which to compute the vector scaling. Defaults to 0.

Returns

The scaled input.

Return type

numpy.ndarray

Examples
>>> import numpy as np
>>> import usencrypt as ue
>>> x = 10 * np.random.random_sample(size=(10)) - 5
>>> x
array([-4.10394969,  3.27695409,  2.18822549, -0.43481818,  1.357729  ,
       -3.63707215,  3.45479595, -0.82892126, -1.13788532,  1.63361434])
>>> scaled = ue.ai.preprocessing.minmax_scale(x)
>>> scaled
array([0.        , 0.97647204, 0.83243642, 0.4854154 , 0.72256416,
       0.06176654, 1.        , 0.43327671, 0.39240167, 0.75906299])