roll_normalizeΒΆ
Defined in fynance.features.scale
- roll_normalize(X, w=None, a=0, b=1, axis=0)[source]
Scale the data between
aandb.Substitutes the rolling minimum and divid by the difference between the rolling maximum and the minimum. Then multiply by
bminusaand adda.\[RollNormalize(X)^w_t = (b - a) \times \frac{X_t - RollMin(X)^w_t} {RollMax(X)^w_t - RollMin(X)^w_t} + a\]- Parameters:
- Xnp.ndarray[dtype, ndim=1 or 2]
Data to scale.
- wint, optional
Size of the lagged window of the rolling minimum/maximum, must be positive. If
w is Noneorw=0, thenw=X.shape[axis]. Default is None.- a, bfloat or array_like, optional
Respectively the lower and upper bound of the transformation.
- axisint, optional
Axis along which to scale the data.
- Returns:
- np.ndarray[dtype, ndim=1 or 2]
The scaled data.
See also
Scale,standardize,normalize,roll_standardize