BWSTest#
- class frouros.detectors.data_drift.batch.statistical_test.BWSTest(callbacks: BaseCallbackBatch | list[BaseCallbackBatch] | None = None)#
BWSTest (Baumgartner-Weiss-Schindler test) [baumgartner1998nonparametric] detector.
- Parameters:
callbacks (Optional[Union[BaseCallbackBatch, list[BaseCallbackBatch]]]) – callbacks, defaults to None
- Note:
Passing additional arguments to scipy.stats.bws_test can be done using
compare()
kwargs.
- References:
[baumgartner1998nonparametric]Baumgartner, W., P. Weiß, and H. Schindler. “A nonparametric test for the general two-sample problem.” Biometrics (1998): 1129-1135.
- Example:
>>> from frouros.detectors.data_drift import BWSTest >>> 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 = BWSTest() >>> _ = detector.fit(X=X) >>> detector.compare(X=Y)[0] StatisticalResult(statistic=29.942072035675395, p_value=0.0001)
- property X_ref: ndarray | None#
Reference data property.
- Returns:
reference data
- Return type:
Optional[numpy.ndarray]
- property callbacks: list[BaseCallback] | None#
Callbacks property.
- Returns:
callbacks
- Return type:
Optional[list[BaseCallback]]
- compare(X: ndarray, **kwargs: Any) Tuple[ndarray, dict[str, Any]] #
Compare values.
- Parameters:
X (numpy.ndarray) – test data
- Returns:
compare result and callbacks logs
- Return type:
Tuple[numpy.ndarray, dict[str, Any]]
- property data_type: BaseDataType#
Data type property.
- Returns:
data type
- Return type:
BaseDataType
- fit(X: ndarray, **kwargs: Any) dict[str, Any] #
Fit detector.
- Parameters:
X (numpy.ndarray) – feature data
kwargs (Any) – additional fit parameters
- Returns:
callbacks logs
- Return type:
dict[str, Any]
- reset() None #
Reset method.
- property statistical_type: BaseStatisticalType#
Statistical type property.
- Returns:
statistical type
- Return type:
BaseStatisticalType