fd6314842ffe8cd2d7ddf5dcaf044dc8736df0d0,pgmpy/inference/Sampling.py,BayesianModelSampling,likelihood_weighted_sample,#BayesianModelSampling#Any#Any#,148

Before Change


        evidence_dict = {var: st for var, st in evidence}
        for node in self.topological_order:
            cpd = self.model.get_cpds(node)
            states = [state for state in range(cpd.get_cardinality([node])[node])]
            if cpd.evidence:
                indices = [i for i, x in enumerate(self.topological_order) if x in cpd.evidence]
                evidence = sampled.values[:, [indices]].tolist()

After Change


        evidence_dict = {var: st for var, st in evidence}
        for node in self.topological_order:
            cpd = self.model.get_cpds(node)
            states = range(self.cardinality[node])
            if cpd.evidence:
                indices = [i for i, x in enumerate(self.topological_order) if x in cpd.evidence]
                evidence = sampled.iloc[:, indices].values
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 6

Instances


Project Name: pgmpy/pgmpy
Commit Name: fd6314842ffe8cd2d7ddf5dcaf044dc8736df0d0
Time: 2015-11-18
Author: ankurankan@gmail.com
File Name: pgmpy/inference/Sampling.py
Class Name: BayesianModelSampling
Method Name: likelihood_weighted_sample


Project Name: pgmpy/pgmpy
Commit Name: b0ccf6852aff2368c73a5e4f99d9624ea5d63a57
Time: 2020-04-30
Author: ankurankan@gmail.com
File Name: pgmpy/readwrite/BIF.py
Class Name: BIFWriter
Method Name: get_states


Project Name: pgmpy/pgmpy
Commit Name: fd6314842ffe8cd2d7ddf5dcaf044dc8736df0d0
Time: 2015-11-18
Author: ankurankan@gmail.com
File Name: pgmpy/inference/Sampling.py
Class Name: BayesianModelSampling
Method Name: forward_sample