ResetStatisticalTest#
- class frouros.callbacks.batch.ResetStatisticalTest(alpha: float, name: str | None = None)#
Reset callback class that can be applied to
data_drift.batch.statistical_test
detectors.- Parameters:
alpha (float) – significance value
name (Optional[str]) – name value, defaults to None. If None, the name will be set to ResetStatisticalTest.
- Example:
>>> from frouros.callbacks import ResetStatisticalTest >>> from frouros.detectors.data_drift import KSTest >>> import numpy as np >>> np.random.seed(seed=31) >>> X = np.random.normal(loc=0, scale=1, size=100) >>> Y = np.random.normal(loc=1, scale=1, size=100) >>> detector = KSTest(callbacks=ResetStatisticalTest(alpha=0.01)) >>> _ = detector.fit(X=X) >>> detector.compare(X=Y)[0] INFO:frouros:Drift detected. Resetting detector... StatisticalResult(statistic=0.55, p_value=3.0406585087050305e-14)
- property alpha: float#
Alpha property.
- Returns:
significance value
- Return type:
float
- property name: str#
Name property.
- Returns:
name value
- Return type:
str
- on_compare_end(result: Any, X_ref: ndarray, X_test: ndarray) None #
On compare end method.
- Parameters:
result (Any) – result obtained from the compare method
X_ref (numpy.ndarray) – reference data
X_test (numpy.ndarray) – test data
- on_compare_start(X_ref: ndarray, X_test: ndarray) None #
On compare start method.
- Parameters:
X_ref (numpy.ndarray) – reference data
X_test (numpy.ndarray) – test data
- on_fit_end(X: ndarray) None #
On fit end method.
- Parameters:
X (numpy.ndarray) – reference data
- on_fit_start(X: ndarray) None #
On fit start method.
- Parameters:
X (numpy.ndarray) – reference data
- set_detector(detector) None #
Set detector method.
- reset() None #
Reset method.