INNER CODE UNIT · Python

moving_median

matrix-profile-foundation/matrixprofile · matrixprofile/core.py:378

def moving_median(a, window=3):
    """
    Computes the moving median over an array given a window size.

    Parameters
    ----------
    a : array_like
        The array to compute the moving median on.
    window : int
        The window size.

    Returns
    -------
    array_like :
        The array of moving medians.
    """
    return np.median(rolling_window(a, window), axis=1)

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…