\documentclass[pdf,bndg,slideColor,colorBG]{prosper}

\input{preamble}

\title{Bayesian Networks and Decision Graphs}
\subtitle{}
\author{}
\email{}
\institution{Chapter 11}
\slideCaption{Chapter 11}


\begin{document}
\maketitle

%####################################################################################
%# Value of information I
%####################################################################################

\begin{slide}{Value of information I}

\psset{unit=0.4cm}
\newpsobject{showgrid}{psgrid}{subgriddiv=1,griddots=10,gridlabels=6pt}

\begin{center}
\begin{pspicture}(0,-2)(18,8)

\Fbox[0.7cm]{2}{6}{p}{Pour?}
\Fnode{7}{6}{i}{Inf?}
\Fnode{12}{6}{te}{Test}
\Fdiam[0.7cm]{4.5}{2}{u}{$U(P.,I.)$}
\Ftria{12}{2}{t}{T}
\Fdiam[0.5cm]{16}{2}{c}{$C(T)$}

\arc{p}{u}
\arc{i}{u}
\arc{i}{te}
\arc{te}{t}
\arc{t}{c}

\rput[c](4.5,-0.5){$(0,98,100)$}
\rput[c](16,0){$=-0.06$}

%\showgrid
\end{pspicture}
\end{center}

There are $50$ cows, and the milk is poured into a common container.
\ \\
\ \\
\ \\

\centerline{
\Red{Does it pay to perform the test??}
}

\end{slide}


%####################################################################################
%# Value of information II
%####################################################################################

