Previous topic

Scale

Next topic

fynance.features.scale.standardize

fynance.features.scale.normalize

fynance.features.scale.normalize(X, a=0, b=1, axis=0)

Scale the data between a and b.

Substitutes the minimum and divid by the difference between the maximum and the minimum. Then multiply by b minus a and add a.

\[Normalize(X) = (b - a) \times \frac{X - X_{min}}{X_{max} - X_{min}} + a\]
Parameters:
X : np.ndarray[dtype, ndim=1 or 2]

Data to scale.

a, b : float or array_like, optional

Respectively the lower and upper bound of the transformation.

axis : int, optional

Axis along which to scale the data.

Returns:
np.ndarray[dtype, ndim=1 or 2]

The scaled data.