Skip to content

Add options to EDDM drift detector so its parameters can be configured - #335

Open
nikolas-sapa wants to merge 1 commit into
Waikato:masterfrom
nikolas-sapa:feat/eddm-options
Open

nikolas-sapa wants to merge 1 commit into
Waikato:masterfrom
nikolas-sapa:feat/eddm-options

Conversation

@nikolas-sapa

Copy link
Copy Markdown

EDDM is the only drift detector in moa.classifiers.core.driftdetection that
exposes no options. The other fourteen expose between one and six each:

ADWINChangeDetector     1        PageHinkleyDM              4
CusumDM                 3        RDDM                       6
DDM                     3        SEEDChangeDetector         5
EWMAChartDM             2        STEPD                      3
EnsembleDriftDetection  2        SeqDrift1ChangeDetector    3
GeometricMovingAverage  3        SeqDrift2ChangeDetector    2
HDDM_A_Test             3        HDDM_W_Test                4
EDDM                    0

Instead, EDDM hardcodes its parameters as private static final constants
(FDDM_MINNUMINSTANCES = 30, FDDM_WARNING = 0.95, FDDM_OUTCONTROL = 0.9)
plus a plain field (m_minNumErrors = 30) that gates both the change and
the warning conditions. That makes them unreachable from the command line and
from any wrapper that reads MOA's option registry.

DDM in the same package already exposes its equivalents, so this patch mirrors
the neighbouring class.

This came up while adding an EDDM wrapper to CapyMOA
(adaptive-machine-learning/CapyMOA#422). Its
MOADriftDetector configures detectors with
getOptions().setViaCLIString(cli), so an EDDM wrapper cannot accept the same
-n/-w/-o arguments its DDM wrapper accepts. Today that call fails with:

java.lang.IllegalArgumentException: Unknown option: -n

which is why the merged wrapper has no hyper-parameters and EDDM().get_params()
returns an empty dict, while DDM().get_params() returns three. With the
options added, the identical call is accepted and the wrapper can mirror DDM
exactly.

What changes

The three constants and the m_minNumErrors field become javacliparser
options, following DDM.java for names, short flags, declaration order, and
the place where the values are read:

Option Flag Default Replaces
minNumInstances -n 30 FDDM_MINNUMINSTANCES
warningLevel -w 0.95 FDDM_WARNING
outcontrolLevel -o 0.9 FDDM_OUTCONTROL
minNumErrors -e 30 m_minNumErrors field

Values are read in resetLearning(), matching DDM. The comparison sites in
input() now use the instance fields.

minNumErrors is included because it gates both alarm conditions, and it is
directly useful in practice: while porting EDDM to another toolkit we observed
the default of 30 false-alarming during a learner's convergence phase (early
error-distance outliers inflate the variance baseline), which users currently
cannot fix without recompiling.

Behaviour

Defaults are unchanged, so no existing result moves: with default values the
detector produces identical output before and after the patch (first warning at
61, first change at 105, 8 changes over a 2000-sample reference stream).

Setting the options has the expected monotone effect:

  • outcontrolLevel (the drift threshold) — 0.4 → 0 changes,
    0.6 → 0, 0.8 → 1 (at 1092), 0.9 → 8 (first at 105).
  • minNumInstances (warm-up) — 10 → first at 61 (15 changes),
    30 → 105 (8), 200 → 337 (3), 600 → 1187 (1).
  • minNumErrors (error-count gate) — 10 → first at 36,
    30 → 105, 60 → 118, 120 → 242.

Notes

  • Compiled with JDK 21 using the project's --release 8 setting; introduces no
    new compiler warnings.
  • No existing test references EDDM, and none enumerates drift-detector options.
  • No validation that warningLevel >= outcontrolLevel is added, consistent
    with DDM; the constraint is documented in the option descriptions.

Assisted-by: codebuff:deepseek-v4-flash

EDDM hardcoded its parameters as private constants, making them unreachable
from the CLI and from any wrapper reading MOA's option registry - it was the
only detector in the package with no options. Mirror DDM by exposing
minNumInstances, warningLevel, outcontrolLevel and minNumErrors as
javacliparser options. Defaults are unchanged, so detection behaviour is
identical.
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