cpds = self.cpd_expr.searchString(block)
if "table" in block:
arr = [float(j) for i in cpds for j in i]
arr = numpy.array(arr)
arr = arr.reshape((len(self.variable_states[var_name]),
arr.size // len(self.variable_states[var_name])))
else:
arr_length = numpy.prod([len(self.variable_states[var]) for var in parents])
After Change
else:
arr_length = np.prod([len(self.variable_states[var]) for var in parents])
arr = np.zeros((len(self.variable_states[var_name]), arr_length))
values_dict = {}
for prob_line in cpds:
states = prob_line[:len(parents)]
vals = [float(i) for i in prob_line[len(parents):]]
values_dict[tuple(states)] = vals