Skip to content

TimesFM (Time Series Foundation Model) is a pretrained time-series foundation model developed by Google Research for time-series forecasting.

Python

change line for smoother_arr

Killer3048373a5293df29
diff --git a/src/timesfm/timesfm_base.py b/src/timesfm/timesfm_base.py
index 4502d21..b0a622a 100644
--- a/src/timesfm/timesfm_base.py
+++ b/src/timesfm/timesfm_base.py
@@ -45,7 +45,8 @@ def moving_average(arr, window_size):
"""Calculates the moving average using NumPy's convolution function."""
# Pad with zeros to handle initial window positions
arr_padded = np.pad(arr, (window_size - 1, 0), "constant")
- smoothed_arr = (np.convolve(arr_padded, np.ones(window_size), "valid") / window_size)
+ smoothed_arr = (np.convolve(arr_padded, np.ones(window_size), "valid") /
+ window_size)
return [smoothed_arr, arr - smoothed_arr]