Nixtla / nixtla

TimeGPT-1: production ready pre-trained Time Series Foundation Model for forecasting and anomaly detection. Generative pretrained transformer for time series trained on over 100B data points. It's capable of accurately predicting various domains such as retail, electricity, finance, and IoT with just a few lines of code 🚀.
https://docs.nixtla.io
Other
1.91k stars 151 forks source link

Feat: Using historical multivariate timeseries in Timegpt #294

Closed DanKil82 closed 1 month ago

DanKil82 commented 2 months ago

I am currently checking TimeGPT with multivariate timeseries data and comparing it against univariate timeseries data, hoiwever there is no difference in the forecasts.

my Code:

# some imports
...

    timegpt_client = TimeGPT(
        api_key=api_key
    )
    timegpt_forecast = timegpt_client.forecast(
        df = df_train,
        h = NixtlaParams.forecast_horizon,
        freq = NixtlaParams.frequency,
        time_col = NixtlaParams.time_column,
        target_col = NixtlaParams.target_column,
        id_col = NixtlaParams.key_column,
    )

How can i integrate multivariate features ? Or is this simply not supported ?

elephaint commented 2 months ago

Hi,

historical exogenous inputs are not supported in TimeGPT; i.e. TimeGPT only leverages exogenous inputs from df if you also supply future values for those exogenous inputs in X_df. Otherwise, as you witnessed, the exogenous inputs are ignored. We will add a warning for this behavior.

Does this answer your question?

DanKil82 commented 2 months ago

Thanks for the feedback. For now i think a warning would be appropriate.

Is it planned to add this functionality ?, I can just recommend to do so (if possible). I am running a forecasting platform in a large scale industrial company serving use cases thoughout Demand Planning, Material Planning, Manufacturing PLanning etc. and what i see, that most of my internal customers want to add historical exogeneous data, e.g. price changes, inventory levels etc.

elephaint commented 2 months ago

Thanks for the suggestion; Unfortunately I don't have a timeline for that atm. For now, I'd suggest to make a forecast for these exogenous too - this can be rather simple (e.g. by setting them to the last value for the entire forecast horizon, for example for price or price change), or complex by having a separate model / pipeline predicting those values. Subsequently, you can use those predictions as future exogenous variables.

Note that the added benefit of this is that you will be explicitly including your assumptions about these variables in the model, whereas the assumptions on these variables will be implicitly modelled if only used as a historical exogenous variable. This is often encountered in retail with price, where forecasting practitioners often ignore the future price of a product whilst modeling future demand, even though this will lead the model to make implicit assumptions about future price behaviour.