Previous topic


Next topic



fynance.features.scale.roll_normalize(X, w=None, a=0, b=1, axis=0)

Scale the data between a and b.

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

\[RollNormalize(X)^w_t = (b - a) \times \frac{X_t - RollMin(X)^w_t} {RollMax(X)^w_t - RollMin(X)^w_t} + a\]
X : np.ndarray[dtype, ndim=1 or 2]

Data to scale.

w : int, optional

Size of the lagged window of the rolling minimum/maximum, must be positive. If w is None or w=0, then w=X.shape[axis]. Default is None.

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.

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

The scaled data.