For categorical probabilities, conjugacy means that combining a Dirichlet prior with a categorical likelihood leaves the posterior in the Dirichlet family. Parameter estimates can then be calculated by combining observed counts with prior parameters, without sampling or variational inference. section 3.1.9
Unlike maximum-likelihood proportions, a Dirichlet prior can smooth estimates: it tempers an observed 100% estimate for self-employed people in small towns who commute by car. section 3.1.9
Listing 3.5 Bayesian point estimation with a Dirichlet conjugate prior
from pgmpy.estimators import BayesianEstimator #1
model.fit(
data,
estimator=BayesianEstimator, #2
prior_type="dirichlet",
pseudo_counts=1 #3
)
causal_markov_kernels = model.get_cpds() #4
cmk_T = causal_markov_kernels[-1] #4
print(cmk_T) #4
The pgmpy example fits a Bayesian estimator with a Dirichlet prior and one pseudo-count. section 3.1.9