\PDForPS{
\overlays{2}{
\begin{slide}{Value of information II}

\onlySlide*{1}{
\vspace*{-0.5cm}
\psset{treesep=0.25cm}
\psset{levelsep=2cm}
\begin{center}
\mbox{
\pstree[treemode=R,arrows=->,linecolor=green]{\Ftri{T}}
{
	\pstree{\Foval[0.5cm]{Test}^{y}}
	{
		\pstree{\Frect[0.6cm]{Pour?}^{pos}}
		{
		  
		  \pstree{\Foval[0.5cm]{Inf?}^{pour}}
		  {
		    \Fdia[0.4cm]{$99.94$}^{n}
		    \Fdia[0.4cm]{$-0.06$}_{y}
		  }
		  \Fdia[0.4cm]{$97.94$}_{throw}
		  
		}
		\pstree{\Frect[0.6cm]{Pour?}_{neg}}
		       {
			 \pstree{\Foval[0.5cm]{Inf?}^{pour}}
				{
				  \Fdia[0.4cm]{$99.94$}^{n}
				  \Fdia[0.4cm]{$-0.06$}_{y}
				}
				\Fdia[0.4cm]{$97.94$}_{throw}
		       }
	}
	\pstree{\Frect[0.6cm]{Pour?}_{n}}
	{
	  \pstree{\Foval[0.5cm]{Inf?}^{pour}}
	  {
	    \Fdia[0.4cm]{$0$}^{y}
	    \Fdia[0.4cm]{$100$}_{n}
	  }
	  \Fdia[0.4cm]{$98$}_{throw}
	}

}
}
\end{center}

}
\onlySlide*{2}{
\vspace*{-0.5cm}
\psset{treesep=0.25cm}
\psset{levelsep=2cm}
\begin{center}
\mbox{
\pstree[treemode=R,arrows=->,linecolor=green]{\Ftri{T}}
{
  \psset{linecolor=black}
	\pstree{\Foval[0.5cm]{Test}^{y}}
	{
  \psset{linecolor=green}
		\pstree{\Frect[0.6cm]{Pour?}^{pos}}
		{
		  
		  \pstree{\Foval[0.5cm]{Inf?}^{pour}}
		  {
		    \psset{linecolor=green}
		    \Fdia[0.4cm]{$99.94$}^{n}
		    \Fdia[0.4cm]{$-0.06$}_{y}
		  }
		  \psset{linecolor=black}%  \psset{linecolor=green}
		  \Fdia[0.4cm]{$97.94$}_{throw}
		  
		}
		\pstree{\Frect[0.6cm]{Pour?}_{neg}}
		       {
			 \psset{linecolor=black}
			 \pstree{\Foval[0.5cm]{Inf?}^{pour}}
				{
				  \psset{linecolor=green}
				  \Fdia[0.4cm]{$99.94$}^{n}
				  \Fdia[0.4cm]{$-0.06$}_{y}
				}
				\psset{linecolor=green}
				\Fdia[0.4cm]{$97.94$}_{throw}
		       }
	}
	\psset{linecolor=blue}
	\pstree{\Frect[0.6cm]{Pour?}_{n}}
	{
	  \pstree{\Foval[0.5cm]{Inf?}^{pour}}
	  {
	    \psset{linecolor=green}
	    \Fdia[0.4cm]{$0$}^{y}
	    \Fdia[0.4cm]{$100$}_{n}
	  }
	\psset{linecolor=green}
	  \Fdia[0.4cm]{$98$}_{throw}
	}

}
}
\end{center}

}
\onlySlide*{2}{
\vspace*{-0.2cm}
\ul{For the two strategies:}
\vspace*{-0.4cm}
\[
\hspace*{-0.3cm}
\begin{split}
EU(\mbox{\Blue{blue}}) & = 0\cdot P(\VarM{Inf?}=\mbox{y}) + 100\cdot
P(\VarM{Inf?}=\mbox{n}) = 99.93\\
EU(\mbox{black}) & = 97.94\cdot P(\VarM{Test}=\mbox{pos}) + 99.94\cdot
P(\VarM{Inf?}=\mbox{n},\mbox{neg}) - 0.06\cdot
P(\VarM{Inf?}=\mbox{y},\mbox{neg})   = 99.92 
\end{split}
\]
}
\end{slide}
}
}
{
\begin{slide}{Value of information II}

\vspace*{-0.5cm}
\psset{treesep=0.25cm}
\psset{levelsep=2cm}
\begin{center}
\mbox{
\pstree[treemode=R,arrows=->,linecolor=green]{\Ftri{T}}
{
	\pstree{\Foval[0.5cm]{Test}^{y}}
	{
		\pstree{\Frect[0.6cm]{Pour?}^{pos}}
		{
		  
		  \pstree{\Foval[0.5cm]{Inf?}^{pour}}
		  {
		    \Fdia[0.4cm]{$99.94$}^{n}
		    \Fdia[0.4cm]{$-0.06$}_{y}
		  }
		  \Fdia[0.4cm]{$97.94$}_{throw}
		  
		}
		\pstree{\Frect[0.6cm]{Pour?}_{neg}}
		       {
			 \pstree{\Foval[0.5cm]{Inf?}^{pour}}
				{
				  \Fdia[0.4cm]{$99.94$}^{n}
				  \Fdia[0.4cm]{$-0.06$}_{y}
				}
				\Fdia[0.4cm]{$97.94$}_{throw}
		       }
	}
	\pstree{\Frect[0.6cm]{Pour?}_{n}}
	{
	  \pstree{\Foval[0.5cm]{Inf?}^{pour}}
	  {
	    \Fdia[0.4cm]{$0$}^{y}
	    \Fdia[0.4cm]{$100$}_{n}
	  }
	  \Fdia[0.4cm]{$98$}_{throw}
	}

}
}
\end{center}
\end{slide}

\begin{slide}{Value of information III}
\vspace*{-0.5cm}
\psset{treesep=0.25cm}
\psset{levelsep=2cm}
\begin{center}
\mbox{
\pstree[treemode=R,arrows=->,linecolor=green]{\Ftri{T}}
{
  \psset{linecolor=black}
	\pstree{\Foval[0.5cm]{Test}^{y}}
	{
  \psset{linecolor=green}
		\pstree{\Frect[0.6cm]{Pour?}^{pos}}
		{
		  
		  \pstree{\Foval[0.5cm]{Inf?}^{pour}}
		  {
		    \psset{linecolor=green}
		    \Fdia[0.4cm]{$99.94$}^{n}
		    \Fdia[0.4cm]{$-0.06$}_{y}
		  }
		  \psset{linecolor=black}%  \psset{linecolor=green}
		  \Fdia[0.4cm]{$97.94$}_{throw}
		  
		}
		\pstree{\Frect[0.6cm]{Pour?}_{neg}}
		       {
			 \psset{linecolor=black}
			 \pstree{\Foval[0.5cm]{Inf?}^{pour}}
				{
				  \psset{linecolor=green}
				  \Fdia[0.4cm]{$99.94$}^{n}
				  \Fdia[0.4cm]{$-0.06$}_{y}
				}
				\psset{linecolor=green}
				\Fdia[0.4cm]{$97.94$}_{throw}
		       }
	}
	\psset{linecolor=blue}
	\pstree{\Frect[0.6cm]{Pour?}_{n}}
	{
	  \pstree{\Foval[0.5cm]{Inf?}^{pour}}
	  {
	    \psset{linecolor=green}
	    \Fdia[0.4cm]{$0$}^{y}
	    \Fdia[0.4cm]{$100$}_{n}
	  }
	\psset{linecolor=green}
	  \Fdia[0.4cm]{$98$}_{throw}
	}
}
}
\end{center}
\vspace*{-0.2cm}
\ul{For the two strategies:}
\vspace*{-0.4cm}
\[
\hspace*{-0.3cm}
\begin{split}
EU(\mbox{\Blue{blue}}) & = 0\cdot P(\VarM{Inf?}=\mbox{y}) + 100\cdot
P(\VarM{Inf?}=\mbox{n}) = 99.93\\
EU(\mbox{black}) & = 97.94\cdot P(\VarM{Test}=\mbox{pos}) + 99.94\cdot
P(\VarM{Inf?}=\mbox{n},\mbox{neg}) - 0.06\cdot
P(\VarM{Inf?}=\mbox{y},\mbox{neg})   = 99.92 
\end{split}
\]

\end{slide}

}


