You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
feat(core): accept X_df / exogenous variables in detect_anomalies #75
forecast() takes known-future covariates via X_df (and cross_validation() reads the same columns from df). detect_anomalies() does not: it is implemented as in-sample cross-validation but the public API on both Forecaster and FoundationForecast omits X_df / futr_exog_list.
# forecast / CVff.forecast(df, h=24, X_df=X_df, level=[90])
ff.cross_validation(df, h=24, level=[90]) # exog columns on df# anomalies — no way to pass covariatesff.detect_anomalies(df, level=99)
Anomaly flags are residual-based (y vs the model forecast on each CV fold). Without horizon exog, models that actually use covariates (Chronos-2, TimesFM-3, TimeGPT, T0, TiRex-2, Timestral, …) score anomalies as if the series were univariate. Docs (docs/exogenous-variables.md) also never mention detect_anomalies.
Proposal
Add X_df and futr_exog_list to detect_anomalies() on Forecaster and FoundationForecast, matching the existing forecast / CV contract and exog_strategy.
Forward them into the CV path that already builds per-fold X_df from holdout rows (forecaster.py around the cross_validation split loop).
Document the data shape: like CV, covariates must cover the windows being scored (typically columns on df; a separate X_df when the caller keeps history and horizon exog apart).
Tests: extend the parametrized exog coverage in tests/models/test_models.py with a detect_anomalies + X_df case (skip when supports_native_futr_exog() is false). Add a focused unit test that detect_anomalies actually calls forecast with X_df.
Docs: docs/exogenous-variables.md, docs/forecasting-parameters.md, and the README triad (forecast / cross_validation / detect_anomalies).
Right now detect_anomalies scores residuals from in-sample cross-validation but drops the exogenous support that forecast/cross_validation already have: def detect_anomalies on both Forecaster (core/forecaster.py) and the FoundationForecast wrapper (core/multi_model.py) takes no X_df/futr_exog_list, so covariate-aware models score as if the series were univariate. My read is to thread X_df and futr_exog_list through to the CV split loop that already builds per-fold holdout covariates, honouring exog_strategy. For the FoundationForecast ensemble path, should the exog be fanned out to each member and gated per-model on supports_native_futr_exog(), so a mixed ensemble with one univariate-only model doesn't error? Happy to add the parametrized exog test and the docs updates. Please assign me — PR within 1–2 days.
Activity
sharmis-tp commentedon Oct 27, 2026
Right now
detect_anomaliesscores residuals from in-sample cross-validation but drops the exogenous support thatforecast/cross_validationalready have:def detect_anomalieson bothForecaster(core/forecaster.py) and theFoundationForecastwrapper (core/multi_model.py) takes noX_df/futr_exog_list, so covariate-aware models score as if the series were univariate. My read is to threadX_dfandfutr_exog_listthrough to the CV split loop that already builds per-fold holdout covariates, honouringexog_strategy. For theFoundationForecastensemble path, should the exog be fanned out to each member and gated per-model onsupports_native_futr_exog(), so a mixed ensemble with one univariate-only model doesn't error? Happy to add the parametrized exog test and the docs updates. Please assign me — PR within 1–2 days.AzulGarza commentedon Oct 27, 2026
hey @sharmis-tp. sounds good. for
FoundationForecast, usingexog_strategy=Falseshould work for models that don't support exogenous variables.please feel free to open a PR.:)