reflections
[ker2014-2.git] / report / ass2-2.tex
1 \chapter{Visual representations and reasoning}
2 We chose pizzas for our domain, as everybody likes pizzas. We chose to have six different pizzas. As all pizzas have tomato sauce and cheese, we didn't take those into account. Below we listed all the pizzas and their ingredients.
3 \begin{itemize}
4 \item Margherita; basil
5 \item Hawaii; ham, pineapple and basil
6 \item Salami; salami and basil
7 \item Funghi; mushrooms and ham
8 \item Pepperoni; salami and jalape\~nos
9 \end{itemize}
10
11 We are able to observe different kind of shapes; circles, double circles (like tires or olives in our case), squares and blobs. For each shape it is possible that it represents different ingredients. Because of this we defined for every shape the probabilities that it is a particular ingredient. For example a circle could be basil, salami or mozarella with respectively probabilities of 0.2, 0.4 and 0.4. The probability that basil is observed is then composed out of the probability that you observed a 'basil' circle and the probability that you have actually observed a circle.
12
13 Our style of reasoning that we employed is deductive. %Iets met vanuit een knowledgebase redeneren en vanuit hypotheses ofzo?
14
15 \iffalse
16 TODO
17 In a more structured way, you are required to describe clearly and fully:
18 • The domain and the individual images
19 • The representation of observations, assumables and the causal theory between them in AILog
20 • The style of reasoning employed (abductive, deductive) and what considerations have played
21 a role
22 • The queries used to infer information about individual images
23 • The results of the queries and reflections on their effectiveness and intuitions behind them
24 • General reflections on your model, how appropriate it is for this domain, how effective it is
25 and how would need to proceed if one would like to extend it to large datasets or realistic,
26 real-time operation.
27
28
29 \fi
30 \section{Domain representation}
31 Translating the domain specification to AILog results in the following AILog
32 code:
33 \inputminted[linenos,fontsize=\footnotesize]{prolog}{./src/pizza.ail}
34
35 \section{Queries}
36 \subsection{Initial probabilities}
37 Chances for shapes to be present are visible in Table~\ref{chances} and from
38 that we can calculate all the initial probabilites for all the shapes for
39 example with the following queries:
40 \begin{minted}[fontsize=\footnotesize]{prolog}
41 ailog: predict circle.
42 Answer: P(circle|Obs)=0.01.
43 [ok,more,explanations,worlds,help]: ok.
44 ailog: observe circle.
45 Answer: P(circle|Obs)=0.01.
46 [ok,more,explanations,worlds,help]: ok.
47 ailog: predict circlePresent.
48 Answer: P(circlePresent|Obs)=0.95.
49 [ok,more,explanations,worlds,help]: ok.
50 \end{minted}
51 \begin{table}
52 \label{chances}
53 \begin{tabular}{|l|ll|}
54 \hline
55 & Observed &\\
56 Present & T & F\\
57 \hline
58 T & $0.95$ & $0.01$\\
59 F & $0.05$ & $0.99$\\
60 \hline
61 \end{tabular}
62 \end{table}
63
64 \subsection{Querying probabilites for pizzas}
65 Since the chance of a false positive on a shape is so low the initial
66 probabilities for pizza types are very low. When certain shapes that belong to
67 a certain type of pizza occur the probability improves a lot. We can show this
68 by showing the probabilites of a pepperoni pizza before, during and after
69 observing the ingredients with the following queries:
70 \begin{minted}[fontsize=\footnotesize]{prolog}
71 ailog: predict p_pepperoni.
72 Answer: P(p_pepperoni|Obs)=0.0019.
73 [ok,more,explanations,worlds,help]: ok.
74 ailog: observe circle.
75 Answer: P(circle|Obs)=1.0.
76 [ok,more,explanations,worlds,help]: ok.
77 ailog: predict p_pepperoni.
78 Answer: P(p_pepperoni|Obs)=0.0019.
79 [ok,more,explanations,worlds,help]: ok.
80 ailog: observe doublecircle.
81 Answer: P(doublecircle|Obs)=0.01.
82 [ok,more,explanations,worlds,help]: ok.
83 ailog: predict p_pepperoni.
84 Answer: P(p_pepperoni|Obs)=0.19.
85 [ok,more,explanations,worlds,help]: ok.
86 \end{minted}
87
88 \subsection{Finding out which pizza is the most likely to be present on the
89 image}
90 We do not only want to know what the probability for a specific pizza is but
91 also the most likely pizza so that we can give an educated guess about the
92 pizza type present on the image processed. This can be done with the following
93 queries using the \texttt{whatpizza} predicate. The \texttt{whatpizza}
94 predicate is a predicate that is a disjunction of all pizza types. In the
95 following queries, when the possible explanations, are given we can query for
96 every possible explanations to find out how the most likely world looks like:
97 \begin{minted}[fontsize=\footnotesize]{prolog}
98 ailog: predict whatpizza.
99 Answer: P(whatpizza|Obs)=[0.19251740120000002,0.19278577620000004].
100 [ok,more,explanations,worlds,help]: explanations.
101 0: ass([],[basilcircle,circle,doublecircle,doublecircleOlives,noObserveError],9.5e-6)
102 1: ass([],[circle,doublecircle,doublecircleJalapenos,noObserveError,salamicircle],1.9e-5)
103 2: ass([],[blob,blobHam,blobMushrooms,circle,funghiham,noObserveError],3.3249999999999995e-6)
104 3: ass([],[basilcircle,circle,noObserveError,salamibasil,salamicircle],7.6e-5)
105 4: ass([],[basilcircle,circle,noObserveError],0.0019)
106 5: ass([],[blob,blobbasil,circle,noObserveError],9.5e-6)
107 [ok,more,how i,help]: how 4.
108 whatpizza <-
109 1: p_margarita
110 How? [Number,up,retry,ok,prompt,help]: up.
111 Answer: P(whatpizza|Obs)=[0.19251740120000002,0.19278577620000004].
112 [ok,more,explanations,worlds,help]: ok.
113 ailog: observe blob.
114 Answer: P(blob|Obs)=0.01.
115 [ok,more,explanations,worlds,help]: ok.
116 ailog: predict whatpizza.
117 Answer: P(whatpizza|Obs)=[0.28994000000000003,0.33126500000000003].
118 [ok,more,explanations,worlds,help]: explanations.
119 0: ass([],[blob,blobHam,blobMushrooms,circle,funghiham,noObserveError],3.3249999999999995e-6)
120 1: ass([],[basilcircle,blob,circle,noObserveError],1.9e-5)
121 2: ass([],[blob,blobbasil,circle,noObserveError],9.5e-6)
122 [ok,more,how i,help]: how 0.
123 whatpizza <-
124 1: p_funghi
125 How? [Number,up,retry,ok,prompt,help]: ok.
126 \end{minted}
127
128 \section{Reflections}
129 The model is relatively effective. One can easily compute the most likely pizza
130 configuration from abstract shapes only. The model is also very scalable since
131 the model only grows with the number of ingredients per pizza added because all
132 the pizzas are independent. Because of this, large datasets can be added very
133 easily and because of this the computational complexity does not increase very
134 much. Changes in parameters can also be added very easily, for example when a
135 more accurate low level detection technique is applied the probabilities for
136 the shapes present can be increased very easily.
137
138 \section{Additional Questions}
139 If we could change a thing about the second assignment, we would try to make it slightly less abstract what the meaning of the assignment was. We estimate that we spent about 14 hours each on the assignment.