A topic in the Open Knowledge Graph — a free, open map of 15,495 topics and the order to learn them in.

Markov Random Fields

Graduate Depth 108 in the knowledge graph ☐ I know this ☆ Set as goal
3topics build on this
671prerequisites beneath it
See this on the map →
Probabilistic Graphical ModelsHidden Markov Models→→Factor Graphs and Inference
graphical-models undirected-graphs inference cliques

Core Idea

Markov random fields (undirected graphical models) represent joint distributions using potential functions on cliques, where a variable's conditional distribution depends only on its neighbors. They are symmetric in dependencies (unlike directed Bayesian networks) and are natural for image processing, spatial modeling, and problems without clear causality.

How It's Best Learned

Implement inference in a simple MRF for image denoising or texture synthesis using belief propagation.

Explainer

From your work with probabilistic graphical models, you know that a graphical model encodes a joint probability distribution by making independence assumptions explicit through graph structure. Bayesian networks use directed edges to represent conditional dependencies, which naturally express causal or generative stories: "A causes B, B causes C." But many real-world problems involve dependencies that are symmetric — neighboring pixels in an image influence each other without a clear causal direction, atoms in a crystal lattice interact mutually, and words in a sentence constrain each other bidirectionally. Markov random fields (MRFs) handle these situations by using undirected graphs, where an edge between two variables simply means "these two are directly related."

The key structural concept in an MRF is the clique — a subset of nodes that are all connected to each other. Instead of specifying conditional probability tables as in Bayesian networks, MRFs define potential functions (also called compatibility functions or factors) on cliques. A potential function assigns a non-negative score to each configuration of the variables in a clique, expressing how "compatible" those values are with each other. For example, in an image denoising MRF, a pairwise potential between neighboring pixels might assign a high score when both pixels have similar values and a low score when they differ sharply — encoding the prior belief that natural images are locally smooth. The joint distribution is proportional to the product of all clique potentials, but since potentials are not probabilities, you need a partition function Z to normalize everything into a proper distribution.

The Markov property in an MRF takes a spatial rather than temporal form: a variable is conditionally independent of all other variables given its neighbors in the graph. This is called the local Markov property, and it is what makes inference tractable — you only need to look at a variable's immediate neighborhood to reason about it. This connects to the Hammersley-Clifford theorem, which states that any distribution satisfying this Markov property with respect to an undirected graph can be factored as a product of potentials on the graph's cliques. The theorem provides the theoretical foundation linking graph structure to factorization.

Computing exact marginal probabilities or finding the most probable configuration in an MRF is generally intractable because the partition function Z requires summing over all possible configurations — exponential in the number of variables. Practical inference relies on approximate methods. Belief propagation passes messages between neighboring nodes, iteratively refining local beliefs about each variable's distribution. On tree-structured graphs, belief propagation is exact; on graphs with loops (which most real MRFs have), it becomes loopy belief propagation, an approximation that often works well in practice despite lacking formal guarantees. Other approaches include variational methods, which find a tractable distribution close to the true one, and sampling methods like Gibbs sampling, which draw samples from the joint distribution by iterating through variables one at a time, conditioning on neighbors — directly exploiting the local Markov property.

Practice Questions 5 questions

Prerequisite Chain

Understanding Zero → The Number Zero → Counting to Five → Counting to 10 → Counting to 20 → Counting a Set of Objects Up to 20 → Cardinality: The Last Number Counted → Matching Numerals to Quantities → Subitizing Small Quantities → Combining Small Groups Within 5 → Number Bonds Within 5 → Number Bonds to 10 → Tens and Ones Place Value → Reading and Writing Three-Digit Numbers → Comparing Three-Digit Numbers → Comparing and Ordering Three-Digit Quantities → Comparing and Ordering Whole Numbers → Comparing Numbers 1 to 20 → Ordering Numbers to 20 → Number Line 0 to 20 → Addition Within 20 → Doubles and Near Doubles → Doubles Facts Within 10 → Near Doubles Facts Within 20 → Mental Math Strategies for Addition → Mental Math: Adding and Subtracting Tens → Addition Within 100 → Repeated Addition as Multiplication → Multiplication as Equal Groups → Multiplication: Arrays → Basic Multiplication Facts (0s, 1s, 2s, 5s, 10s) → Multiplication Facts Within 100 → Division as Equal Sharing → Division as Grouping (Measurement Division) → Division: Grouping (Repeated Subtraction) Model → Division: Fair Sharing Model → Division as Equal Sharing → Division as Grouping → Basic Division Facts → Division Facts Within 100 → Multiplication and Division Fact Families → Relationship Between Multiplication and Division → Division Facts as Inverse of Multiplication → Remainders and Quotients in Division → Division Word Problems → Multi-Step Word Problems → Solving Multi-Step Word Problems → Multiplication Word Problems → Division Word Problems → Introduction to Long Division → Factors and Multiples → Prime and Composite Numbers → Equivalent Fractions → Relating Fractions and Decimals → Decimal Place Value → Integers and the Number Line → Opposites and Additive Inverses → Absolute Value → Adding Integers → Subtracting Integers → Multiplying Integers → Introduction to Exponents → Order of Operations → Integer Order of Operations → Variable Expressions → The Distributive Property → Variables and Expressions Review → Introduction to Polynomials → Adding and Subtracting Polynomials → Multiplying Polynomials → Factorial → Permutations → Combinations → Counting Principles: Addition and Multiplication Rules → Introduction to Graph Theory → Propositional Logic Foundations → Logical Equivalences → Boolean Algebra → Boolean Type and Truth Values → Comparison Operators and Boolean Tests → Logical Operators and Boolean Algebra → Boolean Algebra and Fundamental Laws → Logic Gates Fundamentals → Implementing Boolean Functions with Gates → Karnaugh Map Simplification → Combinational Circuit Design → Flip-Flops and Latches → Finite State Machines (FSMs) → Deterministic Finite Automata (DFA) → Nondeterministic Finite Automata (NFA) → Regular Language Recognition Algorithms → DFA Properties and Minimization Algorithms → Regular Languages: Definition and Characterization → Context-Free Grammars (CFGs) → Context-Free Grammar Properties and Ambiguity → Parse Trees, Derivations, and Ambiguity in CFGs → Context-Free Grammars in Compiler Design → Abstract Syntax Trees (ASTs) → Symbol Tables and Scope Resolution → Semantic Analysis Phase → Scope and Binding Resolution → Scope, Shadowing, and Variable Lifetime → Parameter Passing: Value vs. Reference → Two-Dimensional Arrays → Graph Representations: Adjacency List vs. Adjacency Matrix → Semantic Networks → Bayesian Networks and Inference → Probabilistic Graphical Models → Markov Random Fields

Longest path: 109 steps · 671 total prerequisite topics

Prerequisites (2)

Leads To (1)