Automatically train a merged Bayesian Network from multiple data sources
Using pip: open autopgm folder, and run
$ pip3 install .
In python3, run
from autopgm.estimator import MultipleBayesianEstimator
model = MultipleBayesianEstimator([csv_file_name_1, csv_file_name_2, ...]).get_model()Note: all files need to be .csv files with discrete variables of integer values.
model is a BayesianModel as in pgmpy.
You can perform VariableElimination and then query as in pgmpy:
from pgmpy.inference import VariableElimination
inference = VariableElimination(model)
q = inference.query(['var1'], evidence={'var2': 0, 'var3': 1})['var1']