Skip to content

Commit f7b1000

Browse files
committed
probability notebook: populate outputs in the car-insurance section
Ran just the new section's cells and embedded their results (the rain mini-net query, the Insurance net load, the multi-valued domains, and the two exact-inference queries) so the demo renders with output. Other cells untouched.
1 parent 981adad commit f7b1000

1 file changed

Lines changed: 75 additions & 11 deletions

File tree

‎notebooks/probability.ipynb‎

Lines changed: 75 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3029,9 +3029,20 @@
30293029
},
30303030
{
30313031
"cell_type": "code",
3032-
"execution_count": null,
3032+
"execution_count": 3,
30333033
"metadata": {},
3034-
"outputs": [],
3034+
"outputs": [
3035+
{
3036+
"data": {
3037+
"text/plain": [
3038+
"'heavy: 0.308, light: 0.462, none: 0.231'"
3039+
]
3040+
},
3041+
"execution_count": 3,
3042+
"metadata": {},
3043+
"output_type": "execute_result"
3044+
}
3045+
],
30353046
"source": [
30363047
"rain_net = DiscreteBayesNet([\n",
30373048
" ('Rain', '', ['none', 'light', 'heavy'], {(): [0.6, 0.3, 0.1]}),\n",
@@ -3053,9 +3064,28 @@
30533064
},
30543065
{
30553066
"cell_type": "code",
3056-
"execution_count": null,
3067+
"execution_count": 4,
30573068
"metadata": {},
3058-
"outputs": [],
3069+
"outputs": [
3070+
{
3071+
"data": {
3072+
"text/plain": [
3073+
"(27,\n",
3074+
" ['Age',\n",
3075+
" 'SocioEcon',\n",
3076+
" 'GoodStudent',\n",
3077+
" 'RiskAversion',\n",
3078+
" 'VehicleYear',\n",
3079+
" 'MakeModel',\n",
3080+
" 'Antilock',\n",
3081+
" 'Mileage'])"
3082+
]
3083+
},
3084+
"execution_count": 4,
3085+
"metadata": {},
3086+
"output_type": "execute_result"
3087+
}
3088+
],
30593089
"source": [
30603090
"insurance_net = insurance()\n",
30613091
"len(insurance_net.variables), insurance_net.variables[:8]"
@@ -3070,9 +3100,21 @@
30703100
},
30713101
{
30723102
"cell_type": "code",
3073-
"execution_count": null,
3103+
"execution_count": 5,
30743104
"metadata": {},
3075-
"outputs": [],
3105+
"outputs": [
3106+
{
3107+
"data": {
3108+
"text/plain": [
3109+
"(['Adolescent', 'Adult', 'Senior'],\n",
3110+
" ['Thousand', 'TenThou', 'HundredThou', 'Million'])"
3111+
]
3112+
},
3113+
"execution_count": 5,
3114+
"metadata": {},
3115+
"output_type": "execute_result"
3116+
}
3117+
],
30763118
"source": [
30773119
"insurance_net.variable_values('Age'), insurance_net.variable_values('MedCost')"
30783120
]
@@ -3086,9 +3128,20 @@
30863128
},
30873129
{
30883130
"cell_type": "code",
3089-
"execution_count": null,
3131+
"execution_count": 6,
30903132
"metadata": {},
3091-
"outputs": [],
3133+
"outputs": [
3134+
{
3135+
"data": {
3136+
"text/plain": [
3137+
"'Adolescent: 0.2, Adult: 0.6, Senior: 0.2'"
3138+
]
3139+
},
3140+
"execution_count": 6,
3141+
"metadata": {},
3142+
"output_type": "execute_result"
3143+
}
3144+
],
30923145
"source": [
30933146
"elimination_ask('Age', dict(), insurance_net).show_approx()"
30943147
]
@@ -3102,9 +3155,20 @@
31023155
},
31033156
{
31043157
"cell_type": "code",
3105-
"execution_count": null,
3158+
"execution_count": 7,
31063159
"metadata": {},
3107-
"outputs": [],
3160+
"outputs": [
3161+
{
3162+
"data": {
3163+
"text/plain": [
3164+
"'False: 0.6, True: 0.4'"
3165+
]
3166+
},
3167+
"execution_count": 7,
3168+
"metadata": {},
3169+
"output_type": "execute_result"
3170+
}
3171+
],
31083172
"source": [
31093173
"elimination_ask('GoodStudent', dict(Age='Adolescent', SocioEcon='Wealthy'), insurance_net).show_approx()"
31103174
]
@@ -6619,7 +6683,7 @@
66196683
"name": "python",
66206684
"nbconvert_exporter": "python",
66216685
"pygments_lexer": "ipython3",
6622-
"version": "3.6.9"
6686+
"version": "3.12.13"
66236687
}
66246688
},
66256689
"nbformat": 4,

0 commit comments

Comments
 (0)