Skip to content

feat(datadrift): Adding data drift module - #419

Open
vcerqueira wants to merge 8 commits into
mainfrom
feat-datadrift
Open

vcerqueira wants to merge 8 commits into
mainfrom
feat-datadrift

Conversation

@vcerqueira

Copy link
Copy Markdown
Collaborator

Adds a data drift module next to the existing concept drift detectors.

Concept drift detectors watch a scalar error signal (REQUIRES_FIT = False). Data drift detectors compare incoming features to a reference distribution (REQUIRES_FIT = True). Both families stay in the capymoa.drift.detectors namespace.

The shared base class handles the sliding test window, per-feature tests, Bonferroni correction, and detection bookkeeping. A reference is set with fit(X_ref) or collected from the stream with auto_fit_samples.

14 detectors:

  • Statistical tests: Kolmogorov–Smirnov, Anderson–Darling, Cramér–von Mises, Chi-square
  • Distance-based: KL, Jensen–Shannon, PSI, Hellinger, Wasserstein, energy distance
  • Multivariate: MMD, D3, IBDD
  • Bayesian (per feature): BNDM

Also adds DataDriftResult (statistic, optional p-value/distance, per-feature flags), a tutorial notebook (notebooks/data_drift_detection.ipynb), and unit tests for instantiation, fit, detection, and get_params().

Also extends tests/test_detector.py to cover basic aspects of data drift methods.

@vcerqueira
vcerqueira requested a review from hmgomes September 15, 2026 09:57
@tachyonicClock

Copy link
Copy Markdown
Collaborator

Hi @vcerqueira. Great work on this. New methods yay 🤤 .

I have fixed the doc issues for you, since I know how painful they are when your not familiar with sphinx. The change was adding mapping to external docs scipy, and the :meta public: tag to ensure the "protected" method _fit/_test shows up in the docs. By default "private" methods are hidden creating issues when you want a "protected" style method.

I took some screen shots for @vcerqueira / @hmgomes to review. Are you happy with where everything is. I think you did a great job with the documentation. I'm confident a user will be able to figure out how to wire everything up.
I will, with @vcerqueira permission, move some things around in the future to achieve my standardization and organizational ambitions!

image image image

@vcerqueira

Copy link
Copy Markdown
Collaborator Author

Hi Anton @tachyonicClock ,

Thanks!! The images look good. And of course, move things around as you see fit.
Thanks for the review, cheers.

@hmgomes

hmgomes commented Sep 22, 2026

Copy link
Copy Markdown
Collaborator

Hi @vcerqueira , can you check the backlog? I have just put out a more comprehensive review there, but regardless this is looking good already

@vcerqueira

Copy link
Copy Markdown
Collaborator Author

Sure, thanks. Will take care of it soon

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.

3 participants