Skip to content

Conversation

@aditya0by0
Copy link

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
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
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
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
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
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
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