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