Implementation:Online ml River Drift NoDrift
| Knowledge Sources | |
|---|---|
| Domains | Online_Learning, Concept_Drift, Drift_Detection |
| Last Updated | 2026-02-08 16:00 GMT |
Overview
A dummy drift detector that never signals drift, used to disable concept drift detection capabilities in adaptive models.
Description
NoDrift is a minimal implementation of the DriftDetector interface that always returns False for drift_detected. It serves as a null object pattern to disable drift detection in adaptive learning algorithms without changing their code structure. When used as a drift_detector in models like Adaptive Random Forest, it makes the model stationary by preventing drift-triggered model resets. When used as a warning_detector, it bypasses the background model building phase, causing immediate resets upon drift detection.
Usage
Use NoDrift to turn off drift detection in adaptive models for comparison studies, to create stationary versions of adaptive algorithms, or to isolate the impact of drift detection from other algorithm components. It's particularly useful for ablation studies and baseline comparisons.
Code Reference
Source Location
- Repository: Online_ml_River
- File: river/drift/no_drift.py
Signature
class NoDrift(base.DriftDetector):
def __init__(self):
...
def update(self, x: int | float):
...
@property
def drift_detected(self):
return False
Import
from river import drift
I/O Contract
| Method | Input | Output |
|---|---|---|
| update(x) | int or float | None (no-op) |
| drift_detected | None | Always False |
Usage Examples
from river import drift
from river import evaluate
from river import forest
from river import metrics
from river.datasets import synth
dataset = synth.ConceptDriftStream(
seed=8,
position=500,
width=40,
).take(700)
# Turn off warning detection (immediate resets)
adaptive_model = forest.ARFClassifier(
leaf_prediction="mc",
warning_detector=drift.NoDrift(),
seed=8
)
# Turn off both warning and drift detection (stationary)
stationary_model = forest.ARFClassifier(
leaf_prediction="mc",
warning_detector=drift.NoDrift(),
drift_detector=drift.NoDrift(),
seed=8
)
for x, y in dataset:
adaptive_model.learn_one(x, y)
stationary_model.learn_one(x, y)
print(adaptive_model.n_drifts_detected()) # 2
print(adaptive_model.n_warnings_detected()) # 0
print(stationary_model.n_drifts_detected()) # 0
print(stationary_model.n_warnings_detected()) # 0