1 \chapter{Probabilistic representation and reasoning (and burglars)
}
2 \section{Formal description
}
3 In our representation of the model we introduced a
\textit{Noisy OR
} to
4 represent the causal independence of
\textit{Burglar
} and
\textit{Earthquake
}
5 on
\textit{Alarm
}. The representation of the network is displayed in
6 Figure~
\ref{bnetwork21
}
9 \caption{Bayesian network alarmsystem
}
12 \includegraphics[scale=
0.5]{d1.eps
}
15 Days were chosen as unit to model the story. Calculation of the probability of a
\textit{Burglar
} event happening at some day is then (assuming a Gregorian
16 calendar and leap days):
17 $$
\frac{1}{365 +
0.25 -
0.01 -
0.0025}=
\frac{1}{365.2425}$$
19 The resultant probability distributions can be found in table ~
\ref{probdist
}, in order to avoid a unclear graph.
23 \begin{tabular
}{|l|l|
}
32 \begin{tabular
}{|l|l|
}
41 \begin{tabular
}{|l|ll|
}
43 &
\multicolumn{2}{c|
}{$I_1$
}\\
50 \begin{tabular
}{|l|ll|
}
52 &
\multicolumn{2}{c|
}{$I_2$
}\\
59 \begin{tabular
}{|ll|ll|
}
61 &&
\multicolumn{2}{c|
}{Alarm
}\\
62 $I_1$ & $I_2$ & T & F\\
71 \begin{tabular
}{|l|ll|
}
73 &
\multicolumn{2}{c|
}{Watson
}\\
80 \begin{tabular
}{|l|ll|
}
82 &
\multicolumn{2}{c|
}{Gibbons
}\\
89 \begin{tabular
}{|l|ll|
}
91 &
\multicolumn{2}{c|
}{Radio
}\\
94 T & $
0.9998$ & $
0.0002$\\
95 F & $
0.0002$ & $
0.9998$\\
100 \textit{If there is a burglar present (which could happen once every ten years), the alarm is known to go off
95\% of the time.
} We modelled this by setting the value for Burglar True and $I_2$ True on
0,
95. \\
101 \textit{There’s a
40\% chance that Watson is joking and the alarm is in fact off.
} This is modelled by putting the value for Watson True and Alarm F on
0,
4. As Holmes expects Watson to call in
80\% of the time, the value for alarm True and Watson True is set
0,
2. Because the rows have to sum to
1, the other values are easily calculated. \\
102 \textit{She may not have heard the alarm in
1\% of the cases and is thought to erroneously
report an alarm when it is in fact off in
4\% of the cases.
} We modelled this by assuming that when Mrs. Gibbons hears the alarm, she calls Holmes. Meaning that the value for Gibbons False and Alarm true is
0,
01. As she reports when the alarm is in fact off in
4\% of the cases, the value for Gibbons True and alarm False is
0,
04. \\
106 \section{Implementation
}
107 We implemented the distributions in
\textit{AILog
}, see Listing~
\ref{alarm.ail
}
112 \inputminted[linenos,fontsize=
\footnotesize]{prolog
}{./src/alarm.ail
}
116 Using the following queries the probabilities are as follows:\\
117 \begin{enumerate
}[a)
]
118 \item $P(
\text{Burglary
})=
119 0.002737757092501968$
120 \item $P(
\text{Burglary
}|
\text{Watson called
})=
121 0.005321803679438259$
122 \item $P(
\text{Burglary
}|
\text{Watson called
}\wedge\text{Gibbons called
})=
124 \item $P(
\text{Burglary
}|
\text{Watson called
}\wedge\text{Gibbons called
}
125 \wedge\text{Radio
})=
0.01179672476662423$
129 \begin{minted
}[fontsize=
\footnotesize]{prolog
}
130 ailog: predict burglar.
131 Answer: P(burglar|Obs)=
0.002737757092501968.
132 [ok,more,explanations,worlds,help
]: ok.
134 ailog: observe watson.
135 Answer: P(watson|Obs)=
0.4012587986186947.
136 [ok,more,explanations,worlds,help
]: ok.
138 ailog: predict burglar.
139 Answer: P(burglar|Obs)=
[0.005321803679438259,
0.005321953115441623].
140 [ok,more,explanations,worlds,help
]: ok.
142 ailog: observe gibbons.
143 Answer: P(gibbons|Obs)=
[0.04596053565368094,
0.045962328885721306].
144 [ok,more,explanations,worlds,help
]: ok.
146 ailog: predict burglar.
147 Answer: P(burglar|Obs)=
[0.11180941544755249,
0.1118516494624678].
148 [ok,more,explanations,worlds,help
]: ok.
150 ailog: observe radio.
151 Answer: P(radio|Obs)=
[0.02582105837443645,
0.025915745316785182].
152 [ok,more,explanations,worlds,help
]: ok.
154 ailog: predict burglar.
155 Answer: P(burglar|Obs)=
[0.01179672476662423,
0.015584580594335082].
156 [ok,more,explanations,worlds,help
]: ok.
160 \section{Comparison with manual calculation
}
161 Querying the
\textit{Alarm
} variable gives the following answer:
162 \begin{minted
}{prolog
}
163 ailog: predict alarm.
164 Answer: P(alarm|Obs)=
0.0031469965467367292.
166 [ok,more,explanations,worlds,help
]: ok.
169 Using formula: $P(i_1|C_1)+P(i_2|C_2)(
1-P(i_1|C_1))$ we can calculate the
170 probability of the
\textit{Alarm
} variable using variable elimination. This
171 results in the following answer:
172 $$
0.2*
0.0027+
0.95*
0.0027*(
1-
0.2*
0.0027)=
0.00314699654673673$$
176 \section{Burglary problem with extended information
}
177 $P(burglary)
\cdot\left(
178 P(
\text{first house is holmes'
})+
179 P(
\text{second house is holmes'
})+
180 P(
\text{third house is holmes'
})
\right)=\\
183 \frac{9999}{10000}\cdot\frac{1}{9999}+
184 \frac{9999}{10000}\cdot\frac{9998}{9999}\cdot\frac{1}{9998}\right)=
185 \frac{3}{19600}\approx0.000153$
187 \section{Bayesian networks
}
188 A bayesian network representation of the burglary problem with a multitude of
189 houses and burglars is possible but would be very big and tedious because all
190 the constraints about the burglars must be incorporated in the network.
191 The network would look something like in figure~
\ref{bnnetworkhouses
}
193 \begin{tabular
}{|l|l|
}
197 T & $
\nicefrac{5}{7}$\\
198 F & $
\nicefrac{2}{7}$\\
201 \begin{tabular
}{|l|l|
}
205 T & $
\nicefrac{5}{7}$\\
206 F & $
\nicefrac{2}{7}$\\
209 \begin{tabular
}{|l|l|
}
213 T & $
\nicefrac{5}{7}$\\
214 F & $
\nicefrac{2}{7}$\\
217 \begin{tabular
}{|l|l|
}
221 T & $
\nicefrac{5}{7}$\\
222 F & $
\nicefrac{2}{7}$\\
226 \begin{tabular
}{|llll|ll|
}
229 Joe & William & Jack & Averall & T & F\\
231 F& F& F& F & $
0$ & $
1$\\
232 F& F& F& T & $
0$ & $
1$\\
233 F& F& T& F & $
0$ & $
1$\\
234 F& F& T& T & $
0$ & $
1$\\
235 F& T& F& F & $
0$ & $
1$\\
236 F& T& F& T & $
0$ & $
1$\\
237 F& T& T& F & $
0$ & $
1$\\
238 F& T& T& T & $
0$ & $
1$\\
239 T& F& F& F & $
0$ & $
1$\\
240 T& F& F& T & $
0$ & $
1$\\
241 T& F& T& F & $
1$ & $
0$\\
242 T& F& T& T & $
0$ & $
1$\\
243 T& T& F& F & $
1$ & $
0$\\
244 T& T& F& T & $
0$ & $
1$\\
245 T& T& T& F & $
1$ & $
0$\\
246 T& T& T& T & $
1$ & $
0$\\
249 \begin{tabular
}{|lll|
}
254 T & $
0.000153$ & $
0.999847$\\
261 \caption{Bayesian network of burglars and houses
}
262 \label{bnnetworkhouses
}
264 %\includegraphics[scale=0.5]{d2.eps}