Probabilistic & Bayesian ML

Markov random field

/ MAR-kof RAN-dum FEELD /

A Markov random field is a probabilistic graphical model whose connections are plain lines, not arrows — they say two things are linked without claiming which one came first. Picture a grid of pixels in a photo: each pixel tends to look like its neighbors. There is no 'cause' flowing left-to-right; it is just mutual influence, a web of pressures where everything gently agrees with what's next to it. That symmetric, directionless tug is what a Markov random field captures.

The defining rule is local and intuitive: each variable, once you know its immediate neighbors, is independent of the whole rest of the field. A pixel cares about the pixels touching it and, given those, ignores the far corners of the image. Instead of probability tables on arrows, the model uses 'potentials' — scores that reward or penalize whole groups of neighbors for agreeing or clashing. High scores for neighbors matching makes smooth regions likely; the overall probability is built by multiplying these local scores together.

Why it matters: directionless linkage is the natural language for things spread over space — images, maps, materials, social ties — where 'A causes B' makes no sense but 'A and B tend to match' does. Markov random fields underpinned classic image denoising and segmentation. The honest catch is a technical but real one: to turn those local scores into actual probabilities you must divide by a grand normalizing total (the 'partition function') that is usually impossible to compute exactly. So Markov random fields are easy to write down but genuinely hard to fit and to sample from, which is why approximate methods are nearly always required.

Cleaning up a grainy black-and-white photo. Model each pixel as a node linked to its four neighbors. The potentials reward neighboring pixels for sharing the same color and reward each pixel for staying near its observed (noisy) value. The most probable configuration smooths away random speckles while keeping true edges, because flipping a lone stray pixel costs more agreement than it saves.

Image denoising as a Markov random field: neighbors prefer to agree, so isolated speckles get smoothed but real edges survive.

Unlike a Bayesian network, the numbers a Markov random field assigns to groups of neighbors are scores, not probabilities — they don't sum to one until divided by the partition function, which is typically intractable. This is why MRFs are convenient to specify but notoriously hard to train and sample exactly.

Also called
MRFundirected graphical modelMarkov network马尔可夫随机场馬可夫隨機場马尔科夫网络