beanmachine.ppl.compiler.fix_normal_conjugate_prior module

beanmachine.ppl.compiler.fix_normal_conjugate_prior.normal_normal_conjugate_fixer(bmg: beanmachine.ppl.compiler.bm_graph_builder.BMGraphBuilder) Callable[[beanmachine.ppl.compiler.bmg_nodes.BMGNode], Union[beanmachine.ppl.compiler.bmg_nodes.BMGNode, None, beanmachine.ppl.compiler.fix_problem.NodeFixerError]]

This fixer transforms graphs with Normal likelihood with fixed sigma and Normal prior for mu. Since this is a conjugate pair, we analytically update the prior parameters Normal(mu, sigma) using observations to get the posterior parameters Normal(mu’, sigma’). Once we update the parameters, we delete the observed samples from the graph. This greatly decreases the number of nodes, the number of edges in the graph, and the Bayesian update is reduced to parameter update which can lead to performance wins during inference.