liveBook · Manning

Conjugacy

As explained in Causal AI

A conjugate prior is a prior distribution whose posterior distribution has the same mathematical form as the prior when combined with a specified likelihood.

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

How Causal AI covers it

How deep it goes
Defines prior-posterior form matching and explains Dirichlet-categorical updating through counts and prior parameters, without sampling or variational inference.
Examples
Uses a Dirichlet prior to smooth commute-mode probabilities, including an extreme 100% estimate for self-employed people in small towns who drive.
What it assumes
Assumes categorical parameter estimation; defines the probability simplex and Dirichlet prior, while avoiding complex inference algorithms for this conjugate case.
What you can do after
Apply via pgmpy’s BayesianEstimator with a Dirichlet prior and pseudo_counts=1 to estimate categorical model parameters.
How it connects
Connects Bayesian estimation and categorical distributions through Dirichlet priors, contrasting the result with maximum-likelihood estimation.

Also explained in

Compare how 3 books explain conjugacy →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Causal AI. The section links point to the parts of the book it draws on.