99from ml3_drift .models .monitoring import (
1010 MonitoringOutput ,
1111)
12+ from ml3_drift .monitoring .multivariate .bonferroni import BonferroniCorrectionAlgorithm
13+ from ml3_drift .monitoring .univariate .continuous .ks import KSAlgorithm
14+ from ml3_drift .monitoring .univariate .discrete .chi_square import ChiSquareAlgorithm
1215
1316
1417class BatchDataDriftAnalyzer (DataDriftAnalyzer ):
@@ -23,14 +26,30 @@ class BatchDataDriftAnalyzer(DataDriftAnalyzer):
2326 continuous_ma_builder: closure function that accepts int parameter as `comparison_window_size`
2427 and returns an instance of a MonitoringAlgorithm
2528 categorical_ma_builder: closure function that accepts int parameter as `comparison_window_size`
26- and returns an instance of a MonitoringAlgorithm
29+ and returns an instance of a MonitoringAlgorithm. Notice that this parameter is needed
30+ also when there are no categorical columns (even though it is not used).
2731 batch_size: initial batch dimensions and also used as comparison_window_size
2832 """
2933
34+ DEFAULT_CONTINUOUS_BUILDER : Callable [[int ], MonitoringAlgorithm ] = (
35+ lambda _ : BonferroniCorrectionAlgorithm (
36+ algorithm_builder = lambda p_value : KSAlgorithm (p_value = p_value ),
37+ ),
38+ )
39+ DEFAULT_CATEGORICAL_BUILDER = (
40+ lambda _ : BonferroniCorrectionAlgorithm (
41+ algorithm_builder = lambda p_value : ChiSquareAlgorithm (p_value = p_value ),
42+ ),
43+ )
44+
3045 def __init__ (
3146 self ,
32- continuous_ma_builder : Callable [[int ], MonitoringAlgorithm ],
33- categorical_ma_builder : Callable [[int ], MonitoringAlgorithm ],
47+ continuous_ma_builder : Callable [
48+ [int ], MonitoringAlgorithm
49+ ] = DEFAULT_CONTINUOUS_BUILDER ,
50+ categorical_ma_builder : Callable [
51+ [int ], MonitoringAlgorithm
52+ ] = DEFAULT_CATEGORICAL_BUILDER ,
3453 batch_size : int = 100 ,
3554 ):
3655 super ().__init__ (
0 commit comments