Skip to content

Commit 064b92b

Browse files
committed
docs: update tutorial options and add peak-based uniformity example
1 parent 58e385f commit 064b92b

2 files changed

Lines changed: 67 additions & 7 deletions

File tree

docs/index.ipynb

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,34 @@
215215
"\n"
216216
]
217217
},
218+
{
219+
"cell_type": "markdown",
220+
"metadata": {},
221+
"source": [
222+
"### Uniformity Test (`peak_based`)\n",
223+
"\n",
224+
"With `definition=\"peak_based\"`, ReMoDe applies a Pearson Chi-square test for uniformity.\n",
225+
"If the distribution is not significantly different from uniform (`p > 0.05`), it returns zero modes.\n"
226+
]
227+
},
228+
{
229+
"cell_type": "code",
230+
"execution_count": null,
231+
"metadata": {},
232+
"outputs": [],
233+
"source": [
234+
"uniform_counts = np.array([10, 10, 10, 10, 10])\n",
235+
"\n",
236+
"uniform_result = ReMoDe(\n",
237+
" statistical_test=\"fisher\",\n",
238+
" definition=\"peak_based\",\n",
239+
").fit(uniform_counts)\n",
240+
"\n",
241+
"print(\"Number of modes:\", uniform_result[\"nr_of_modes\"])\n",
242+
"print(\"Uniform distribution:\", uniform_result[\"uniform_distribution\"])\n",
243+
"print(\"Chi-square p-value:\", uniform_result[\"uniformity_p_value\"])\n"
244+
]
245+
},
218246
{
219247
"cell_type": "code",
220248
"execution_count": 9,

tutorial.ipynb

Lines changed: 39 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -159,9 +159,11 @@
159159
"source": [
160160
"remode = ReMoDe(\n",
161161
" alpha=0.05, # alpha level desired (adjusted recursively for multiple testing)\n",
162-
" alpha_correction='descriptive_peaks', # or 'max_modes', 'none', or custom function\n",
163-
" statistical_test=perform_fisher_test, # or perform_binomial_test, or custom function\n",
164-
")\n"
162+
" alpha_correction=\"descriptive_peaks\", # default; or \"max_modes\", \"none\", or custom function\n",
163+
" statistical_test=\"bootstrap\", # default; or \"fisher\", \"binomial\", or custom function\n",
164+
" definition=\"shape_based\", # default; set \"peak_based\" to exclude uniform distributions\n",
165+
")\n",
166+
"\n"
165167
]
166168
},
167169
{
@@ -173,9 +175,39 @@
173175
"source": [
174176
"remode = ReMoDe(\n",
175177
" alpha=0.05,\n",
176-
" alpha_correction='max_modes', # example of the alternative built-in correction\n",
177-
" statistical_test=perform_fisher_test,\n",
178-
")\n"
178+
" alpha_correction=\"max_modes\", # alternative built-in correction\n",
179+
" statistical_test=\"fisher\",\n",
180+
" definition=\"peak_based\",\n",
181+
")\n",
182+
"\n"
183+
]
184+
},
185+
{
186+
"cell_type": "markdown",
187+
"metadata": {},
188+
"source": [
189+
"### Uniformity Test (`peak_based`)\n",
190+
"\n",
191+
"With `definition=\"peak_based\"`, ReMoDe applies a Pearson Chi-square test for uniformity.\n",
192+
"If the distribution is not significantly different from uniform (`p > 0.05`), it returns zero modes.\n"
193+
]
194+
},
195+
{
196+
"cell_type": "code",
197+
"execution_count": null,
198+
"metadata": {},
199+
"outputs": [],
200+
"source": [
201+
"uniform_counts = np.array([10, 10, 10, 10, 10])\n",
202+
"\n",
203+
"uniform_result = ReMoDe(\n",
204+
" statistical_test=\"fisher\",\n",
205+
" definition=\"peak_based\",\n",
206+
").fit(uniform_counts)\n",
207+
"\n",
208+
"print(\"Number of modes:\", uniform_result[\"nr_of_modes\"])\n",
209+
"print(\"Uniform distribution:\", uniform_result[\"uniform_distribution\"])\n",
210+
"print(\"Chi-square p-value:\", uniform_result[\"uniformity_p_value\"])\n"
179211
]
180212
},
181213
{
@@ -244,4 +276,4 @@
244276
},
245277
"nbformat": 4,
246278
"nbformat_minor": 5
247-
}
279+
}

0 commit comments

Comments
 (0)