Figure \[fig:COMPILER\]A shows a Bayesian network for diagnosing the behavior of an intensive care unit monitoring system. Bayesian inference within this network can be used to infer probable states of the ICU given ambiguous patterns of evidence — that is, reason from observed effects back to their probable causes. Figure \[fig:COMPILER\]B shows a factor graph representation of this model[@kschischangfactor]; this more general data structure is used as the input to our compiler. Figure \[fig:COMPILER\]C shows inference results from three representative queries, each corresponding to a different pattern of observed data.

We have also explored implementations of stochastic transition circuits in terms of spiking elements governed by Poisson firing statistics. Figure \[fig:COMPILER\]D shows a spiking network that implements the Markov chain from Figure \[fig:transition\]. The stochastic transition circuit corresopnding to a latent variable $X$ is implemented via a bank of Poisson-spiking elements $\{X_i\}$ with one unit $X_i$ per possible value of the variable. The rate for each spiking element $X_i$ is determined by the unnormalized conditional log probability of the variable setting it corresponds to, following the discrete-sample gate from Figure \[fig:MULTINOMIAL\] the time to first spike $\mathrm{t}(X_i) \sim Exp(e_i)$, with $e_i$ obtained by summing energy contributions from all connected variables. 