Skip to content
This repository was archived by the owner on Aug 15, 2026. It is now read-only.

Commit 0d4cf0d

Browse files
committed
New cluster based drift detectors based on generic_single_movement
Fixes #1207
1 parent 581905c commit 0d4cf0d

3 files changed

Lines changed: 82 additions & 3 deletions

File tree

src/mlpro/oa/streams/tasks/changedetectors/driftdetectors/clusterbased/size_change_detector.py

Lines changed: 46 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,14 @@
2121
from mlpro.oa.streams import OAStreamTask
2222
from mlpro.oa.streams.tasks.clusteranalyzers import ClusterAnalyzer, Cluster
2323
from mlpro.oa.streams.tasks.clusteranalyzers.clusters.properties.body import cprop_size_geo
24-
from mlpro.oa.streams.tasks.changedetectors.driftdetectors.drifts.clusterbased import DriftCBSize
24+
from mlpro.oa.streams.tasks.changedetectors.driftdetectors.drifts.clusterbased import DriftCBSize, DriftCBSizeGeo
2525
from mlpro.oa.streams.tasks.changedetectors.driftdetectors.clusterbased.generic import DriftDetectorCBGenSingleGradient
2626

2727

2828

2929
# Export list for public API
30-
__all__ = [ 'DriftDetectorCBGenSizeChange' ]
30+
__all__ = [ 'DriftDetectorCBGenSizeChange',
31+
'DriftDetectorCBGenGeoSizeChange' ]
3132

3233

3334

@@ -57,6 +58,49 @@ def __init__( self,
5758
p_thrs_inst : int = 0,
5859
p_thrs_clusters : int = 1 ):
5960

61+
super().__init__( p_clusterer = p_clusterer,
62+
p_property = cprop_size_geo,
63+
p_thrs_lower = p_thrs_lower,
64+
p_thrs_upper = p_thrs_upper,
65+
p_cls_drift = p_cls_drift,
66+
p_name = p_name,
67+
p_range_max = p_range_max,
68+
p_ada = p_ada,
69+
p_duplicate_data = p_duplicate_data,
70+
p_visualize = p_visualize,
71+
p_logging = p_logging,
72+
p_drift_buffer_size = p_drift_buffer_size,
73+
p_thrs_inst = p_thrs_inst,
74+
p_thrs_clusters = p_thrs_clusters )
75+
76+
77+
78+
79+
80+
## -------------------------------------------------------------------------------------------------
81+
class DriftDetectorCBGenGeoSizeChange (DriftDetectorCBGenSingleGradient):
82+
"""
83+
Cluster based Drift detector for the change of the cluster size.
84+
"""
85+
86+
C_NAME = 'Size'
87+
88+
## -------------------------------------------------------------------------------------------------
89+
def __init__( self,
90+
p_clusterer : ClusterAnalyzer,
91+
p_thrs_lower : float,
92+
p_thrs_upper : float,
93+
p_cls_drift : type = DriftCBSizeGeo,
94+
p_name : str = None,
95+
p_range_max = OAStreamTask.C_RANGE_THREAD,
96+
p_ada : bool = True,
97+
p_duplicate_data : bool = False,
98+
p_visualize : bool = False,
99+
p_logging=Log.C_LOG_ALL,
100+
p_drift_buffer_size : int = 100,
101+
p_thrs_inst : int = 0,
102+
p_thrs_clusters : int = 1 ):
103+
60104
super().__init__( p_clusterer = p_clusterer,
61105
p_property = cprop_size_geo,
62106
p_thrs_lower = p_thrs_lower,

src/mlpro/oa/streams/tasks/changedetectors/driftdetectors/drifts/clusterbased/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@
33
from .deformation import *
44
from .size import *
55
from .density import *
6-
from .geometric_center import *
6+
from .geometric_center import *
7+
from .size_geo import *
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
## -------------------------------------------------------------------------------------------------
2+
## -- Project : MLPro - The integrative middleware framework for standardized machine learning
3+
## -- Package : mlpro.oa.tasks.driftdetectors.drifts.clusterbased
4+
## -- Module : size_geo.py
5+
## -------------------------------------------------------------------------------------------------
6+
## -- History :
7+
## -- yyyy-mm-dd Ver. Auth. Description
8+
## -- 2025-07-29 1.0.0 DS Creation
9+
## -------------------------------------------------------------------------------------------------
10+
11+
"""
12+
Ver. 1.0.0 (2025-07-29)
13+
14+
This module provides a sub-type of class DriftCB related to geometric cluster size.
15+
"""
16+
17+
from mlpro.oa.streams.tasks.changedetectors.driftdetectors.drifts.clusterbased.basics import DriftCB
18+
19+
20+
21+
# Export list for public API
22+
__all__ = [ 'DriftCBSizeGeo' ]
23+
24+
25+
26+
27+
## -------------------------------------------------------------------------------------------------
28+
## -------------------------------------------------------------------------------------------------
29+
class DriftCBSizeGeo (DriftCB):
30+
"""
31+
Sub-type indicating the begin or end of a cluster size.
32+
"""
33+
34+
C_PLOT_ACTIVE = True

0 commit comments

Comments
 (0)