\documentclass{article}
\usepackage{tikz,amsmath}
%\usepackage{siunitx}
\usetikzlibrary{arrows,snakes,backgrounds,patterns,matrix,shapes,fit,calc,shadows,plotmarks}
\usepackage[graphics,tightpage,active]{preview}
\PreviewEnvironment{tikzpicture}
\PreviewEnvironment{equation}
\PreviewEnvironment{equation*}
\newlength{\imagewidth}
\newlength{\imagescale}
\pagestyle{empty}
\thispagestyle{empty}
\usepackage{standalone}
\begin{document}
\begin{tikzpicture}
\tikzstyle{main}=[circle, minimum size = 10mm, thick, draw =black!80, node distance = 16mm]
\tikzstyle{hyparam}=[rectangle, minimum size = 5mm, thick, draw =black!80, fill = black!10, node distance = 16mm]
\tikzstyle{param}=[rectangle, minimum size = 5mm, thick, draw =black!80, node distance = 16mm]
\tikzstyle{connect}=[-latex, thick]
\tikzstyle{selector}=[-latex, -|, snake=snake,segment amplitude=.4mm,segment length=2mm,line after snake=1mm, thick]
\tikzstyle{shortconnect}=[-latex, thin]
\tikzstyle{box}=[rectangle, draw=black!100]
\tikzstyle{switch}=[circle, minimum size = 1mm, fill = black!100, draw=black!100]
\node[hyparam] (beta) [label=below:$\beta$] { };
\node[main] (phi) [right of=beta,label=below:$\boldsymbol\phi$] {[K]};
\node[main] (z) [right of=phi,label=below:$z_i$] {K};
\node[main, fill = black!10] (x) [right of= z,label=below:$x_i$] {V};
\node[main] (theta) [above of=z,yshift=10mm, label=below:$\boldsymbol\theta$] {[V]};
\node[hyparam] (alpha) [above of=theta, label=$\alpha$] { };
\path (beta) edge [connect] (phi)
(phi) edge [connect] (z)
(z) edge [selector] (x)
(theta) edge [connect] (x)
(alpha) edge [connect] (theta);
\node[rectangle, inner sep=0mm, fit= (z) (x),label=below right:N, xshift=9mm] {};
\node[rectangle, inner sep=4.4mm,draw=black!100, fit= (z) (x), xshift=1mm] {};
\node[rectangle, inner sep=2mm, fit= (theta),label=below right:K, yshift=-2mm, xshift=3mm] {};
\node[rectangle, inner sep=6.4mm,draw=black!100, fit= (theta), yshift=-2mm, xshift=3mm] {};
\end{tikzpicture}
\end{document}