google-research / timesfm

TimesFM (Time Series Foundation Model) is a pretrained time-series foundation model developed by Google Research for time-series forecasting.
https://research.google/blog/a-decoder-only-foundation-model-for-time-series-forecasting/
Apache License 2.0
3.02k stars 228 forks source link

Questions regarding `frequency_input` in the example on readme #62

Open mw66 opened 1 month ago

mw66 commented 1 month ago

In this code:

import numpy as np
forecast_input = [
    np.sin(np.linspace(0, 20, 100)),
    np.sin(np.linspace(0, 20, 200)),
    np.sin(np.linspace(0, 20, 400)),
]
frequency_input = [0, 1, 2]

point_forecast, experimental_quantile_forecast = tfm.forecast(
    forecast_input,
    freq=frequency_input,
)

the 3 input arrays have different length, what's the semantics of putting them together to pass as in as input? Are they:

-- represents the same time window? From the np.sin call with the same start and end (0, 20) (and this model only do univariate time series forecasting), guess they are. But then why the high frequency 0 has fewer data points (100) than the low frequency 2 (400)? This is confusing. Should the frequency_input array be reversed?

-- or different time windows, but end aligned?

-- or different time windows, but appended together one by one (in time)?

Thanks.