I'm trying to get the example in Insurance data representation with Bayesian networks to work. See the section Maximum Likelihood Estimation. The data I got from the bnlearn package in R and then uploaded it my google drive. The data
The picture below shows ... I believe this is showing missing columns. How do I fix the code to display the correct information?
from pgmpy.models import BayesianModel
model = BayesianModel([('Antilock', 'Accident'), ('DrivingSkill', 'DrivQuality'), ('DrivQuality', 'Accident')])
# Maximum Likelihood Estimation
from pgmpy.estimators import MaximumLikelihoodEstimator
mle = MaximumLikelihoodEstimator(model, df)
# Pour toutes les variables :
model.fit(df, estimator=MaximumLikelihoodEstimator)
for cpd in model.get_cpds():
print(cpd)
Note1: code to get the data from R
data(insurance)
write.csv(insurance,"C:/Users/Administrator/OneDrive/University of London/AI/Assignment 1/insurance.csv")
Note2: if you are running this in colab you will need to install the package
!pip install pgmpy