@@ -37,7 +37,7 @@ def __init__(
3737 :param alpha_w: significance value for warning
3838 :type alpha_w: float
3939 :param two_sided_test: flag that indicates if a two-sided test is performed
40- :param two_sided_test: bool
40+ :type two_sided_test: bool
4141 :param min_num_instances: minimum numbers of instances
4242 to start looking for changes
4343 :type min_num_instances: int
@@ -116,13 +116,36 @@ def two_sided_test(self, value: bool) -> None:
116116class HDDMAConfig (BaseHDDMConfig ):
117117 """HDDM-A (Hoeffding's drift detection method A-Test) [frias2014online]_ configuration.
118118
119+ :param alpha_d: significance value for drift, defaults to 0.001
120+ :type alpha_d: float
121+ :param alpha_w: significance value for warning, defaults to 0.005
122+ :type alpha_w: float
123+ :param two_sided_test: flag that indicates if a two-sided test is performed, defaults to False
124+ :type two_sided_test: bool
125+ :param min_num_instances: minimum numbers of instances to start looking for changes, defaults to 30
126+ :type min_num_instances: int
127+
119128 :References:
120129
121130 .. [frias2014online] Frias-Blanco, Isvani, et al.
122131 "Online and non-parametric drift detection methods based on Hoeffding’s bounds."
123132 IEEE Transactions on Knowledge and Data Engineering 27.3 (2014):
124133 810-823.
125- """
134+ """ # noqa: E501
135+
136+ def __init__ ( # noqa: D107
137+ self ,
138+ alpha_d : float = 0.001 ,
139+ alpha_w : float = 0.005 ,
140+ two_sided_test : bool = False ,
141+ min_num_instances : int = 30 ,
142+ ) -> None :
143+ super ().__init__ (
144+ alpha_d = alpha_d ,
145+ alpha_w = alpha_w ,
146+ two_sided_test = two_sided_test ,
147+ min_num_instances = min_num_instances ,
148+ )
126149
127150
128151class HDDMWConfig (BaseHDDMConfig ):
@@ -145,7 +168,7 @@ class HDDMWConfig(BaseHDDMConfig):
145168 "Online and non-parametric drift detection methods based on Hoeffding’s bounds."
146169 IEEE Transactions on Knowledge and Data Engineering 27.3 (2014):
147170 810-823.
148- """
171+ """ # noqa: E501
149172
150173 def __init__ ( # noqa: D107
151174 self ,
@@ -318,31 +341,49 @@ def update_cut_point(self, epsilon_z: float) -> None:
318341class HDDMA (BaseSPC ):
319342 """HDDM-A (Hoeffding's drift detection method with A-Test) [frias2014online]_ detector.
320343
344+ :param config: configuration object of the detector, defaults to None. If None, the default configuration of :class:`HDDMAConfig` is used.
345+ :type config: Optional[HDDMAConfig]
346+ :param callbacks: callbacks, defaults to None
347+ :type callbacks: Optional[Union[BaseCallbackStreaming, List[BaseCallbackStreaming]]]
348+
321349 :References:
322350
323351 .. [frias2014online] Frias-Blanco, Isvani, et al.
324352 "Online and non-parametric drift detection methods based on Hoeffding’s bounds."
325353 IEEE Transactions on Knowledge and Data Engineering 27.3 (2014):
326354 810-823.
327- """
355+
356+ :Example:
357+
358+ >>> from frouros.detectors.concept_drift import HDDMA
359+ >>> import numpy as np
360+ >>> np.random.seed(seed=31)
361+ >>> dist_a = np.random.binomial(n=1, p=0.6, size=1000)
362+ >>> dist_b = np.random.binomial(n=1, p=0.8, size=1000)
363+ >>> stream = np.concatenate((dist_a, dist_b))
364+ >>> detector = HDDMA()
365+ >>> warning_flag = False
366+ >>> for i, value in enumerate(stream):
367+ ... _ = detector.update(value=value)
368+ ... if detector.drift:
369+ ... print(f"Change detected at index {i}")
370+ ... break
371+ ... if not warning_flag and detector.warning:
372+ ... print(f"Warning detected at index {i}")
373+ ... warning_flag = True
374+ Warning detected at index 1043
375+ Change detected at index 1054
376+ """ # noqa: E501
328377
329378 config_type = HDDMAConfig # type: ignore
330379
331- def __init__ (
380+ def __init__ ( # noqa: D107
332381 self ,
333382 config : Optional [HDDMAConfig ] = None ,
334383 callbacks : Optional [
335384 Union [BaseCallbackStreaming , List [BaseCallbackStreaming ]]
336385 ] = None ,
337386 ) -> None :
338- """Init method.
339-
340- :param config: configuration parameters
341- :type config: Optional[HDDMAConfig]
342- :param callbacks: callbacks
343- :type callbacks: Optional[Union[BaseCallbackStreaming,
344- List[BaseCallbackStreaming]]]
345- """
346387 super ().__init__ (
347388 config = config ,
348389 callbacks = callbacks ,
@@ -648,7 +689,7 @@ class HDDMW(BaseSPC):
648689 ... print(f"Warning detected at index {i}")
649690 ... warning_flag = True
650691 Warning detected at index 1017
651- Change detected at index 1029
692+ Change detected at index 1029
652693 """ # noqa: E501
653694
654695 config_type = HDDMWConfig # type: ignore
0 commit comments