|
7 | 7 |
|
8 | 8 |
|
9 | 9 | class ResetStatisticalTest(BaseCallbackBatch): |
10 | | - """Reset on statistical test batch callback class.""" |
| 10 | + """Reset callback class that can be applied to :mod:`data_drift.batch.statistical_test <frouros.detectors.data_drift.batch.statistical_test>` detectors. |
11 | 11 |
|
12 | | - def __init__(self, alpha: float, name: Optional[str] = None) -> None: |
13 | | - """Init method. |
| 12 | + :param alpha: significance value |
| 13 | + :type alpha: float |
| 14 | + :param name: name value, defaults to None. If None, the name will be set to `ResetStatisticalTest`. |
| 15 | + :type name: Optional[str] |
14 | 16 |
|
15 | | - :param alpha: significance value |
16 | | - :type alpha: float |
17 | | - :param name: name to be use |
18 | | - :type name: Optional[str] |
19 | | - """ |
| 17 | + :Example: |
| 18 | +
|
| 19 | + >>> from frouros.callbacks import ResetStatisticalTest |
| 20 | + >>> from frouros.detectors.data_drift import KSTest |
| 21 | + >>> import numpy as np |
| 22 | + >>> np.random.seed(seed=31) |
| 23 | + >>> X = np.random.normal(loc=0, scale=1, size=100) |
| 24 | + >>> Y = np.random.normal(loc=1, scale=1, size=100) |
| 25 | + >>> detector = KSTest(callbacks=ResetStatisticalTest(alpha=0.01)) |
| 26 | + >>> _ = detector.fit(X=X) |
| 27 | + >>> detector.compare(X=Y)[0] |
| 28 | + INFO:frouros:Drift detected. Resetting detector... |
| 29 | + StatisticalResult(statistic=0.55, p_value=3.0406585087050305e-14) |
| 30 | + """ # noqa: E501 # pylint: disable=line-too-long |
| 31 | + |
| 32 | + def __init__( # noqa: D107 |
| 33 | + self, |
| 34 | + alpha: float, |
| 35 | + name: Optional[str] = None, |
| 36 | + ) -> None: |
20 | 37 | super().__init__(name=name) |
21 | 38 | self.alpha = alpha |
22 | 39 |
|
|
0 commit comments