final version
[ker2014-2.git] / report / ass2-1.tex
index 42931cc..41573b2 100644 (file)
@@ -18,7 +18,7 @@ calendar and leap days):
 $$\frac{1}{365 + 0.25 - 0.01 - 0.0025}=\frac{1}{365.2425}$$
 
 The resultant probability distributions can be found in Table~\ref{probdist},
-in order to avoid a unclear graph.
+in order to avoid an unclear graph.
 
 \begin{table}[H]
        \label{probdist}
@@ -126,8 +126,8 @@ We implemented the distributions in \textit{AILog}, see Listing~\ref{alarm.ail}
 
 \section{Queries}
 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.\\
+can have AILog calculate some other probabilities given by 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
@@ -156,44 +156,40 @@ probability of a burglary.
 
 \begin{listing}[H]
        \begin{minted}[fontsize=\footnotesize]{prolog}
-ailog: predict burglar.
+AILog: predict burglar.
 Answer: P(burglar|Obs)=0.002737757092501968.
   [ok,more,explanations,worlds,help]: ok.
 
-ailog: observe watson.
+AILog: observe watson.
 Answer: P(watson|Obs)=0.4012587986186947.
   [ok,more,explanations,worlds,help]: ok.
 
-ailog: predict burglar.
+AILog: predict burglar.
 Answer: P(burglar|Obs)=[0.005321803679438259,0.005321953115441623].
   [ok,more,explanations,worlds,help]: ok.
 
-ailog: observe gibbons.
+AILog: observe gibbons.
 Answer: P(gibbons|Obs)=[0.04596053565368094,0.045962328885721306].
   [ok,more,explanations,worlds,help]: ok.
 
-ailog: predict burglar.
+AILog: predict burglar.
 Answer: P(burglar|Obs)=[0.11180941544755249,0.1118516494624678].
   [ok,more,explanations,worlds,help]: ok.
 
-ailog: observe radio.
+AILog: observe radio.
 Answer: P(radio|Obs)=[0.02582105837443645,0.025915745316785182].
   [ok,more,explanations,worlds,help]: ok.
 
-ailog: predict burglar.
+AILog: predict burglar.
 Answer: P(burglar|Obs)=[0.01179672476662423,0.015584580594335082].
   [ok,more,explanations,worlds,help]: ok.
        \end{minted}
 \end{listing}
 
-ToDO write down the most probable explanation for the observed evidence
-
 \section{Comparison with manual calculation}
-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.
+       AILog: predict alarm.
        Answer: P(alarm|Obs)=0.0031469965467367292.
                            
          [ok,more,explanations,worlds,help]: ok.
@@ -206,10 +202,13 @@ 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 exactly the same. 
+that they are exactly the same. The method with which AILog calculates the
+probability is almost the same but that is mainly because we did not use any
+techniques that are not available in AILog. When we would have done the same
+task with a Bayesian network and the use of Bayes' rule we would have had a
+different method.
 
 \newpage
 \section{Burglary problem with extended information}
@@ -239,9 +238,8 @@ We implemented the extended story using a three layered model.\\
 \textit{Each day a burglar decides whether he wants to work or not, and on
         average this happens only 5 days a week} 
        Meaning that every burglar has the same initial working probability: 5/7 (see the first 5 lines of code).\\
-Then we implemented the constraints on the colleagues by telling ailog that a burglary can happen when at least one of our combinations is working (see line 8 to 11).\\
-\textit{Finally, if they decide to burgle, then they will burgle 3 houses a night.} The third layer consists of implementing the change that out of the 10,000 houses in which Joe, William, Jack and Averall are the only burglars, Holmes' house is burgled as one of the three (see line 14 to 19).\\
-This results in the following probability for a burglary at a Holmes' house.
+Then we implemented the constraints on the colleagues by telling AILog that a burglary can happen when at least one of our combinations is working (see line 8 to 11).\\
+\textit{Finally, if they decide to burgle, then they will burgle 3 houses a night.} The third layer consists of implementing the change that out of the 10,000 houses in which Joe, William, Jack and Averall are the only burglars, Holmes' house is burgled as one of the three (see line 14 to 19). This results in the following probability for a burglary at a Holmes' house.
 
 $P(burglary)\cdot(
        P(\text{first house Holmes'})+
@@ -254,10 +252,21 @@ $P(burglary)\cdot(
        \approx 0.000196773$
 
 \section{Bayesian networks}
-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 figure~\ref{bnnetworkhouses}
+A Bayesian network representation of the extended story is possible, but could
+ become very large because of the great number of houses and burglars. However
+  we found a way to create a network that is very compact, see
+   figure~\ref{bnnetworkhouses} and the corresponding probability tables. The
+    network is created in the same way as our implementation of the extended
+     story. Every burglar has the same starting probabilities that are merged 
+     together in whether a burglary happens. Then the probability of a burglary
+      at Holmes' house when there will be burgled is calculated.
+
+\begin{figure}[H]
+       \caption{Bayesian network of burglars and houses}
+       \label{bnnetworkhouses}
+       \centering
+       \includegraphics[scale=0.5]{d2.eps}
+\end{figure}
 
 \begin{tabular}{|l|l|}
        \hline
@@ -325,9 +334,6 @@ The network would look something like in figure~\ref{bnnetworkhouses}
        \hline
 \end{tabular}
 
-\begin{figure}[H]
-       \caption{Bayesian network of burglars and houses}
-       \label{bnnetworkhouses}
-       \centering
-       \includegraphics[scale=0.5]{d2.eps}
-\end{figure}
+\section{Additional Questions}
+We wouldn't change any aspect of the assignment. It is nice that the assignment is slowly increasing in difficulty because of the extention of the story. We estimate that we spent about 20 hours each on the assignment.
+