def moving_average(X, win_size=3): return np.convolve(X, np.repeat(1.0, win_size) / win_size, 'valid')