Skip to content

Commit 1505173

Browse files
authored
Add files via upload
1 parent d60714b commit 1505173

File tree

1 file changed

+38
-40
lines changed

1 file changed

+38
-40
lines changed

Interactive_Bayesian_Updating.ipynb

Lines changed: 38 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -102,12 +102,12 @@
102102
},
103103
{
104104
"cell_type": "code",
105-
"execution_count": 4,
105+
"execution_count": 21,
106106
"metadata": {},
107107
"outputs": [],
108108
"source": [
109109
"%matplotlib inline\n",
110-
"supress_warnings = False\n",
110+
"supress_warnings = True\n",
111111
"from ipywidgets import interactive # widgets and interactivity\n",
112112
"from ipywidgets import widgets # widgets and interactivity\n",
113113
"import matplotlib; import matplotlib.pyplot as plt # plotting\n",
@@ -140,7 +140,7 @@
140140
},
141141
{
142142
"cell_type": "code",
143-
"execution_count": 5,
143+
"execution_count": 24,
144144
"metadata": {},
145145
"outputs": [],
146146
"source": [
@@ -177,7 +177,7 @@
177177
},
178178
{
179179
"cell_type": "code",
180-
"execution_count": 6,
180+
"execution_count": 39,
181181
"metadata": {},
182182
"outputs": [],
183183
"source": [
@@ -198,18 +198,18 @@
198198
"\n",
199199
"def run_plot_summary1(P_happening,P_positive_given_happening,P_positive_given_not_happening):\n",
200200
" 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",
204204
" \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",
207207
" \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",
210210
" \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",
213213
" \n",
214214
" plt.subplot(111)\n",
215215
" plt.plot()\n",
@@ -283,13 +283,13 @@
283283
},
284284
{
285285
"cell_type": "code",
286-
"execution_count": 7,
286+
"execution_count": 42,
287287
"metadata": {},
288288
"outputs": [
289289
{
290290
"data": {
291291
"application/vnd.jupyter.widget-view+json": {
292-
"model_id": "9f463f05380247aca636afc2264ae0a0",
292+
"model_id": "081c8551585642b2b2ea6136696b799d",
293293
"version_major": 2,
294294
"version_minor": 0
295295
},
@@ -303,12 +303,12 @@
303303
{
304304
"data": {
305305
"application/vnd.jupyter.widget-view+json": {
306-
"model_id": "70ad5e2b4fc24f499708c4b904c1dc3a",
306+
"model_id": "1d10d27396dd478e8c684f41495c3fd9",
307307
"version_major": 2,
308308
"version_minor": 0
309309
},
310310
"text/plain": [
311-
"Output()"
311+
"Output(outputs=({'output_type': 'display_data', 'data': {'text/plain': '<Figure size 640x480 with 1 Axes>', 'i…"
312312
]
313313
},
314314
"metadata": {},
@@ -343,7 +343,7 @@
343343
},
344344
{
345345
"cell_type": "code",
346-
"execution_count": 8,
346+
"execution_count": 44,
347347
"metadata": {},
348348
"outputs": [],
349349
"source": [
@@ -362,18 +362,18 @@
362362
"\n",
363363
"def run_plot_summary(P_happening,P_positive_given_happening,P_positive_given_not_happening):\n",
364364
" 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",
368368
" \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",
371371
" \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",
374374
" \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",
377377
" \n",
378378
" plt.subplot(211)\n",
379379
" plt.plot()\n",
@@ -531,13 +531,13 @@
531531
},
532532
{
533533
"cell_type": "code",
534-
"execution_count": 9,
534+
"execution_count": 47,
535535
"metadata": {},
536536
"outputs": [
537537
{
538538
"data": {
539539
"application/vnd.jupyter.widget-view+json": {
540-
"model_id": "65fba05d2f634969b120b5c7d078538b",
540+
"model_id": "d72830d524704fe69cf2ef205e0ad4c5",
541541
"version_major": 2,
542542
"version_minor": 0
543543
},
@@ -551,12 +551,12 @@
551551
{
552552
"data": {
553553
"application/vnd.jupyter.widget-view+json": {
554-
"model_id": "6e48ff1254f1405b8ac2fbf7077f467f",
554+
"model_id": "a1990c0264884670a49ffa4ecf045daa",
555555
"version_major": 2,
556556
"version_minor": 0
557557
},
558558
"text/plain": [
559-
"Output()"
559+
"Output(outputs=({'output_type': 'display_data', 'data': {'text/plain': '<Figure size 640x480 with 2 Axes>', 'i…"
560560
]
561561
},
562562
"metadata": {},
@@ -604,10 +604,8 @@
604604
},
605605
{
606606
"cell_type": "code",
607-
"execution_count": 16,
608-
"metadata": {
609-
"scrolled": false
610-
},
607+
"execution_count": 49,
608+
"metadata": {},
611609
"outputs": [],
612610
"source": [
613611
"l = widgets.Text(value=' Bayesian Updating Demo, Michael Pyrcz, Professor, The University of Texas at Austin',\n",
@@ -682,13 +680,13 @@
682680
},
683681
{
684682
"cell_type": "code",
685-
"execution_count": 17,
683+
"execution_count": 52,
686684
"metadata": {},
687685
"outputs": [
688686
{
689687
"data": {
690688
"application/vnd.jupyter.widget-view+json": {
691-
"model_id": "9a31e99091f84068a54e39d26bccbfca",
689+
"model_id": "b4f1ca08d731472986942298dc82a0a1",
692690
"version_major": 2,
693691
"version_minor": 0
694692
},
@@ -702,7 +700,7 @@
702700
{
703701
"data": {
704702
"application/vnd.jupyter.widget-view+json": {
705-
"model_id": "858e1eda25dd4a0a8f70c9cdf3032709",
703+
"model_id": "2f3199f4b3d243b5932dd4d9a3571ced",
706704
"version_major": 2,
707705
"version_minor": 0
708706
},
@@ -795,9 +793,9 @@
795793
"name": "python",
796794
"nbconvert_exporter": "python",
797795
"pygments_lexer": "ipython3",
798-
"version": "3.11.4"
796+
"version": "3.12.4"
799797
}
800798
},
801799
"nbformat": 4,
802-
"nbformat_minor": 2
800+
"nbformat_minor": 4
803801
}

0 commit comments

Comments
 (0)