Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Binary Drift Detector: McDiarmid Drift Detection Method#1703

Draft
aditya0by0 wants to merge 10 commits into
online-ml:mainfrom
aditya0by0:feature/mddm
Draft

Binary Drift Detector: McDiarmid Drift Detection Method#1703
aditya0by0 wants to merge 10 commits into
online-ml:mainfrom
aditya0by0:feature/mddm

Conversation

@aditya0by0
Copy link
Copy Markdown

PR for Discussion : #1672

Add McDiarmid Drift Detection Methods (MDDM)

Summary

Implements three new binary drift detectors based on McDiarmid's inequality:

  • MDDM_A – Arithmetic weighting (linear).
  • MDDM_E – Exponential weighting.
  • MDDM_G – Geometric weighting.

if self.drift_detected:
self._reset()

self._sliding_window.append(0 if x == 1 else 1)
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm still confused about the input values for correct prediction and incorrect prediction as mentioned in #1532. Can someone please help me out with this ?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @aditya0by0. Multiple classic drift detectors seem to use a binary loss scheme, but there might be other patterns nowadays. I am not aware of the specifics of the algorithms you are contributing.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok I will check further on it. Btw the following is the corresponding moa code for the algorithm from the author : https://github.com/alipsgh/codes-for-moa/blob/master/drift_detection/MDDM_A.java

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @aditya0by0,

Are there any news on this PR?
Would love to see it in river!

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @kulbachcedric, I have implemented the algorithm. But I am unable to figure out the right test cases for it.

Because for the existing test data streams of river, the algorithm detects drifts at almost all the timepoints.

np.random.seed(12345)
data_stream_2 = np.concatenate(
[
[np.random.binomial(1, 0.2) for _ in range(1000)],
[np.random.binomial(1, 0.8) for _ in range(1000)],
]
).astype(int)
np.random.seed(12345)
data_stream_3 = np.concatenate(
(
np.random.normal(0.0, 0.1, 500) > 0,
np.random.normal(0.25, 0.1, 500) > 0,
np.random.normal(0.0, 0.1, 500) > 0,
np.random.normal(0.25, 0.1, 500) > 0,
)
).astype(int)

For the same stream of data I verified it with the author's corresponding python implementations and didn't get any better results. (which might be an indicator that this detector might be worse than the drift detectors which are already provided by river)

For these reasons, I am sure whether to pursue it any further.

@aditya0by0 aditya0by0 marked this pull request as draft September 10, 2025 09:30
@kulbachcedric
Copy link
Copy Markdown
Contributor

Hi @aditya0by0,
thanks for the transparency regarding the performance and excuse the very late reply ...
Thats a good question, actually I do not know any case where the McDiarmid Drift detection method was applied in practice. However, I still would like to have it in river as there are already many papers out there where it has been applied.

@MaxHalford what do you think?

@MaxHalford
Copy link
Copy Markdown
Member

MaxHalford commented Apr 29, 2026

Yes I think this is worth of being added to River :)

But there are a lot of implementation details that need reworking for this to be acceptable.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants