Skip to content

Add passthrough setting to EWMASettings for identity bypass#155

Merged
cboulay merged 1 commit into
devfrom
cboulay/ewma_passthrough
Jun 12, 2026
Merged

Add passthrough setting to EWMASettings for identity bypass#155
cboulay merged 1 commit into
devfrom
cboulay/ewma_passthrough

Conversation

@cboulay

@cboulay cboulay commented Jun 12, 2026

Copy link
Copy Markdown
Member

Summary

Adds a passthrough: bool = False field to EWMASettings that, when set, returns the input message unchanged (identity), skipping the EWMA entirely.

Previously the only way to approximate "off" was a very large time_constant, but that still subtracts/applies a stale, locked baseline rather than passing data through untouched.

  • EWMATransformer.__call__/__acall__ short-circuit when passthrough is set; DetrendTransformer inherits this, so EWMAUnit and DetrendUnit both support it.
  • AdaptiveStandardScalerTransformer gets the same short-circuit (its settings class already inherited the field; it is now honored). Child EWMAs are unaffected, so there is no double-gating.
  • passthrough is in NONRESET_SETTINGS_FIELDS for both transformers, so it can be toggled at runtime (e.g. via INPUT_SETTINGS) without resetting filter state — when processing resumes, the baseline/statistics pick up where they left off.

The legacy RiverAdaptiveStandardScalerTransformer is untouched (its settings don't derive from EWMASettings).

Test plan

  • New unit tests in test_ewma.py, test_detrend.py, test_scaler.py covering identity output, state preservation across a passthrough toggle, and update_settings not queueing a reset.
  • Full EWMA/detrend/scaler suites pass: 56 passed, 3 skipped (river/mlx).

EWMASettings gains a `passthrough` flag that returns the input
unchanged, skipping the EWMA entirely. Unlike a very large
time_constant -- which still applies a stale, locked baseline --
passthrough is true identity. It applies to EWMAUnit, DetrendUnit,
and AdaptiveStandardScaler, and is in NONRESET_SETTINGS_FIELDS so it
can be toggled at runtime without resetting filter state.
@cboulay cboulay merged commit 78a3c9d into dev Jun 12, 2026
14 checks passed
@cboulay cboulay deleted the cboulay/ewma_passthrough branch June 12, 2026 19:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant