\includegraphics[scale=0.5]{d1.eps}
\end{figure}
-Days were chosen as unit to model the story. Calculation for the probability of
+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
calendar and leap days):
$$\frac{1}{365 + 0.25 - 0.01 - 0.0025}=\frac{1}{365.2425}$$
T & $0.8$ & $0.2$\\
F & $0.4$ & $0.6$\\
\hline
- \end{tabular}
+ \end{tabular}
\begin{tabular}{|l|ll|}
\hline
& \multicolumn{2}{c|}{Gibbons}\\
\end{tabular}
\end{table}
+\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.\\
+\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.\\
+\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.\\
+
+
\section{Implementation}
-This distribution results in the \textit{AILog} code in Listing~\ref{alarm.ail}
+We implemented the distributions in \textit{AILog}, see Listing~\ref{alarm.ail}
\begin{listing}[H]
\label{alarm.ail}
- \caption{alarm.ail}
+ \caption{Alarm.ail}
\inputminted[linenos,fontsize=\footnotesize]{prolog}{./src/alarm.ail}
\end{listing}
\section{Queries}
-Using the following queries the probabilities or as follows:\\
+Now that we have modelled the story with the corresponding probabilities, we
+can have ailog calculate some other probabilities given a some observations.
+Down below we wrote down some probabilties and the associated ailog output.\\
+The chance that a burglary happens given that Watson calls is greater than the
+chance that a burglary happens without this observations, as is observerd by
+the difference between a and b. This makes sense as Watson calls rightly in
+80\% of the time. So when Holmes receives a call by Watson, the chance that the
+alarm goes of increases.\\
+When we compare b to c, the same mechanisme holds. There are more observations
+that give evidence for a burglary as both Watson and Gibbons have called in the
+case of c.\\
+When you take a look at the last case, d, you see that the probability has
+decreased compared to c. This can be explained by an observation that is added
+on top of the observations of b; the radio. The variable Radio means that the
+newcast tells that there was an earhquake. As that is also a reason why the
+alarm could go of, but has nothing to do with a burglary, it decreases the
+probability of a burglary.
+%We kunnen misschien de kans uitrekenen dat Watson en Gibbons allebei foutief bellen? Daar mis je denk ik info over of niet?
\begin{enumerate}[a)]
\item $P(\text{Burglary})=
0.002737757092501968$
\item $P(\text{Burglary}|\text{Watson called})=
0.005321803679438259$
- \item $P(\text{Burglary}|\text{Watson called}\wedge\text{Gibbons called})=
+ \item $P(\text{Burglary}|\text{Watson called},\text{Gibbons called})=
0.11180941544755249$
- \item $P(\text{Burglary}|\text{Watson called}\wedge\text{Gibbons called}
- \wedge\text{Radio})=0.01179672476662423$
+ \item $P(\text{Burglary}|\text{Watson called},\text{Gibbons called}
+ , \text{Radio})=0.01179672476662423$
\end{enumerate}
\begin{listing}[H]
\end{minted}
\end{listing}
+ToDO write down the most probable explanation for the observed evidence
+
\section{Comparison with manual calculation}
-Querying the \textit{Alarm} variable gives the following answer
+ToDO: english.
+When we let ailog calculate the probability of alarm. %Wat is Obs hier??
+Querying the \textit{Alarm} variable gives the following answer:
\begin{minted}{prolog}
ailog: predict alarm.
Answer: P(alarm|Obs)=0.0031469965467367292.
[ok,more,explanations,worlds,help]: ok.
\end{minted}
-Using formula: $P(i_1|C_1)+P(i_2|C_2)(1-P(i_1|C_1))$ we can calculate the
+Using the formula for causal independence with a logical OR:\\
+$P(Alarm|C_1, C_2) = P(i_1|C_1)+P(i_2|C_2)(1-P(i_1|C_1))$ we can calculate the
probability of the \textit{Alarm} variable using variable elimination. This
-results in the following answer:
-$$0.2*0.0027+0.95*0.0027*(1-0.2*0.0027)=0.00314699654673673$$
-TODOOOOOOOOOOO
+results in the following answer:\\
+$P(Alarm|burglar, earthquake) =
+P(i_1|burglar)+P(i_2|earthquake)(1-P(i_1|burglar)) =
+0.2*0.0027+0.95*0.0027*(1-0.2*0.0027)=0.00314699654673673$ \\
+TODOOOOOOOOOOO %Ik weet niet of we i_1 en i_2 nog door iets anders vervangen
+% moeten worden.
+When you compare the output of ailog and of the variable elimination, you see
+that they are similar.
\newpage
\section{Burglary problem with extended information}
A bayesian network representation of the burglary problem with a multitude of
houses and burglars is possible but would be very big and tedious because all
the constraints about the burglars must be incorporated in the network.
-The network would look something like in figere~\ref{bnnetworkhouses}
-accompanied with the probability distributions below.
+The network would look something like in figure~\ref{bnnetworkhouses}
+
\begin{tabular}{|l|l|}
\hline