1 \chapter{Probabilistic representation and reasoning (and burglars)
}
2 \section{Formal description
}
3 In our representation of the model we chose to introduce a
\textit{Noisy OR
} to
4 represent the causal independence of
\textit{Burglar
} and
\textit{Earthquake
}
5 on
\textit{Alarm
}. The visual representation of the network is visible in
6 Figure~
\ref{bnetwork21
}
9 \caption{Bayesian network, visual representation
}
12 \includegraphics[scale=
0.5]{d1.eps
}
15 As for the probabilities for
\textit{Burglar
} and
\textit{Earthquake
} we chose
16 to calculate them using days the unit. Calculation for the probability of a
17 \textit{Burglar
} event happening at some day is then this(assuming a gregorian
18 calendar and leap days).
19 $$
\frac{1}{365 +
0.25 -
0.01 -
0.0025}=
\frac{1}{365.2425}$$
21 This gives the following probability distributions visible in
26 \begin{tabular
}{|l|l|
}
35 \begin{tabular
}{|l|l|
}
44 \begin{tabular
}{|l|ll|
}
46 &
\multicolumn{2}{c|
}{$I_1$
}\\
53 \begin{tabular
}{|l|ll|
}
55 &
\multicolumn{2}{c|
}{$I_2$
}\\
62 \begin{tabular
}{|ll|ll|
}
64 &&
\multicolumn{2}{c|
}{Alarm
}\\
65 $I_1$ & $I_2$ & T & F\\
74 \begin{tabular
}{|l|ll|
}
76 &
\multicolumn{2}{c|
}{Watson
}\\
83 \begin{tabular
}{|l|ll|
}
85 &
\multicolumn{2}{c|
}{Gibbons
}\\
92 \begin{tabular
}{|l|ll|
}
94 &
\multicolumn{2}{c|
}{Radio
}\\
97 T & $
0.9998$ & $
0.0002$\\
98 F & $
0.0002$ & $
0.9998$\\
103 \section{Implementation
}
104 This distribution results in the
\textit{AILog
} code in Listing~
\ref{alarm.ail
}
109 \inputminted[linenos,fontsize=
\footnotesize]{prolog
}{./src/alarm.ail
}
113 Using the following queries the probabilities or as follows:\\
114 \begin{enumerate
}[a)
]
115 \item $P(
\text{Burglary
})=
116 0.002737757092501968$
117 \item $P(
\text{Burglary
}|
\text{Watson called
})=
118 0.005321803679438259$
119 \item $P(
\text{Burglary
}|
\text{Watson called
}\wedge\text{Gibbons called
})=
121 \item $P(
\text{Burglary
}|
\text{Watson called
}\wedge\text{Gibbons called
}
122 \wedge\text{Radio
})=
0.01179672476662423$
126 \begin{minted
}[fontsize=
\footnotesize]{prolog
}
127 ailog: predict burglar.
128 Answer: P(burglar|Obs)=
0.002737757092501968.
129 [ok,more,explanations,worlds,help
]: ok.
131 ailog: observe watson.
132 Answer: P(watson|Obs)=
0.4012587986186947.
133 [ok,more,explanations,worlds,help
]: ok.
135 ailog: predict burglar.
136 Answer: P(burglar|Obs)=
[0.005321803679438259,
0.005321953115441623].
137 [ok,more,explanations,worlds,help
]: ok.
139 ailog: observe gibbons.
140 Answer: P(gibbons|Obs)=
[0.04596053565368094,
0.045962328885721306].
141 [ok,more,explanations,worlds,help
]: ok.
143 ailog: predict burglar.
144 Answer: P(burglar|Obs)=
[0.11180941544755249,
0.1118516494624678].
145 [ok,more,explanations,worlds,help
]: ok.
147 ailog: observe radio.
148 Answer: P(radio|Obs)=
[0.02582105837443645,
0.025915745316785182].
149 [ok,more,explanations,worlds,help
]: ok.
151 ailog: predict burglar.
152 Answer: P(burglar|Obs)=
[0.01179672476662423,
0.015584580594335082].
153 [ok,more,explanations,worlds,help
]: ok.
157 \section{Comparison with manual calculation
}
158 Querying the
\textit{Alarm
} variable gives the following answer
159 \begin{minted
}{prolog
}
160 ailog: predict alarm.
161 Answer: P(alarm|Obs)=
0.0031469965467367292.
162 [ok,more,explanations,worlds,help
]: ok.
165 Using formula: $P(i_1|C_1)+P(i_2|C_2)(
1-P(i_1|C_1))$ we can calculate the
166 probability of the
\textit{Alarm
} variable using variable elimination. This
167 results in the following answer:
168 $$
0.2*
0.0027+
0.95*
0.0027*(
1-
0.2*
0.0027)=
0.00314699654673672941001347$$
170 There is a slight difference in probability. This is probably due to the
171 precision of the
\textit{AILog
} module. The manual calculation was done with
172 arbitrary precision. Manual calculation takes a lot longer and therefore one
173 can prefer the
\textit{AILog
} method when speed is of an essence. When
174 precision is necessary manual calculation is preferred.
176 \section{Burglary problem with extended information
}