Пример #1
0
    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)
Пример #2
0
    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)
Пример #3
0
    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)
Пример #4
0
    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)