|
102 | 102 | }, |
103 | 103 | { |
104 | 104 | "cell_type": "code", |
105 | | - "execution_count": 4, |
| 105 | + "execution_count": 21, |
106 | 106 | "metadata": {}, |
107 | 107 | "outputs": [], |
108 | 108 | "source": [ |
109 | 109 | "%matplotlib inline\n", |
110 | | - "supress_warnings = False\n", |
| 110 | + "supress_warnings = True\n", |
111 | 111 | "from ipywidgets import interactive # widgets and interactivity\n", |
112 | 112 | "from ipywidgets import widgets # widgets and interactivity\n", |
113 | 113 | "import matplotlib; import matplotlib.pyplot as plt # plotting\n", |
|
140 | 140 | }, |
141 | 141 | { |
142 | 142 | "cell_type": "code", |
143 | | - "execution_count": 5, |
| 143 | + "execution_count": 24, |
144 | 144 | "metadata": {}, |
145 | 145 | "outputs": [], |
146 | 146 | "source": [ |
|
177 | 177 | }, |
178 | 178 | { |
179 | 179 | "cell_type": "code", |
180 | | - "execution_count": 6, |
| 180 | + "execution_count": 39, |
181 | 181 | "metadata": {}, |
182 | 182 | "outputs": [], |
183 | 183 | "source": [ |
|
198 | 198 | "\n", |
199 | 199 | "def run_plot_summary1(P_happening,P_positive_given_happening,P_positive_given_not_happening):\n", |
200 | 200 | " digits = 3\n", |
201 | | - " P_not_positive_given_happening = np.round((1 - P_positive_given_happening),digits)\n", |
202 | | - " P_not_positive_given_not_happening = np.round((1 - P_positive_given_not_happening),digits)\n", |
203 | | - " P_not_happening = np.round((1.0 - P_happening),digits)\n", |
| 201 | + " P_not_positive_given_happening = (1 - P_positive_given_happening)\n", |
| 202 | + " P_not_positive_given_not_happening = (1 - P_positive_given_not_happening)\n", |
| 203 | + " P_not_happening = (1.0 - P_happening)\n", |
204 | 204 | " \n", |
205 | | - " P_positive = np.round((P_positive_given_happening * P_happening + P_positive_given_not_happening * P_not_happening),digits)\n", |
206 | | - " P_not_positive = np.round((P_not_positive_given_happening * P_happening + P_not_positive_given_not_happening * P_not_happening),digits)\n", |
| 205 | + " P_positive = (P_positive_given_happening * P_happening + P_positive_given_not_happening * P_not_happening)\n", |
| 206 | + " P_not_positive = (P_not_positive_given_happening * P_happening + P_not_positive_given_not_happening * P_not_happening)\n", |
207 | 207 | " \n", |
208 | | - " P_happening_given_positive = np.round(((P_positive_given_happening * P_happening) / P_positive),digits)\n", |
209 | | - " P_not_happening_given_positive = np.round((P_positive_given_not_happening * P_not_happening) / P_positive,digits)\n", |
| 208 | + " P_happening_given_positive = ((P_positive_given_happening * P_happening) / P_positive)\n", |
| 209 | + " P_not_happening_given_positive = ((P_positive_given_not_happening * P_not_happening) / P_positive)\n", |
210 | 210 | " \n", |
211 | | - " P_happening_given_not_positive = np.round(((P_not_positive_given_happening * P_happening) / P_not_positive),digits)\n", |
212 | | - " P_not_happening_given_not_positive = np.round(((P_not_positive_given_not_happening * P_not_happening) / P_not_positive),digits)\n", |
| 211 | + " P_happening_given_not_positive = ((P_not_positive_given_happening * P_happening) / P_not_positive)\n", |
| 212 | + " P_not_happening_given_not_positive = ((P_not_positive_given_not_happening * P_not_happening) / P_not_positive)\n", |
213 | 213 | " \n", |
214 | 214 | " plt.subplot(111)\n", |
215 | 215 | " plt.plot()\n", |
|
283 | 283 | }, |
284 | 284 | { |
285 | 285 | "cell_type": "code", |
286 | | - "execution_count": 7, |
| 286 | + "execution_count": 42, |
287 | 287 | "metadata": {}, |
288 | 288 | "outputs": [ |
289 | 289 | { |
290 | 290 | "data": { |
291 | 291 | "application/vnd.jupyter.widget-view+json": { |
292 | | - "model_id": "9f463f05380247aca636afc2264ae0a0", |
| 292 | + "model_id": "081c8551585642b2b2ea6136696b799d", |
293 | 293 | "version_major": 2, |
294 | 294 | "version_minor": 0 |
295 | 295 | }, |
|
303 | 303 | { |
304 | 304 | "data": { |
305 | 305 | "application/vnd.jupyter.widget-view+json": { |
306 | | - "model_id": "70ad5e2b4fc24f499708c4b904c1dc3a", |
| 306 | + "model_id": "1d10d27396dd478e8c684f41495c3fd9", |
307 | 307 | "version_major": 2, |
308 | 308 | "version_minor": 0 |
309 | 309 | }, |
310 | 310 | "text/plain": [ |
311 | | - "Output()" |
| 311 | + "Output(outputs=({'output_type': 'display_data', 'data': {'text/plain': '<Figure size 640x480 with 1 Axes>', 'i…" |
312 | 312 | ] |
313 | 313 | }, |
314 | 314 | "metadata": {}, |
|
343 | 343 | }, |
344 | 344 | { |
345 | 345 | "cell_type": "code", |
346 | | - "execution_count": 8, |
| 346 | + "execution_count": 44, |
347 | 347 | "metadata": {}, |
348 | 348 | "outputs": [], |
349 | 349 | "source": [ |
|
362 | 362 | "\n", |
363 | 363 | "def run_plot_summary(P_happening,P_positive_given_happening,P_positive_given_not_happening):\n", |
364 | 364 | " digits = 3\n", |
365 | | - " P_not_positive_given_happening = np.round((1 - P_positive_given_happening),digits)\n", |
366 | | - " P_not_positive_given_not_happening = np.round((1 - P_positive_given_not_happening),digits)\n", |
367 | | - " P_not_happening = np.round((1.0 - P_happening),digits)\n", |
| 365 | + " P_not_positive_given_happening = (1 - P_positive_given_happening)\n", |
| 366 | + " P_not_positive_given_not_happening = (1 - P_positive_given_not_happening)\n", |
| 367 | + " P_not_happening = (1.0 - P_happening)\n", |
368 | 368 | " \n", |
369 | | - " P_positive = np.round((P_positive_given_happening * P_happening + P_positive_given_not_happening * P_not_happening),digits)\n", |
370 | | - " P_not_positive = np.round((P_not_positive_given_happening * P_happening + P_not_positive_given_not_happening * P_not_happening),digits)\n", |
| 369 | + " P_positive = (P_positive_given_happening * P_happening + P_positive_given_not_happening * P_not_happening)\n", |
| 370 | + " P_not_positive = (P_not_positive_given_happening * P_happening + P_not_positive_given_not_happening * P_not_happening)\n", |
371 | 371 | " \n", |
372 | | - " P_happening_given_positive = np.round(((P_positive_given_happening * P_happening) / P_positive),digits)\n", |
373 | | - " P_not_happening_given_positive = np.round((P_positive_given_not_happening * P_not_happening) / P_positive,digits)\n", |
| 372 | + " P_happening_given_positive = ((P_positive_given_happening * P_happening) / P_positive)\n", |
| 373 | + " P_not_happening_given_positive = (P_positive_given_not_happening * P_not_happening) / P_positive\n", |
374 | 374 | " \n", |
375 | | - " P_happening_given_not_positive = np.round(((P_not_positive_given_happening * P_happening) / P_not_positive),digits)\n", |
376 | | - " P_not_happening_given_not_positive = np.round(((P_not_positive_given_not_happening * P_not_happening) / P_not_positive),digits)\n", |
| 375 | + " P_happening_given_not_positive = ((P_not_positive_given_happening * P_happening) / P_not_positive)\n", |
| 376 | + " P_not_happening_given_not_positive = ((P_not_positive_given_not_happening * P_not_happening) / P_not_positive)\n", |
377 | 377 | " \n", |
378 | 378 | " plt.subplot(211)\n", |
379 | 379 | " plt.plot()\n", |
|
531 | 531 | }, |
532 | 532 | { |
533 | 533 | "cell_type": "code", |
534 | | - "execution_count": 9, |
| 534 | + "execution_count": 47, |
535 | 535 | "metadata": {}, |
536 | 536 | "outputs": [ |
537 | 537 | { |
538 | 538 | "data": { |
539 | 539 | "application/vnd.jupyter.widget-view+json": { |
540 | | - "model_id": "65fba05d2f634969b120b5c7d078538b", |
| 540 | + "model_id": "d72830d524704fe69cf2ef205e0ad4c5", |
541 | 541 | "version_major": 2, |
542 | 542 | "version_minor": 0 |
543 | 543 | }, |
|
551 | 551 | { |
552 | 552 | "data": { |
553 | 553 | "application/vnd.jupyter.widget-view+json": { |
554 | | - "model_id": "6e48ff1254f1405b8ac2fbf7077f467f", |
| 554 | + "model_id": "a1990c0264884670a49ffa4ecf045daa", |
555 | 555 | "version_major": 2, |
556 | 556 | "version_minor": 0 |
557 | 557 | }, |
558 | 558 | "text/plain": [ |
559 | | - "Output()" |
| 559 | + "Output(outputs=({'output_type': 'display_data', 'data': {'text/plain': '<Figure size 640x480 with 2 Axes>', 'i…" |
560 | 560 | ] |
561 | 561 | }, |
562 | 562 | "metadata": {}, |
|
604 | 604 | }, |
605 | 605 | { |
606 | 606 | "cell_type": "code", |
607 | | - "execution_count": 16, |
608 | | - "metadata": { |
609 | | - "scrolled": false |
610 | | - }, |
| 607 | + "execution_count": 49, |
| 608 | + "metadata": {}, |
611 | 609 | "outputs": [], |
612 | 610 | "source": [ |
613 | 611 | "l = widgets.Text(value=' Bayesian Updating Demo, Michael Pyrcz, Professor, The University of Texas at Austin',\n", |
|
682 | 680 | }, |
683 | 681 | { |
684 | 682 | "cell_type": "code", |
685 | | - "execution_count": 17, |
| 683 | + "execution_count": 52, |
686 | 684 | "metadata": {}, |
687 | 685 | "outputs": [ |
688 | 686 | { |
689 | 687 | "data": { |
690 | 688 | "application/vnd.jupyter.widget-view+json": { |
691 | | - "model_id": "9a31e99091f84068a54e39d26bccbfca", |
| 689 | + "model_id": "b4f1ca08d731472986942298dc82a0a1", |
692 | 690 | "version_major": 2, |
693 | 691 | "version_minor": 0 |
694 | 692 | }, |
|
702 | 700 | { |
703 | 701 | "data": { |
704 | 702 | "application/vnd.jupyter.widget-view+json": { |
705 | | - "model_id": "858e1eda25dd4a0a8f70c9cdf3032709", |
| 703 | + "model_id": "2f3199f4b3d243b5932dd4d9a3571ced", |
706 | 704 | "version_major": 2, |
707 | 705 | "version_minor": 0 |
708 | 706 | }, |
|
795 | 793 | "name": "python", |
796 | 794 | "nbconvert_exporter": "python", |
797 | 795 | "pygments_lexer": "ipython3", |
798 | | - "version": "3.11.4" |
| 796 | + "version": "3.12.4" |
799 | 797 | } |
800 | 798 | }, |
801 | 799 | "nbformat": 4, |
802 | | - "nbformat_minor": 2 |
| 800 | + "nbformat_minor": 4 |
803 | 801 | } |
0 commit comments