%####################################################################################
%# Value of a distribution
%####################################################################################

\PDForPS{
\overlays{2}{
\begin{slide}{Value of a distribution}

\fromSlide*{1}{
\psset{unit=0.4cm}
\newpsobject{showgrid}{psgrid}{subgriddiv=1,griddots=10,gridlabels=6pt}

\begin{center}
\begin{pspicture}(0,0)(25,8)

\Fbox[0.7cm]{2}{6}{p}{Pour?}
\Fnode{7}{6}{i}{Inf?}
\Fnode{12}{6}{te}{Test}
\Fdiam[0.7cm]{4.5}{2}{u}{$U(P.,I.)$}


\arc{p}{u}
\arc{i}{u}
\arc{i}{te}

\rput[l](11,3){Maximal expected utility:}
\rput[l](12,2){ $\max _{\Red{\mbox{Pour?}}}\sum_{\VarM{Inf?}}\Purple{U}(\Red{\mbox{Pour?}},\VarM{Inf?})P(\VarM{Inf?})$}


%\showgrid
\end{pspicture}
\end{center}
\ \\
\ \\

We say that the \ul{value} of $P(\VarM{Inf?})$ is
$V(P(\VarM{Inf?}))=\max
_{\Red{\mbox{Pour?}}}\sum_{\VarM{Inf?}}\Purple{U}(\Red{\mbox{Pour?}},\VarM{Inf?})P(\VarM{Inf?})$. \newline\newline
Moreover, the value after a positive test result is  $V(P(\VarM{Inf?}|\StM{pos}))$.

}
\fromSlide*{2}{
\ \\
\ \\

The expected value after \Red{Test}:
\hspace*{1cm}$EV(\Red{\mbox{Test}})=V(P(\VarM{Inf?}|\StM{pos}))P(\StM{pos}) + V(P(\VarM{Inf?}|\StM{neg}))P(\StM{neg})$.

\ul{\Green{Notation:}}
\begin{itemize}
\item  Expected benefit: $EB(
\Red{\mbox{Test}})=EV(\Red{\mbox{Test}}) - V(P(\VarM{Inf?}))$
\item Expected profit: $EP(\Red{\mbox{Test}})= EB(
\Red{\mbox{Test}}) - C_{\mbox{Test}}$.
\end{itemize}

}



\end{slide}
}
}
{
\begin{slide}{Value of a distribution}

\psset{unit=0.4cm}
\newpsobject{showgrid}{psgrid}{subgriddiv=1,griddots=10,gridlabels=6pt}

\begin{center}
\begin{pspicture}(0,0)(25,8)

\Fbox[0.7cm]{2}{6}{p}{Pour?}
\Fnode{7}{6}{i}{Inf?}
\Fnode{12}{6}{te}{Test}
\Fdiam[0.7cm]{4.5}{2}{u}{$U(P.,I.)$}


\arc{p}{u}
\arc{i}{u}
\arc{i}{te}

\rput[l](11,3){Maximal expected utility:}
\rput[l](12,2){ $\max _{\Red{\mbox{Pour?}}}\sum_{\VarM{Inf?}}\Purple{U}(\Red{\mbox{Pour?}},\VarM{Inf?})P(\VarM{Inf?})$}


%\showgrid
\end{pspicture}
\end{center}
\ \\
\ \\

We say that the \ul{value} of $P(\VarM{Inf?})$ is
$V(P(\VarM{Inf?}))=\max
_{\Red{\mbox{Pour?}}}\sum_{\VarM{Inf?}}\Purple{U}(\Red{\mbox{Pour?}},\VarM{Inf?})P(\VarM{Inf?})$. \newline\newline
Moreover, the value after a positive test result is  $V(P(\VarM{Inf?}|\StM{pos}))$.
\ \\
\ \\

The expected value after \Red{Test}:
\hspace*{1cm}$EV(\Red{\mbox{Test}})=V(P(\VarM{Inf?}|\StM{pos}))P(\StM{pos}) + V(P(\VarM{Inf?}|\StM{neg}))P(\StM{neg})$.

\ul{\Green{Notation:}}
\begin{itemize}
\item  Expected benefit: $EB(
\Red{\mbox{Test}})=EV(\Red{\mbox{Test}}) - V(P(\VarM{Inf?}))$
\item Expected profit: $EP(\Red{\mbox{Test}})= EB(
\Red{\mbox{Test}}) - C_{\mbox{Test}}$.
\end{itemize}
\end{slide}

}


