INNER CODE UNIT · Python
shape
matrix-profile-foundation/matrixprofile · matrixprofile/core.py:276
shape = a.shape[:-1] + (a.shape[-1] - window + 1, window)
strides = a.strides + (a.strides[-1],)
return np.lib.stride_tricks.as_strided(a, shape=shape, strides=strides)
def moving_average(a, window=3):
"""
Computes the moving average over an array given a window size.
Parameters
----------
a : array_like
The array to compute the moving average on.
window : int
The window size.
Returns