ArticleslgStudy

computer science

Markov random field

Markov random field is a computer science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Markov random field rather than just read about it. In short: In the domain of physics and probability, a Markov random field (MRF), Markov network or undirected graphical model is a set of random variables having a Markov property described by an undirected graph. In other words, a random field is said to be a Markov random field if it satisfies Markov properties.

Markov random field — main illustration
Markov random field — illustration

Key takeaways

  • Markov random field belongs to computer science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Markov random field to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Markov random field from memory before moving on to harder problems.

Reference excerpt

In the domain of physics and probability, a Markov random field (MRF), Markov network or undirected graphical model is a set of random variables having a Markov property described by an undirected graph. In other words, a random field is said to be a Markov random field if it satisfies Markov properties. The concept originates from the Sherrington–Kirkpatrick model. A Markov network or MRF is similar to a Bayesian network in its representation of dependencies; the differences being that Bayesian networks are directed and acyclic, whereas Markov networks are undirected and may be cyclic. Thus, a Markov network can represent certain dependencies that a Bayesian network cannot (such as cyclic dependencies ); on the other hand, it can't represent certain dependencies that a Bayesian network can (such as induced dependencies ). The underlying graph of a Markov random field may be finite or infinite. When the joint probability density of the random variables is strictly positive, it is also referred to as a Gibbs random field, because, according to the Hammersley–Clifford theorem, it can then be represented by a Gibbs measure for an appropriate (locally defined) energy function. The prototypical Markov random field is the Ising model; indeed, the Markov random field was introduced as the general setting for the Ising model. In the domain of artificial intelligence, a Markov random field is used to model various low- to mid-level tasks in image processing and computer vision.

Definition Given an undirected graph G=(V,E), a set of random variables X=(Xv)v∈V indexed by V form a Markov random field with respect to G if they satisfy the local Markov properties:

Pairwise Markov property: Any two non-adjacent variables are conditionally independent given all other variables: Xu⊥⊥Xv∣XV∖{u,v} Local Markov property: A variable is conditionally independent of all other variables given its neighbors: Xv⊥⊥XV∖N⁡[v]∣XN⁡(v) where N⁡(v) is the set of neighbors of v, and N⁡[v]=v∪N⁡(v) is the closed neighbourhood of v. Global Markov property: Any two subsets of variables are conditionally independent given a separating subset: XA⊥⊥XB∣XS where every path from a node in A to a node in B passes through S. The Global Markov property is stronger than the Local Markov property, which in turn is stronger than the Pairwise one. However, the above three Markov properties are equivalent for positive distributions (those that assign only nonzero probabilities to the associated variables). The relation between the three Markov properties is particularly clear in the following formulation:

Pairwise: For any i,j∈V not equal or adjacent, Xi⊥⊥Xj|XV∖{i,j}. Local: For any i∈V and J⊂V not containing or adjacent to i, Xi⊥⊥XJ|XV∖({i}∪J). Global: For any I,J⊂V not intersecting or adjacent, XI⊥⊥XJ|XV∖(I∪J).

Clique factorization As the Markov property of an arbitrary probability distribution can be difficult to establish, a commonly used class of Markov random fields are those that can be factorized according to the cliques of the graph. Given a set of random variables X=(Xv)v∈V, let P(X=x) be the probability of a particular field configuration x in X—that is, P(X=x) is the probability of finding that the random variables X take on the particular value x. Because X is a set, the probability of x should be understood to be taken with respect to a joint distribution of the Xv. If this joint density can be factorized over the cliques of G as

P(X=x)=∏C∈cl⁡(G)φC(xC) then X forms a Markov random field with respect to G. Here, cl⁡(G) is the set of cliques of G. The definition is equivalent if only maximal cliques are used. The functions φC are sometimes referred to as factor potentials or clique potentials. Note, however, conflicting terminology is in use: the word potential is often applied to the logarithm of φC. This is because, in statistical mechanics, log⁡(φC) has a direct interpretation as the potential energy of a configuration xC. Some MRF's do not factorize: a simple example can be constructed on a cycle of 4 nodes with some infinite energies, i.e. configurations of zero probabilities, even if one, more appropriately, allows the infinite energies to act on the complete graph on V. MRF's factorize if at least one of the following conditions is fulfilled:

the density is strictly positive (by the Hammersley–Clifford theorem) the graph is chordal (by equivalence to a Bayesian network) When such a factorization does exist, it is possible to construct a factor graph for the network.

Exponential family Any positive Markov random field can be written as exponential family in canonical form with feature functions fk such that the full-joint distribution can be written as

P(X=x)=1Zexp⁡(∑kwk⊤fk(x{k})) where the notation

wk⊤fk(x{k})=∑i=1Nkwk,i⋅fk,i(x{k}) is simply a dot product over field configurations, and Z is the partition function:

… excerpt ends here. Continue reading the full article.

Illustrations

Markov random field: An example of a Markov random field. Each edge represents dependency. In this example: A depends on B and D. B depends on A and D. D depends on A, B, and E. E depends on D and C. C depends on E.
An example of a Markov random field. Each edge represents dependency. In this example: A depends on B and D. B depends on A and D. D depends on A, B, and E. E depends on D and C. C depends on E.

Worked examples

Example 1 — a first encounter with Markov random field

Start with the simplest possible case. Write down what Markov random field claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In computer science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Markov random field before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Markov random field ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Markov random field

In research
Markov random field appears in computer science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Markov random field in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Markov random field is common in secondary-school and first-year university syllabi. It links to neighbouring topics Graphical models, Markov networks, so understanding it makes those chapters shorter.
In everyday life
Look for Markov random field outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “Markov random field” →

How to study Markov random field in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Markov random field means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Markov random field out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Markov random field in simple terms?

In the domain of physics and probability, a Markov random field (MRF), Markov network or undirected graphical model is a set of random variables having a Markov property described by an undirected graph. In other words, a random field is said to be a Markov random field if it satisfies Markov prope…

Why does Markov random field matter?

Because it connects several computer science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Markov random field?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Markov random field.

Tags

  • Graphical models
  • Markov networks

Keep exploring