ca25da7c55ba436ab557410d5f2e2e9b557d2840,pgmpy/models/MarkovModel.py,MarkovModel,to_junction_tree,#MarkovModel#,412

Before Change


        // Create clique trees by minimum (or maximum) spanning tree method
        clique_trees = JunctionTree(nx.minimum_spanning_tree(complete_graph).edges())

        factor = self.factors[0]
        factor = factor.product(*[self.factors[i] for i in
                                  range(1, len(self.factors))])
        if set(factor.scope()) != set(self.nodes()):
            ValueError("Factor for all the random variables not specified")

        all_vars = set(self.nodes())

        for node in clique_trees.nodes():
            marginalised_nodes = all_vars - set(node)
            factor_copy = factor.marginalize(list(marginalised_nodes),
                                             inplace=False)
            clique_trees.add_factors(factor_copy)

        return clique_trees

After Change



        for node in clique_trees.nodes():
            clique_factors = []
            for factor in self.factors:
                if not is_used[factor] and set(factor.scope()).issubset(node):
                    clique_factors.append(factor)
                    is_used[factor] = True

            clique_potential = factor_product(*clique_factors)
            clique_trees.add_factors(clique_potential)

        if not all(is_used.values()):
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 8

Instances


Project Name: pgmpy/pgmpy
Commit Name: ca25da7c55ba436ab557410d5f2e2e9b557d2840
Time: 2015-03-02
Author: abinash.panda.ece10@itbhu.ac.in
File Name: pgmpy/models/MarkovModel.py
Class Name: MarkovModel
Method Name: to_junction_tree


Project Name: brian-team/brian2
Commit Name: bf72974b7eb2229b6f4f4d7ae6b654693785d71f
Time: 2014-09-19
Author: marcel.stimberg@ens.fr
File Name: brian2/core/magic.py
Class Name: MagicNetwork
Method Name: _update_magic_objects


Project Name: sony/nnabla
Commit Name: 5c8f92c5d865bb8d8a90740506e4a7ef9f62398c
Time: 2019-04-24
Author: Yuchi.Wen@sony.com
File Name: python/src/nnabla/utils/converter/tensorflow/importer.py
Class Name:
Method Name: _find_out_terminal_node