\chapter{Visual representations and reasoning}
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.
\begin{itemize}
	\item Margherita; basilicum
	\item Hawaii; ham, pineapple and basilicum
	\item Salami; salami and basilicum
	\item Funghi; mushrooms and ham
	\item Pepperoni; salami and jalape\~nos
\end{itemize}

We are able to observe different kind of shapes; circles, double circles (like tires or olives in our case), squares and blobs. 

Our style of reasoning that we employed is deductive. 
\iffalse
TODO
In a more structured way, you are required to describe clearly and fully:
• The domain and the individual images
• The representation of observations, assumables and the causal theory between them in AILog
• The style of reasoning employed (abductive, deductive) and what considerations have played
a role
• The queries used to infer information about individual images
• The results of the queries and reflections on their effectiveness and intuitions behind them
• General reflections on your model, how appropriate it is for this domain, how effective it is
and how would need to proceed if one would like to extend it to large datasets or realistic,
real-time operation.


\fi
\section{Domain representation}
Translating the domain specification to AILog results in the following AILog
code:
\inputminted[linenos,fontsize=\footnotesize]{prolog}{./src/pizza.ail}

\section{Queries}
\subsection{Initial probabilities}
Chances for shapes to be present are visible in Table~\ref{chances} and from
that we can calculate all the initial probabilites for all the shapes for
example with the following queries:
\begin{minted}[fontsize=\footnotesize]{prolog}
ailog: predict circle.
Answer: P(circle|Obs)=0.01.
	[ok,more,explanations,worlds,help]: ok.
ailog: observe circle.
Answer: P(circle|Obs)=0.01.
	[ok,more,explanations,worlds,help]: ok.
ailog: predict circlePresent.
Answer: P(circlePresent|Obs)=0.95.
	[ok,more,explanations,worlds,help]: ok.
\end{minted}
\begin{table}
	\label{chances}
	\begin{tabular}{|l|ll|}
		\hline
		& Observed\\
		Present & T & F\\
		\hline
		T & $0.95$ & $0.01$\\
		F & $0.05$ & $0.99$\\
		\hline
	\end{tabular}
\end{table}

\subsection{Querying probabilites for pizzas}
Since the chance of a false positive on a shape is so low the initial
probabilities for pizza types are very low. When certain shapes that belong to
a certain type of pizza occur the probability improves a lot. We can show this
by showing the probabilites of a pepperoni pizza before, during and after
observing the ingredients with the following queries:
\begin{minted}[fontsize=\footnotesize]{prolog}
ailog: predict p_pepperoni.
Answer: P(p_pepperoni|Obs)=0.0019.
	[ok,more,explanations,worlds,help]: ok.
ailog: observe circle.
Answer: P(circle|Obs)=1.0.
	[ok,more,explanations,worlds,help]: ok.
ailog: predict p_pepperoni.
Answer: P(p_pepperoni|Obs)=0.0019.
	[ok,more,explanations,worlds,help]: ok.
ailog: observe doublecircle.
Answer: P(doublecircle|Obs)=0.01.
	[ok,more,explanations,worlds,help]: ok.
ailog: predict p_pepperoni.
Answer: P(p_pepperoni|Obs)=0.19.
	[ok,more,explanations,worlds,help]: ok.
\end{minted}

\subsection{Finding out which pizza is the most likely to be present on the
image}
We do not only want to know what the probability for a specific pizza is but
also the most likely pizza so that we can give an educated guess about the
pizza type present on the image processed. This can be done with the following
queries:


\section{Reflections}
