Skip to content

refactor(fe): expose regression feature builders as standalone, streaming-friendly components shared by local + global lanes #227

Description

@sipemu

Context

The pipeline has two regression feature-engineering implementations that overlap heavily but diverge in capability:

  • Local regression method → anofox-forecast's RegressionForecaster FE: lags + auto_lags (AIC/BIC), trend_type (linear/quadratic/cubic/exponential/logistic/theil_sen), differencing/seasonal_differencing, fourier, the rolling family, exog_features (lags + rolling on exog), event_distance (steps-since/until a holiday/promo), WLS.
  • Global lane (anofox-orchestration::global_regression, a separate reimplementation, fix: rename MetricType to TsMetricType (#185) #186): lags (no auto), the rolling family, ewm, calendar Fourier/one-hot, contemporaneous exog, static columns, LOO panel mean/std, per-series scaling (dynamic/ytd), yeo-johnson, trend_decompose, per-model transforms.

They re-code the common FE (lags/rolling/fourier) independently, and the global lane lacks several rich local features — notably auto_lags, trend_type, exog-FE, and event_distance — that directly target the seasonal/cumulative-YTD gaps in the #366 roadmap.

Why the split exists

  • The local FE is coupled to RegressionForecaster's per-series fit (it owns a materialized design matrix), so it isn't callable from the global lane's panel-pooled, streaming-Gram fit (which accumulates XᵀX without materializing the 569k×p matrix, and needs cross-series-comparable features).

Ask (structural)

Expose anofox-forecast's regression feature engineering as standalone, streaming-friendly feature builders — pure (series, t, cfg) -> feature row functions decoupled from the RegressionForecaster fit — so both the local per-series fit and the global panel/streaming fit can call the same builders. This:

  • eliminates the duplicate lag/rolling/fourier code,
  • instantly gives the global lane auto_lags / trend_type / exog-FE / event_distance,
  • keeps the streaming-Gram constraint (the builder writes into a reusable scratch row; the panel fit visits rows one at a time).

Larger than the incremental ports (#386/#388/event_distance), but the principled fix.

Filed from anofox-orchestration; the builder extraction lives in anofox-forecast.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions