def init_inference_engine(self, exact=True, max_iter=10): """ Determine what type of inference inference_engine to create, and intialize it. Parameters ---------- exact: Bool Exact is TRUE if the type of inference must be exact, therefore, using the junction tree algorithm. And exact is FALSE if the type of inference must be approximate, therefore, using the loopy belief algorithm. max_iter: Int If the type of inference is approximate, then this value is maximum number of iterations the loopy belief algorithm can execute. """ if exact: if self.lattice: print 'WARNING: Exact inference on lattice graphs not recommended' self.inference_engine = inference.JTreeInferenceEngine(self) elif self.lattice: """ This version of the approximate inference inference_engine has been optimized for lattices. """ self.inference_engine = inference.belprop_mrf2_inf_engine( self, max_iter) else: self.inference_engine = inference.belprop_inf_engine( self, max_iter)
def init_inference_engine(self, exact=True, max_iter=10): """ Determine what type of inference inference_engine to create, and intialize it. Parameters ---------- exact: Bool Exact is TRUE if the type of inference must be exact, therefore, using the junction tree algorithm. And exact is FALSE if the type of inference must be approximate, therefore, using the loopy belief algorithm. max_iter: Int If the type of inference is approximate, then this value is maximum number of iterations the loopy belief algorithm can execute. """ if exact: if self.lattice: print 'WARNING: Exact inference on lattice graphs not recommended' self.inference_engine = inference.JTreeInferenceEngine(self) elif self.lattice: """ This version of the approximate inference inference_engine has been optimized for lattices. """ self.inference_engine = inference.belprop_mrf2_inf_engine(self, max_iter) else: self.inference_engine = inference.belprop_inf_engine(self, max_iter)
def init_inference_engine(self, exact=True, max_iter=10): """ Determine what type of inference inference_engine to create, and intialize it. Parameters ---------- exact: Bool Exact is TRUE if the type of inference must be exact, therefore, using the junction tree algorithm. And exact is FALSE if the type of inference must be approximate, therefore, using the loopy belief algorithm. max_iter: Int If the type of inference is approximate, then this value is maximum number of iterations the loopy belief algorithm can execute. """ if exact: self.inference_engine = inference.JTreeInferenceEngine(self) else: self.inference_engine = inference.belprop_inf_engine(self, \ max_iter=10)