diff --git a/docs/book/customization/options-for-statistical-tests.md b/docs/book/customization/options-for-statistical-tests.md index d73fd66bb4..cab2fb9d44 100644 --- a/docs/book/customization/options-for-statistical-tests.md +++ b/docs/book/customization/options-for-statistical-tests.md @@ -92,7 +92,7 @@ To use the following drift detection methods, pass them using the `stattest` par | `ed`
Energy distance | tabular data
only numerical | returns `distance`
drift detected when `distance` >= `threshold`
default threshold: 0.1 | | `es`
Epps-Singleton tes | tabular data
only numerical | returns `p_value`
drift detected when `p_value` < `threshold`
default threshold: 0.05 | | `t_test`
T-Test | tabular data
only numerical | returns `p_value`
drift detected when `p_value` < `threshold`
default threshold: 0.05 | -| `emperical_mmd`
Emperical-MMD | tabular data
only numerical | returns `p_value`
drift detected when `p_value` < `threshold`
default threshold: 0.05 | +| `empirical_mmd`
Empirical-MMD | tabular data
only numerical | returns `p_value`
drift detected when `p_value` < `threshold`
default threshold: 0.05 | | `TVD`
Total-Variation-Distance | tabular data
only categorical | returns `p_value`
drift detected when `p_value` < `threshold`
default threshold: 0.05 | # Text drift detection diff --git a/examples/how_to_questions/how_to_specify_stattest_for_a_testsuite.ipynb b/examples/how_to_questions/how_to_specify_stattest_for_a_testsuite.ipynb index b5dc4221ce..f83d55b6d7 100644 --- a/examples/how_to_questions/how_to_specify_stattest_for_a_testsuite.ipynb +++ b/examples/how_to_questions/how_to_specify_stattest_for_a_testsuite.ipynb @@ -123,7 +123,7 @@ "* 't_test'\n", "* 'cramer_von_mises'\n", "* 'g_test'\n", - "* 'emperical_mmd'\n", + "* 'empirical_mmd'\n", "* 'TVD'\n", "\n", "You can implement a custom drift test and use it in parameters. Just define a function that takes two pd.Series (reference and current data) and returns a number (e.g. p_value or distance)\n", diff --git a/src/evidently/calculations/stattests/__init__.py b/src/evidently/calculations/stattests/__init__.py index 16eea6889c..305cfb0e9b 100644 --- a/src/evidently/calculations/stattests/__init__.py +++ b/src/evidently/calculations/stattests/__init__.py @@ -14,7 +14,7 @@ from .kl_div import kl_div_stat_test from .ks_stattest import ks_stat_test from .mann_whitney_urank_stattest import mann_whitney_u_stat_test -from .mmd_stattest import emperical_mmd +from .mmd_stattest import empirical_mmd from .psi import psi_stat_test from .registry import PossibleStatTestType from .registry import StatTest @@ -41,7 +41,7 @@ "kl_div_stat_test", "ks_stat_test", "mann_whitney_u_stat_test", - "emperical_mmd", + "empirical_mmd", "psi_stat_test", "PossibleStatTestType", "StatTest", diff --git a/src/evidently/calculations/stattests/mmd_stattest.py b/src/evidently/calculations/stattests/mmd_stattest.py index ecce8d8f6f..da5e463883 100644 --- a/src/evidently/calculations/stattests/mmd_stattest.py +++ b/src/evidently/calculations/stattests/mmd_stattest.py @@ -126,7 +126,7 @@ def _mmd_stattest( feature_type: ColumnType, threshold: float, ) -> Tuple[float, bool]: - """Run the emperical maximum mean discrepancy test. + """Run the empirical maximum mean discrepancy test. Args: reference_data: reference data current_data: current data @@ -144,11 +144,11 @@ def _mmd_stattest( return p_value, p_value < threshold -emperical_mmd = StatTest( - name="emperical_mmd", - display_name="emperical_mmd", +empirical_mmd = StatTest( + name="empirical_mmd", + display_name="empirical_mmd", allowed_feature_types=[ColumnType.Numerical], default_threshold=0.1, ) -register_stattest(emperical_mmd, _mmd_stattest) +register_stattest(empirical_mmd, _mmd_stattest) diff --git a/tests/calculations/stattests/test_get_stattest.py b/tests/calculations/stattests/test_get_stattest.py index 1d86527dab..537dc359d4 100644 --- a/tests/calculations/stattests/test_get_stattest.py +++ b/tests/calculations/stattests/test_get_stattest.py @@ -22,7 +22,7 @@ ("num", "kl_div"), ("num", "ks"), ("num", "mannw"), - ("num", "emperical_mmd"), + ("num", "empirical_mmd"), ("cat", "psi"), ("num", "psi"), ("num", "t_test"), diff --git a/tests/stattests/test_stattests.py b/tests/stattests/test_stattests.py index 7c74ab99e6..6af59db525 100644 --- a/tests/stattests/test_stattests.py +++ b/tests/stattests/test_stattests.py @@ -14,7 +14,7 @@ from evidently.calculations.stattests.g_stattest import g_test from evidently.calculations.stattests.hellinger_distance import hellinger_stat_test from evidently.calculations.stattests.mann_whitney_urank_stattest import mann_whitney_u_stat_test -from evidently.calculations.stattests.mmd_stattest import emperical_mmd +from evidently.calculations.stattests.mmd_stattest import empirical_mmd from evidently.calculations.stattests.t_test import t_test from evidently.calculations.stattests.tvd_stattest import tvd_test from evidently.core import ColumnType @@ -139,9 +139,9 @@ def test_cramer_von_mises() -> None: # (pd.Series(np.random.normal(0, 0.5, 100)), pd.Series(np.random.normal(0, 0.9, 100)), 0.1, 0, True), ), ) -def test_emperical_mmd(reference, current, threshold, expected_pvalue, drift_detected) -> None: +def test_empirical_mmd(reference, current, threshold, expected_pvalue, drift_detected) -> None: np.random.seed(0) - assert emperical_mmd.func(reference, current, "num", threshold) == ( + assert empirical_mmd.func(reference, current, "num", threshold) == ( approx(expected_pvalue, abs=1e-2), drift_detected, )