summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/latex/tikz-bayesnet/model_pca2.tex
blob: 188d030ad422556555e77ab133c9a314275d21e8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
% model_pca2.tex
%
% Copyright (C) 2010,2011 Laura Dietz
% Copyright (C) 2012 Jaakko Luttinen
%
% This file may be distributed and/or modified
%
% 1. under the LaTeX Project Public License and/or
% 2. under the GNU General Public License.
%
% See the files LICENSE_LPPL and LICENSE_GPL for more details.

% PCA model

%\beginpgfgraphicnamed{model-pca}
\begin{tikzpicture}

  % Define nodes

  % Y
  \node[obs]          (y)   {$y$}; %
  \factor[above=of y] {y-f} {left:$\mathcal{N}$} {} {} ; %

  % W and X
  \node[det, above=of y]            (dot) {dot} ; % 
  \node[latent, above left=1.2 of dot]  (w)   {$\mathbf{w}$}; %
  \node[latent, above right=1.2 of dot] (x)   {$\mathbf{x}$}; %

  % W hyperparameters
  \node[const, above=1.2 of w, xshift=-0.5cm] (mw) {$\mu_w$} ; %
  \node[const, above=1.2 of w, xshift=0.5cm]  (aw) {$\alpha_w$} ; %

  % X hyperparameters
  \node[const, above=1.2 of x, xshift=-0.5cm] (mx) {$\mu_x$} ; %
  \node[const, above=1.2 of x, xshift=0.5cm]  (ax) {$\alpha_x$} ; %

  % noise
  \node[latent, right=2.5cm of y-f]         (t)   {$\tau$}; %
  \node[const, above=of t, xshift=-0.5cm] (at)  {$\alpha_\tau$} ; %
  \node[const, above=of t, xshift=0.5cm]  (bt)  {$\beta_\tau$} ; %

  % Factors
  \factor[above=of w] {w-f} {left:$\mathcal{N}$} {mw,aw} {w} ; %
  \factor[above=of x] {x-f} {left:$\mathcal{N}$} {mx,ax} {x} ; %
  \factor[above=of t] {t-f} {left:$\mathcal{G}$} {at,bt} {t} ; %
  \factoredge {dot,t} {y-f} {y} ; %

  % Connect w and x to the dot node
  \edge[-] {w,x} {dot} ;

  % Plates
  \plate {yx} { %
    (y)(y-f)(y-f-caption) %
    (x)(x-f)(x-f-caption) %
    (dot) %
  } {$N$} ;
  \plate {} {%
    (y)(y-f)(y-f-caption) %
    (w)(w-f)(w-f-caption) %
    (dot) %
    (yx.north west)(yx.south west) %
  } {$M$} ;

\end{tikzpicture}
%\endpgfgraphicnamed

%%% Local Variables: 
%%% mode: tex-pdf
%%% TeX-master: "example"
%%% End: