Repository navigation
feat(drift): integrate ADWIN drift detection - #14
Open
MichalRedm wants to merge 11 commits into
Open
MichalRedm wants to merge 11 commits into
MichalRedm wants to merge 11 commits into
Conversation
…nd benchmark validation Resolves #5 by implementing ADWIN and DualADWIN drift detectors, integrating them into the stream UI, and validating against synthetic benchmark generators.
…ion tests - Created tests/test_adwin.py with deterministic unit tests for ADWIN imports, DualADWIN warning/drift dynamics, and BinaryErrorDriftDescriptor interface invariants. - Refactored tests/test_adwin_drift.py into pipeline execution integration tests across the 5 synthetic stream benchmarks, focusing on data flow integrity and descriptor structure rather than brittle statistical bounds.
…k bounds - Enable degradation_only=True by default in BinaryErrorDriftDescriptor to suppress false alarms on error decreases (model learning/adaptation). - Fix lookback start clamping to prevent overriding CUSUM, Gradient, and Threshold change points with the maximum window boundary. - Expose estimation property on DualADWIN. - Add optional Warm-up / Burn-in slider in the Drift Detection dashboard tab. - Add unit and integration tests verifying clean drift detection on Hyperplane with MLPClassifier.
MichalRedm
force-pushed
the
feat/adwin-integration
branch
from
October 4, 2026 10:05
64911d2 to
19f2676
Compare
# Conflicts: # src/stride/drift/binary_descriptor.py
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
DualADWINwrapper to support dual-threshold workflows (warning and drift signals).degradation_only=Trueby default) inBinaryErrorDriftDescriptor, eliminating false alarms caused by model learning, convergence, or recovery.BinaryErrorDriftDescriptorto safely handle single-threshold detectors without warning zones and to dynamically derive lookback windows fromdetector.width.main, resolving merge conflicts and integrating ADWIN into the newly established documentation suite (User Guide, Mathematical Formulations, API Reference, and Changelog).Motivation
river.drift.binary(DDM, EDDM, FHDDM, HDDM).Key Changes
1. Core Framework & Packaging (
src/stride/drift/,src/DDM/)DualADWINAdapter (src/stride/drift/adwin.py): Wrapper maintaining two internal ADWIN instances (delta_warnanddelta_drift) for systems requiring explicit warning and drift states; exposes.estimationproperty delegated to drift instance; fully documented with Google-style docstrings and type annotations.src/stride/drift/binary_descriptor.py): Addeddegradation_only=Trueparameter to compare window error estimations (curr_estimation < prev_estimation) and suppress drift alarms when error decreases (learning/recovery).src/stride/drift/binary_descriptor.py): Fixed lookback clamping frommin(drift_start_idx, detection_idx - lookback_window)tomax(min_lookback_bound, min(drift_start_idx, detection_idx))so CUSUM inflection point localization works properly..warning_detectedaccesses withgetattr(..., False)to preventAttributeErroron detectors lacking warning properties.ADWINandDualADWINthroughstride.driftand backward-compatibility bridgeDDM.2. Streamlit Dashboard (
dashboard/components/tabs/drift_detection.py)"ADWIN"to theDetector Typeselector.Confidence Level (delta),Clock Rate,Min Window Length, andGrace Period.Warm-up / Burn-in (Samples)slider control and enabled directional degradation filtering for drift runs.3. Documentation Infrastructure Integration (
docs/**,CHANGELOG.md)docs/user-guide/model-layer.md): Comprehensive documentation and code recipes forDualADWIN, dynamic lookback bounding viadetector.width, and directional degradation filtering.docs/theory/mathematical-formulations.md): Formalized the ADWIN Hoeffding bound formulation (docs/user-guide/dashboard.md): Documented the updated detector suite in Tab 2.CHANGELOG.md): Added release notes under[Unreleased].pyproject.toml): Pinnedpymdown-extensions < 12.2to resolve an upstream constructor signature break withmkdocstrings.4. Empirical Benchmark Insights
As part of resolving #5, ADWIN's detection dynamics were evaluated across STRIDE's synthetic benchmark streams:
5. Test Suite (
tests/)tests/test_adwin.py: Fast, deterministic unit tests verifying imports,DualADWINwarning/drift dynamics and estimation, descriptorAttributeErrorsafety, directional filtering (degradation_only), and CUSUM inflection localization.tests/test_adwin_drift.py: End-to-end integration tests verifying prequential pipeline execution and descriptor structural invariants across synthetic generators, plus a clean single-drift test on Hyperplane with MLP.Verification
ruff check .passed with 0 errorsruff format --check .passed cleanlypython -m unittest discover testspassed with 0 failures (57 tests)mkdocs build --strictpassed with 0 warnings/errorsCIandDocumentation) GitHub Actions workflows passed