Skip to content

Commit d139c2c

Browse files
author
Jaime Céspedes Sisniega
authored
Merge pull request #253 from IFCA/fix-doc-examples-hypothesis-test
Fix doc examples hypothesis test
2 parents 8368845 + 7d63673 commit d139c2c

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

docs/source/examples/data_drift/MMD_advance.ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -956,7 +956,7 @@
956956
" mmd, callbacks_logs = detector.compare(X=sample)\n",
957957
" permutation_test_logs[type_] = copy.copy(callbacks_logs[\"permutation_test\"])\n",
958958
" mmd, p_value = mmd.distance, callbacks_logs[\"permutation_test\"][\"p_value\"]\n",
959-
" print(f\"{type_}:\\n MMD statistic={round(mmd, 4)}, p-value={round(p_value, 4)}, drift={p_value < alpha}\")"
959+
" print(f\"{type_}:\\n MMD statistic={round(mmd, 4)}, p-value={round(p_value, 4)}, drift={p_value <= alpha}\")"
960960
],
961961
"metadata": {
962962
"collapsed": false,
@@ -1014,7 +1014,7 @@
10141014
" ax.plot(xs, permutation_tests_density, label=\"KDE\")\n",
10151015
" ax.axvline(observed_statistic, color=\"green\", linestyle=\"--\", label=\"Observed distance\")\n",
10161016
" ax.set_title(type_)\n",
1017-
" drift = p_value < alpha\n",
1017+
" drift = p_value <= alpha\n",
10181018
" ax.text(0.88, 0.15, \"Drift\" if drift else \"No drift\", transform=ax.transAxes, fontsize=12, bbox={\"boxstyle\": \"round\", \"facecolor\": \"red\" if drift else \"green\", \"alpha\":0.5})\n",
10191019
"\n",
10201020
" # Get the y limit\n",

docs/source/examples/data_drift/MMD_simple.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@
306306
],
307307
"source": [
308308
"print(f\"MMD statistic={round(mmd.distance, 3)}, p-value={round(p_value, 3)}\")\n",
309-
"if p_value < alpha:\n",
309+
"if p_value <= alpha:\n",
310310
" print(\"Drift detected. We can reject H0, so both samples come from different distributions.\")\n",
311311
"else:\n",
312312
" print(\"No drift detected. We fail to reject H0, so both samples come from the same distribution.\")"

docs/source/examples/data_drift/multivariate_detector.ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@
252252
"_, callback_logs = detector.compare(X=X_test)\n",
253253
"p_value = callback_logs[\"permutation_test\"][\"p_value\"]\n",
254254
"print(f\"p-value: {round(p_value, 4)}\")\n",
255-
"if p_value < alpha:\n",
255+
"if p_value <= alpha:\n",
256256
" print(\"Data drift detected\")\n",
257257
"else:\n",
258258
" print(\"No data drift detected\")\n",
@@ -352,7 +352,7 @@
352352
"_, callback_logs = detector.compare(X=X_test_noise)\n",
353353
"p_value = callback_logs[\"permutation_test\"][\"p_value\"]\n",
354354
"print(f\"p-value: {round(p_value, 4)}\")\n",
355-
"if p_value < alpha:\n",
355+
"if p_value <= alpha:\n",
356356
" print(\"Data drift detected\")\n",
357357
"else:\n",
358358
" print(\"No data drift detected\")\n",

docs/source/examples/data_drift/univariate_detector.ipynb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@
204204
" print(f\"Feature {i+1}:\")\n",
205205
" p_value = detector.compare(X=X_test[:, i])[0].p_value\n",
206206
" print(f\"\\tp-value: {round(p_value, 4)}\")\n",
207-
" if p_value < alpha:\n",
207+
" if p_value <= alpha:\n",
208208
" print(\"\\tData drift detected\\n\")\n",
209209
" else:\n",
210210
" print(\"\\tNo data drift detected\\n\")\n",
@@ -265,7 +265,7 @@
265265
" print(f\"Feature {i}:\")\n",
266266
" p_value = detector.compare(X=X_test_noise[:, i])[0].p_value\n",
267267
" print(f\"\\tp-value: {round(p_value, 4)}\")\n",
268-
" if p_value < alpha:\n",
268+
" if p_value <= alpha:\n",
269269
" print(\"\\tData drift detected\\n\")\n",
270270
" else:\n",
271271
" print(\"\\tNo data drift detected\\n\")\n",
@@ -335,7 +335,7 @@
335335
" print(f\"Feature {i}:\")\n",
336336
" p_value = detector.compare(X=X_test_noise[:, i])[0].p_value\n",
337337
" print(f\"\\tp-value: {round(p_value, 4)}\")\n",
338-
" if p_value < alpha:\n",
338+
" if p_value <= alpha:\n",
339339
" print(\"\\tData drift detected\\n\")\n",
340340
" else:\n",
341341
" print(\"\\tNo data drift detected\\n\")\n",

0 commit comments

Comments
 (0)