%####################################################################################
%# Hypothesis driven, myopic
%####################################################################################

\PDForPS{
\overlays{2}{
\begin{slide}{Hypothesis driven, myopic}

\fromSlide*{1}{
\psset{unit=0.4cm}
\newpsobject{showgrid}{psgrid}{subgriddiv=1,griddots=10,gridlabels=6pt}

\begin{center}
\begin{pspicture}(0,0)(25,8)

\Fbox{21}{6}{d}{$D$}
\Fnode{15}{6}{h}{$H$}
\Fdiam{18}{4}{u}{$U$}

\Fnode{2}{5}{a}{$A$}
\Ftria{2}{1}{ta}{$T_A$}

\Fnode{6}{5}{b}{$B$}
\Ftria{6}{1}{tb}{$T_B$}

\Fnode{10}{5}{c}{$C$}
\Ftria{10}{1}{tc}{$T_C$}

\arc{d}{u}
\arc{h}{u}

\arc{a}{ta}
\arc{b}{tb}
\arc{c}{tc}

\rput(1,7){\rnode{x1}{}}
\arc{x1}{a}
\rput(3,7){\rnode{x2}{}}
\arc{a}{x2}

\ncline[linecolor=blue,linestyle=dotted]{x1}{x2}

\rput(5,7){\rnode{x3}{}}
\arc{x3}{b}
\rput(7,7){\rnode{x4}{}}
\arc{b}{x4}

\ncline[linecolor=blue,linestyle=dotted]{x3}{x4}

\rput(9,7){\rnode{x5}{}}
\arc{x5}{c}
\rput(11,7){\rnode{x6}{}}
\arc{c}{x6}

\ncline[linecolor=blue,linestyle=dotted]{x5}{x6}

\rput(14,8){\rnode{x7}{}}
\rput(16,8){\rnode{x8}{}}

\ncline[linecolor=blue,linestyle=dotted]{x7}{x8}

\rput(14,4){\rnode{x9}{}}
\rput(16,4){\rnode{x10}{}}

\ncline[linecolor=blue,linestyle=dotted]{x9}{x10}

\arc{x7}{h}
\arc{x8}{h}
\arc{h}{x9}
\arc{h}{x10}

\rput[l](13,2){If \Var{$T$} yields result $t$, then:}
\rput[l](14,1){$V(P(\Var{H}|\St{t}))=\max_{\Red{D}} \sum _{\Var{H}}\Purple{U}(\Red{D},\Var{H})P(\Var{H}|t)$}



%\showgrid
\end{pspicture}
\end{center}
\ \\
\ \\

Expected value after $\Var{T}$: $\sum _{\Var{T}}V(P(\Var{H}|\Var{T}))P(\Var{T})$\newline\newline
\centerline{
So we request: $P(\Var{T})$ and $P(\Var{H}|\Var{T})$ for all $\Var{T}$!
}


}
\fromSlide*{2}{
\ \\
\ \\

From Bayes' rule: 
\[
P(\Var{H}|\Var{T})=\frac{P(\Var{T}|\Var{H})P(\Var{H})}{P(\Var{T})}
\] 


\centerline{
\Red{
One propagation for each state of $H$ suffices!!
}}

}
\end{slide}
}
}
{
\begin{slide}{Hypothesis driven, myopic}


\psset{unit=0.4cm}
\newpsobject{showgrid}{psgrid}{subgriddiv=1,griddots=10,gridlabels=6pt}

\begin{center}
\begin{pspicture}(0,0)(25,8)

\Fbox{21}{6}{d}{$D$}
\Fnode{15}{6}{h}{$H$}
\Fdiam{18}{4}{u}{$U$}

\Fnode{2}{5}{a}{$A$}
\Ftria{2}{1}{ta}{$T_A$}

\Fnode{6}{5}{b}{$B$}
\Ftria{6}{1}{tb}{$T_B$}

\Fnode{10}{5}{c}{$C$}
\Ftria{10}{1}{tc}{$T_C$}

\arc{d}{u}
\arc{h}{u}

\arc{a}{ta}
\arc{b}{tb}
\arc{c}{tc}

\rput(1,7){\rnode{x1}{}}
\arc{x1}{a}
\rput(3,7){\rnode{x2}{}}
\arc{a}{x2}

\ncline[linecolor=blue,linestyle=dotted]{x1}{x2}

\rput(5,7){\rnode{x3}{}}
\arc{x3}{b}
\rput(7,7){\rnode{x4}{}}
\arc{b}{x4}

\ncline[linecolor=blue,linestyle=dotted]{x3}{x4}

\rput(9,7){\rnode{x5}{}}
\arc{x5}{c}
\rput(11,7){\rnode{x6}{}}
\arc{c}{x6}

\ncline[linecolor=blue,linestyle=dotted]{x5}{x6}

\rput(14,8){\rnode{x7}{}}
\rput(16,8){\rnode{x8}{}}

\ncline[linecolor=blue,linestyle=dotted]{x7}{x8}

\rput(14,4){\rnode{x9}{}}
\rput(16,4){\rnode{x10}{}}

\ncline[linecolor=blue,linestyle=dotted]{x9}{x10}

\arc{x7}{h}
\arc{x8}{h}
\arc{h}{x9}
\arc{h}{x10}

\rput[l](13,2){If $T$ yields result $t$, then:}
\rput[l](14,1){$V(P(H|t))=\max_D \sum _HU(D,H)P(H|t)$}



%\showgrid
\end{pspicture}
\end{center}
\ \\
\ \\

Expected value after $T$: $\sum _TV(P(H|T))P(T)$\newline\newline
\centerline{
So we request: $P(T)$ and $P(H|T)$ for all $T$!
}


\ \\
\ \\

From Bayes' rule: 
\[
P(H|T)=\frac{P(T|H)P(H)}{P(T)}
\] 


\centerline{
\Red{
One propagation for each state of $H$ suffices!!
}}
\end{slide}


}


