def __init__(self, model):
if not isinstance(model, BayesianModel):
raise TypeError("model must an instance of BayesianModel")
super(BayesianModelSampling, self).__init__(model)
self.topological_order = nx.topological_sort(model)
self.cpds = {node: model.get_cpds(node) for node in model.nodes()}
After Change
def __init__(self, model):
if not isinstance(model, BayesianModel):
raise TypeError("Model expected type: BayesianModel, got type: ", type(model))
self.topological_order = nx.topological_sort(model)
super(BayesianModelSampling, self).__init__(model)
// self.cpds = {node: model.get_cpds(node) for node in model.nodes()}