top of page

Machine Learning

Public·3 members

Using the MaximumLikelihoodEstimator (MLE), estimate the values of the conditional probability distributions (CPDs),

This Class used to compute parameters for a model using Maximum Likelihood Estimation.

import pandas as pd
from pgmpy.models import BayesianModel
from pgmpy.estimators import MaximumLikelihoodEstimator

#create dataframe
data = pd.DataFrame(data={'A': [0, 0, 1], 'B': [0, 1, 0], 'C': [1, 1, 0]})

# creating model
model = BayesianModel([('A', 'C'), ('B', 'C')])

cpd_A = MaximumLikelihoodEstimator(model, data).estimate_cpd('A')
print(cpd_A)

cpd_C = MaximumLikelihoodEstimator(model, data).estimate_cpd('C')
print(cpd_C)

MaximumLikelihoodEstimator (MLE),
MaximumLikelihoodEstimator (MLE),

#BayesianModel #MLE

50 Views
bottom of page