%####################################################################################
%# Non-myopic data request I
%####################################################################################

\begin{slide}{Non-myopic data request I}

\psset{unit=0.4cm}
\newpsobject{showgrid}{psgrid}{subgriddiv=1,griddots=10,gridlabels=6pt}

\begin{center}
\begin{pspicture}(0,-5)(21,8)

\Fbox{2}{5}{p}{Pour}
\Fdiam{5}{7}{u}{$U$}
\Fnode{8}{5}{i}{Inf}

\Fnode{5}{2}{te1}{$\mbox{Test}_1$}
\Fnode{11}{2}{te2}{$\mbox{Test}_2$}

\Ftria{5}{-2}{t1}{$T_1$}
\Ftria{11}{-2}{t2}{$T_2$}

\Fdiam{1}{-2}{c1}{$C_1$}
\Fdiam{15}{-2}{c2}{$C_2$}

\arc{p}{u}
\arc{i}{u}
\arc{i}{te1}
\arc{i}{te2}
\arc{te1}{t1}
\arc{te2}{t2}
\arc{t1}{c1}
\arc{t2}{c2}

\rput[l](15,5){\Var{$T_1$} does not pay}
\rput[l](15,3){\Var{$T_2$} does not pay}

\rput[r](3.75,2){$10^{-2}$}
\rput[l](12.25,2){$10^{-3}$}

