hallo'
[ker2014-2.git] / report / ass2-1.tex
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}
7
8 \begin{figure}[H]
9 \caption{Bayesian network, visual representation}
10 \label{bnetwork21}
11 \centering
12 \includegraphics[scale=0.5]{d1.eps}
13 \end{figure}
14
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}$$
20
21 This gives the following probability distributions visible in
22 Table~\ref{probdist}
23
24 \begin{table}[H]
25 \label{probdist}
26 \begin{tabular}{|l|ll|}
27 \hline
28 & \multicolumn{2}{c|}{Earthquake}\\
29 \hline
30 T & $0.0027$ & $0.9972$ \\
31 F & $0.9973$ & $0.0027$\\
32 \hline
33 \end{tabular}
34 %
35 \begin{tabular}{|l|ll|}
36 \hline
37 & \multicolumn{2}{c|}{Burglar}\\
38 \hline
39 T & $0.0027$ & $0.9973$ \\
40 F & $0.9973$ & $0.0027$\\
41 \hline
42 \end{tabular}
43
44 \begin{tabular}{|l|ll|}
45 \hline
46 & \multicolumn{2}{c|}{$I_1$}\\
47 Earthquake & T & F\\
48 \hline
49 T & $0.2$ & $0.8$\\
50 F & $0$ & $1$\\
51 \hline
52 \end{tabular}
53 \begin{tabular}{|l|ll|}
54 \hline
55 & \multicolumn{2}{c|}{$I_2$}\\
56 Burglar & T & F\\
57 \hline
58 T & $0.95$ & $0.05$\\
59 F & $0$ & $1$\\
60 \hline
61 \end{tabular}
62 \begin{tabular}{|ll|ll|}
63 \hline
64 && \multicolumn{2}{c|}{Alarm}\\
65 $I_1$ & $I_2$ & T & F\\
66 \hline
67 T & T & $1$ & $0$\\
68 T & F & $1$ & $0$\\
69 F & T & $1$ & $0$\\
70 F & F & $0$ & $1$\\
71 \hline
72 \end{tabular}
73
74 \begin{tabular}{|l|ll|}
75 \hline
76 & \multicolumn{2}{c|}{Watson}\\
77 Alarm & T & F\\
78 \hline
79 T & $0.8$ & $0.2$\\
80 F & $0.4$ & $0.6$\\
81 \hline
82 \end{tabular}
83 \begin{tabular}{|l|ll|}
84 \hline
85 & \multicolumn{2}{c|}{Gibbons}\\
86 Alarm & T & F\\
87 \hline
88 T & $0.99$ & $0.01$\\
89 F & $0.04$ & $0.96$\\
90 \hline
91 \end{tabular}
92 \begin{tabular}{|l|ll|}
93 \hline
94 & \multicolumn{2}{c|}{Radio}\\
95 Earthquake & T & F\\
96 \hline
97 T & $0.9998$ & $0.0002$\\
98 F & $0.0002$ & $0.9998$\\
99 \hline
100 \end{tabular}
101 \end{table}
102
103 \section{Implementation}
104 This distribution results in the \textit{AILog} code in Listing~\ref{alarm.ail}
105
106 \begin{listing}
107 \label{alarm.ail}
108 \caption{Alarm.ail}
109 \inputminted[linenos,fontsize=\footnotesize]{prolog}{./src/alarm.ail}
110 \end{listing}