Suppose a model must assign probabilities to a chain of variables X, Y, and Z. A full factorization is P(X,Y,Z) = P(X)P(Y|X)P(Z|X,Y). Under a Markov assumption, each variable depends only on its immediate predecessor, giving P(X,Y,Z) = P(X)P(Y|X)P(Z|Y). The simplified factor P(Z|Y) is a Markov kernel. This is a modeling assumption, not a guarantee: Z might still depend on X after Y is known. section 2.1.5
In a causal directed acyclic graph (DAG), a causal Markov kernel gives each node’s distribution conditional on its direct parents. Multiplying those kernels factorizes the joint distribution. For a temperature model with altitude, cloud cover, latitude, and season as causes, the kernels include P(T|A,C,L,S) for temperature and a separate distribution for each parent node. The DAG specifies the causal assumptions; a probability table or neural network specifies how to represent a kernel. section 3.2 section 6.1
Choosing and estimating kernels depends on the variables and available data:
- For categorical variables, fit conditional probability tables with pgmpy’s BayesianNetwork.fit, then retrieve them with get_cpds. A node without parents has an ordinary probability table. section 3.1.8
- For an unobserved node, pgmpy’s expectation-maximization estimator can estimate kernels, but the data may not identify their true parameters; extra data alone cannot resolve an unidentified parameter. section 3.1.10
- For high-dimensional image pixels, use a deep neural network rather than an unwieldy conditional probability table. section 5.1
Reading a transportation kernel
In a transportation model, P(T|O,R) assigns probabilities to travel modes given occupation and residence. A fitted table gives P(T=car|O=emp,R=big) = 0.7034. For that same occupation–residence combination, the probabilities of car, other, and train sum to one. If the mechanism governing residence given education changes, the model assumes the separate travel-mode kernel’s parameters do not change merely because of that change. section 3.1.8 section 3.2.3
Listing 3.4 Learning parameters for the causal Markov kernels
from pgmpy.models import BayesianNetwork
model = BayesianNetwork(
[
('A', 'E'),
('S', 'E'),
('E', 'O'),
('E', 'R'),
('O', 'T'),
('R', 'T')
]
)
model.fit(data) #1
causal_markov_kernels = model.get_cpds() #2
print(causal_markov_kernels) #2
The listing shows the categorical workflow: define the DAG, fit its parameters from survey data, and retrieve one conditional probability table per node. section 3.1.8
A fitted kernel does not by itself specify exactly how a cause changes its effect. A structural causal model adds assumptions about that mechanism through its function class, enabling further causal inferences while increasing the risk of modeling error. section 6.1
