I run this code and get this error
def predict(data, inf, target_variable):
results = defaultdict(list)
for _, data_point in data.iterrows():
if 'index' in data_point:
del data_point['index']
result = inf.query(
variables=[target_variable],
evidence=data_point.to_dict(),
show_progress=False,
)
values = result.state_names[target_variable]
for i, val in enumerate(values):
results[val].append(result.values[i])
return results
from pgmpy.inference import VariableElimination
nb_inference = VariableElimination(nb_model)
nb_results = predict(test_no_target,nb_inference,target_variable)
nb_mean_results = {}
for k, v in nb_results.items():
nb_mean_results[k] = np.nanmean(v)
TypeError: NaiveBayes.active_trail_nodes() got an unexpected keyword argument 'variables' I run this with pgmpy version 0.1.24