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 for the probability of
16 a
\textit{Burglar
} event happening at some day is then (assuming a gregorian
17 calendar and leap days):
18 $$
\frac{1}{365 +
0.25 -
0.01 -
0.0025}=
\frac{1}{365.2425}$$
20 The resultant probability distributions can be found in Table~
\ref{probdist
},
21 in order to avoid a unclear graph.
25 \begin{tabular
}{|l|l|
}
34 \begin{tabular
}{|l|l|
}
43 \begin{tabular
}{|l|ll|
}
45 &
\multicolumn{2}{c|
}{$I_1$
}\\
52 \begin{tabular
}{|l|ll|
}
54 &
\multicolumn{2}{c|
}{$I_2$
}\\
61 \begin{tabular
}{|ll|ll|
}
63 &&
\multicolumn{2}{c|
}{Alarm
}\\
64 $I_1$ & $I_2$ & T & F\\
73 \begin{tabular
}{|l|ll|
}
75 &
\multicolumn{2}{c|
}{Watson
}\\
82 \begin{tabular
}{|l|ll|
}
84 &
\multicolumn{2}{c|
}{Gibbons
}\\
91 \begin{tabular
}{|l|ll|
}
93 &
\multicolumn{2}{c|
}{Radio
}\\
96 T & $
0.9998$ & $
0.0002$\\
97 F & $
0.0002$ & $
0.9998$\\
102 \section{Implementation
}
103 This distribution results in the
\textit{AILog
} code in Listing~
\ref{alarm.ail
}
108 \inputminted[linenos,fontsize=
\footnotesize]{prolog
}{./src/alarm.ail
}
112 Using the following queries the probabilities or as follows:\\
113 \begin{enumerate
}[a)
]
114 \item $P(
\text{Burglary
})=
115 0.002737757092501968$
116 \item $P(
\text{Burglary
}|
\text{Watson called
})=
117 0.005321803679438259$
118 \item $P(
\text{Burglary
}|
\text{Watson called
}\wedge\text{Gibbons called
})=
120 \item $P(
\text{Burglary
}|
\text{Watson called
}\wedge\text{Gibbons called
}
121 \wedge\text{Radio
})=
0.01179672476662423$
125 \begin{minted
}[fontsize=
\footnotesize]{prolog
}
126 ailog: predict burglar.
127 Answer: P(burglar|Obs)=
0.002737757092501968.
128 [ok,more,explanations,worlds,help
]: ok.
130 ailog: observe watson.
131 Answer: P(watson|Obs)=
0.4012587986186947.
132 [ok,more,explanations,worlds,help
]: ok.
134 ailog: predict burglar.
135 Answer: P(burglar|Obs)=
[0.005321803679438259,
0.005321953115441623].
136 [ok,more,explanations,worlds,help
]: ok.
138 ailog: observe gibbons.
139 Answer: P(gibbons|Obs)=
[0.04596053565368094,
0.045962328885721306].
140 [ok,more,explanations,worlds,help
]: ok.
142 ailog: predict burglar.
143 Answer: P(burglar|Obs)=
[0.11180941544755249,
0.1118516494624678].
144 [ok,more,explanations,worlds,help
]: ok.
146 ailog: observe radio.
147 Answer: P(radio|Obs)=
[0.02582105837443645,
0.025915745316785182].
148 [ok,more,explanations,worlds,help
]: ok.
150 ailog: predict burglar.
151 Answer: P(burglar|Obs)=
[0.01179672476662423,
0.015584580594335082].
152 [ok,more,explanations,worlds,help
]: ok.
156 \section{Comparison with manual calculation
}
157 Querying the
\textit{Alarm
} variable gives the following answer
158 \begin{minted
}{prolog
}
159 ailog: predict alarm.
160 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.00314699654673673$$
172 \section{Burglary problem with extended information
}
173 $P(burglary)
\cdot\left(
174 P(
\text{first house is holmes'
})+
175 P(
\text{second house is holmes'
})+
176 P(
\text{third house is holmes'
})
\right)=\\
179 \frac{9999}{10000}\cdot\frac{1}{9999}+
180 \frac{9999}{10000}\cdot\frac{9998}{9999}\cdot\frac{1}{9998}\right)=
181 \frac{3}{19600}\approx0.000153$
183 \section{Bayesian networks
}
184 A bayesian network representation of the burglary problem with a multitude of
185 houses and burglars is possible but would be very big and tedious because all
186 the constraints about the burglars must be incorporated in the network.
187 The network would look something like in figere~
\ref{bnnetworkhouses
}
188 accompanied with the probability distributions below.
190 \begin{tabular
}{|l|l|
}
194 T & $
\nicefrac{5}{7}$\\
195 F & $
\nicefrac{2}{7}$\\
198 \begin{tabular
}{|l|l|
}
202 T & $
\nicefrac{5}{7}$\\
203 F & $
\nicefrac{2}{7}$\\
206 \begin{tabular
}{|l|l|
}
210 T & $
\nicefrac{5}{7}$\\
211 F & $
\nicefrac{2}{7}$\\
214 \begin{tabular
}{|l|l|
}
218 T & $
\nicefrac{5}{7}$\\
219 F & $
\nicefrac{2}{7}$\\
223 \begin{tabular
}{|llll|ll|
}
226 Joe & William & Jack & Averall & T & F\\
228 F& F& F& F & $
0$ & $
1$\\
229 F& F& F& T & $
0$ & $
1$\\
230 F& F& T& F & $
0$ & $
1$\\
231 F& F& T& T & $
0$ & $
1$\\
232 F& T& F& F & $
0$ & $
1$\\
233 F& T& F& T & $
0$ & $
1$\\
234 F& T& T& F & $
0$ & $
1$\\
235 F& T& T& T & $
0$ & $
1$\\
236 T& F& F& F & $
0$ & $
1$\\
237 T& F& F& T & $
0$ & $
1$\\
238 T& F& T& F & $
1$ & $
0$\\
239 T& F& T& T & $
0$ & $
1$\\
240 T& T& F& F & $
1$ & $
0$\\
241 T& T& F& T & $
0$ & $
1$\\
242 T& T& T& F & $
1$ & $
0$\\
243 T& T& T& T & $
1$ & $
0$\\
246 \begin{tabular
}{|lll|
}
251 T & $
0.000153$ & $
0.999847$\\
257 \caption{Bayesian network of burglars and houses
}
258 \label{bnnetworkhouses
}
260 \includegraphics[scale=
0.5]{d2.eps
}