\rput[c](1,-3.5){$-0.06$}
\rput[c](15,-3.5){$-0.20$}

%\showgrid
\end{pspicture}
\end{center}

It does not pay to perform test $\Var{T_2}$ alone, however, what if we use \Var{$T_2$}
to double check a positive result from test $\Var{T_1}$?

\end{slide}


%####################################################################################
%# Non-myopic data request II
%####################################################################################

%####################################################################################
%# Value functions without utilities
%####################################################################################

\begin{slide}{Value functions without utilities}

If there is no proper model for actions and utilities, we may look at:
\begin{itemize}
\item Entropy
\item Variance
\item Other
\end{itemize}
\ \\
\ \\
\ \\

\ul{\Green{We require that:}}
\begin{itemize}
\item[\ensuremath{\triangle}] The expected change in value may not decrease.
\end{itemize}

\end{slide}


%####################################################################################
%# Variance
%####################################################################################

\begin{slide}{Variance}

If the states of $H$ are numeric, then:
\[
\mu = \sum _{h\in H}h\cdot P(h)\hspace*{1cm}Var(P(H))=\sum _{h\in H}(h-\mu)^2P(h)
\]

\pstexfig{variance}
\vspace*{-0.5cm}
\[
\mu=2; Var=4\hspace*{2cm}\mu=2; Var=2\hspace*{2cm}\mu=2; Var=0
\]
\ \\
\ \\
\ \\

\ul{\Green{Now let the value function be:}}
\[
V(P(H))=-Var(P(H))
\]

\end{slide}


%####################################################################################
%# Entropy
%####################################################################################

\begin{slide}{Entropy}

The entropy is defined as:
\[
Ent(P(H))=-\sum _{H}P(H)\log_2(P(H))\hspace*{1cm}(0\cdot \log_2(0))
\]

\Red{
Entropy is a measure of how much the probability mass is scattered
around on the states.}

\pstexfig{entropy}
\vspace*{-0.7cm}
\[
\begin{split}
Ent(P(H))&=-\sum \frac{1}{n}\log_2\frac{1}{n}\hspace*{2.3cm}Ent(P(H))=0\\
&=\log_2n=2.3
\end{split}
\]
\vspace*{-0.5cm}

\ul{\Green{We let the value function be:}}

\vspace*{-0.3cm}

\[
V(P(H))=-Ent(P(H))=\sum _{H}P(H)\log_2(P(H))
\]
\end{slide}



%####################################################################################
%# Other value functions
%####################################################################################

\begin{slide}{Other value functions}

\pstexfig{other}
\vspace*{-0.5cm}
\[
f(tx+(1-t)y)\leq tf(x)+(1-t)f(y)
\]

\ul{\Green{Theorem:}} If the value function is convex, then the
expected benefit of a test is never negative.
\ \\
\ \\


\ul{\Green{Note that:}} Value functions based on entropy, variance and
max-utility are convex.
\ \\
\ \\

%\ul{\Green{Other possibilities:}} $|A+Bx|$ and $B|A-x|^n$ and $A\left |\log
%\left (\frac{x}{1-x}\right ) \right |^n$.

\end{slide}



%####################################################################################
%# Entropy
%####################################################################################

\begin{slide}{Entropy}

The entropy function of a binary variable:
\epsfigure{40}{entropy}
\[
Ent(P(H)) = -P(yes)\log_2(P(yes))-P(no)\log_2(P(no))
\]
\centerline{
\Red{
From this we see that the value function based on entropy is convex!
}}

\end{slide}










%% \end{slide}

\end{document}





