Previous topic

fynance.features.scale.roll_normalize

Next topic

fynance.features.scale.Scale

fynance.features.scale.roll_standardize

fynance.features.scale.roll_standardize(X, w=None, a=0, b=1, axis=0, kind_moment='s')

Substitutes the rolling mean and divid by the rolling standard dev.

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

Data to scale.

w : int, optional

Size of the lagged window of the moving average/standard deviation, 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 an additional and multiply factor.

axis : int, optional

Axis along which to scale the data.

kind_moment : str {“s”, “w”, “e”}, optional
  • If “s” (default) then compute basic moving averages and standard deviations, see sma and smstd.
  • If “w” then compute the weighted moving averages and standard deviations, see wma and wmstd.
  • If “e” then compute the exponential moving averages and standard deviations, see ema and emstd.
Returns:
np.ndarray[dtype, ndim=1 or 2]

The scaled data.