\chapter{Route/Trajectory Prediction}
\label{ch:03_xxx}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Section}
\label{sec:0301_xxx}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{figure}[H]
  \centering
  \tikz{ %
		%Define nodes
		\node[obs]             					(x)      	{$\mv{x}_n^{(j)}$};
		\node[latent, above=of x]  			(s)      	{$s_n^{(j)}$};
		\node[latent, left=of s] 				(s0) 			{$s_0$};

		\node[latent, left=of s0]  			(pi)      {$\mv{\pi}_{\mv{i}}$};
		\node[latent, below=of pi]  		(theta)   {$\theta_{\mv{i}}$};
		
		\node[latent, left=of pi]  			(alpha)   {$\alpha$};
		\node[latent, left=of theta]  	(H)   		{$H$};
		\node[latent, left=of H] 				(lambda) 	{$\lambda$};
		\node[latent, above=of pi] 			(beta) 		{$\beta$};
		\node[latent, left=of beta] 		(gamma) 	{$\gamma$};
		
		\node[latent, above=of s] 			(z) 			{$z^{(j)}$};
		\node[latent, right=of z]				(rho) 		{$\rho$};
		\node[latent, right=of rho] 		(eta) 		{$\eta$};
		
		\node[const, left=of gamma,yshift=0.25cm] 		(gamma_a) 		{$\gamma_a$};
		\node[const, left=of gamma,yshift=-0.25cm] 		(gamma_b) 		{$\gamma_b$};
		\node[const, left=of alpha,yshift=0.25cm] 		(alpha_a) 		{$\alpha_a$};
		\node[const, left=of alpha,yshift=-0.25cm] 		(alpha_b) 		{$\alpha_b$};
		\edge {gamma_a} {gamma};
		\edge {gamma_b} {gamma};
		\edge {alpha_a} {alpha};
		\edge {alpha_b} {alpha};
		
		
		\factor[left=of eta]   		{eta_rho}    		{GEM()} {} {} ; %
		\factor[left=of rho] 			{rho_z}					{Cat()} 		{} 	{} ;
		\factor[right=of gamma]   {gamma_beta} 		{GEM()} {} {} ; %
		\factor[above=of x]   		{x_s} 					{right:$F(\theta_{s_n^{(j)}})$} {} {} ; %
		\factor[left=of H]   			{lambda_H} 			{NIW} {} {} ; %
		%\factor[above=of f,yshift=0.7cm]   			{rf}    		{Cat} {} {} ; 
		%\factor[above=of pi, yshift=0.4cm] 			{pi-f} 			{left:Dir} {} {} ; 
		%\factor[above=of t, yshift=0.5cm] 				{t-f} 			{left:Beta} {} {} ; %
		%\factor[right=of p, xshift=0.5cm] 				{p-f} 			{Dir} {} {} ; %
		%\factor[above=of d, yshift=0.4cm] 				{d-f} 			{right:Dir} {} {} ; %

		%Connect the nodes
		\edge {s0} {s} ;
		\edge {s} {x} ;
		\edge {z} {s} ;
		\edge {rho} {z} ;
		\edge {eta} {rho} ;
		\edge {lambda} {H} ;
		\edge {H} {theta} ;
		\edge {alpha} {pi} ;
		\edge {beta} {pi} ;
		\edge {gamma} {beta} ;
		
		%\edge {pi} {s} ;
		\path (pi) edge [bend left,->]  (s) ;
		%\path (theta) edge [bend left,->]  (x) ;
		\edge {theta} {x} ;
	
		%\factoredge {gamma}  {d-f}  {d} ;
		%\factoredge {alpha}  {p-f}  {p}; %
		%\factoredge {p}  {t-f}  {t}; %
		%\factoredge {beta}  {pi-f}   {pi} ;
		%\factoredge {pi}  {yf}   {y} ;
		%\factoredge {d}  {rf}   {f} ;

		%\gate {y-gate} {(yf)(yf-caption)} {t}
		%\gate {f-gate} {(rf)(rf-caption)} {t}

		%Plates

		\plate [inner sep=0.25cm,xshift=1.2mm,yshift=0.15cm] {sx} {(s)(x)} {$N_j$}; %
		{\tikzset{plate caption/.append style={above=-1.2cm of #1.south east }}
		\plate [inner sep=0.45cm,yshift=0.4cm] {sxz} {(s)(x)(z)} {$J$};}
		\plate [inner sep=0.35cm, color=black,   
			fill=black, 
      fill opacity=0.1, 
      text opacity=1] {pitheta} {(pi)(theta)} {$\infty$};
		\node[latent, left=of s0,fill=white]  			(pi)      {$\mv{\pi}_{\mv{i}}$};
		\node[latent, below=of pi,fill=white]  		(theta)   	{$\theta_{\mv{i}}$};
		
		%{\tikzset{plate caption/.append style={above=5pt of #1.north west}} ... }
		%{\tikzset{plate caption/.append style={above=5pt of #1.north east}} ... }
		%{\tikzset{plate caption/.append style={above=5pt of #1.south west}}
		%\plate [inner sep=0.2cm, xshift=-0.2cm, color=red] {pM} {(beta)(pi)(yf)(y)(rf)(f)} {M workers} ;}
		%\plate [inner sep=0.2cm, xshift=-0.05cm, yshift=0.15cm, color=brown] {pJi} {(y)(f)} {$J_i$} 
  }
\end{figure}

\begin{align} 
		\mv{i} = [l,k]
\end{align} 

$l$ represents the l'th HMM (e.g. for trajectory classification) and state $k$ respectively.

%==============================================================================
\subsection{Subsection}
\label{subsec:030101_xxx}
%==============================================================================
