Skip to content

Instantly share code, notes, and snippets.

@abikoushi
Created February 28, 2023 23:48
Show Gist options
  • Save abikoushi/458edf438b23e6d42ac9df8a293b6fb2 to your computer and use it in GitHub Desktop.
Save abikoushi/458edf438b23e6d42ac9df8a293b6fb2 to your computer and use it in GitHub Desktop.
bayesnetのデモ
\documentclass[dvipdfmx, border={2pt 2pt 2pt 2pt}]{standalone}
\usepackage{tikz, bm}
\usetikzlibrary{bayesnet}
\begin{document}
\begin{tikzpicture}
% Nodes
\node[const](alpha){$\alpha$};
\node[latent, right = of alpha](pi){$\bm{\pi}$};
\node[const, below = of alpha](beta){$\bm{\beta}$} ;
\node[latent, right = of beta](p){$\bm{p}_l$};
\node[obs, right = of pi](z){$\bm{z}_n$};
\node[obs, right = of z](y){$\bm{y}_n$};
%%edge
\edge {alpha}{pi};
\edge{beta}{p};
\edge{pi}{z};
\edge{p}{y};
\edge{z}{y}
% Plates
\plate {pl1} {(z)(y)} {$n=1,\ldots, N$} ;
\plate {pl2} {(p)} {$l=1,\ldots, L$}
\end{tikzpicture}
\end{document}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment