ArticleslgStudy

science

Variable elimination

Variable elimination is a 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 Variable elimination rather than just read about it. In short: Variable elimination (VE) is a simple and general exact inference algorithm in probabilistic graphical models, such as Bayesian networks and Markov random fields. It can be used for inference of maximum a posteriori (MAP) state or estimation of conditional or marginal distributions over a subset of variables.

Key takeaways

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

Reference excerpt

Variable elimination (VE) is a simple and general exact inference algorithm in probabilistic graphical models, such as Bayesian networks and Markov random fields. It can be used for inference of maximum a posteriori (MAP) state or estimation of conditional or marginal distributions over a subset of variables. The algorithm has exponential time complexity, but could be efficient in practice for low-treewidth graphs, if the proper elimination order is used.

Factors Enabling a key reduction in algorithmic complexity, a factor f, also known as a potential, of variables V is a relation between each instantiation of v of variables f to a non-negative number, commonly denoted as f(x). A factor does not necessarily have a set interpretation. One may perform operations on factors of different representations such as a probability distribution or conditional distribution. Joint distributions often become too large to handle as the complexity of this operation is exponential. Thus variable elimination becomes more feasible when computing factorized entities.

Basic Operations

Variable Summation Algorithm 1, called sum-out (SO), or marginalization, eliminates a single variable v from a set ϕ of factors, and returns the resulting set of factors. The algorithm collect-relevant simply returns those factors in ϕ involving variable v. Algorithm 1 sum-out(v,ϕ)

Φ = collect factors relevant to v Ψ = the product of all factors in Φ τ=∑vΨ

return (ϕ−Φ)∪{τ} Example Here we have a joint probability distribution. A variable, v can be summed out between a set of instantiations where the set V−v at minimum must agree over the remaining variables. The value of v is irrelevant when it is the variable to be summed out.

After eliminating V1, its reference is excluded and we are left with a distribution only over the remaining variables and the sum of each instantiation.

The resulting distribution which follows the sum-out operation only helps to answer queries that do not mention V1. Also worthy to note, the summing-out operation is commutative.

Factor Multiplication Computing a product between multiple factors results in a factor compatible with a single instantiation in each factor. Algorithm 2 mult-factors(v,ϕ)

Z = Union of all variables between product of factors f1(X1),...,fm(Xm) f = a factor over f where f for all f For each instantiation z For 1 to m x1= instantiation of variables X1 consistent with z f(z)=f(z)fi(xi) return f Factor multiplication is not only commutative but also associative.

Inference The most common query type is in the form p(X|E=e) where X and E are disjoint subsets of U, and E is observed taking value e. A basic algorithm to computing p(X|E = e) is called variable elimination (VE), first put forth in. Taken from, this algorithm computes p(X|E=e) from a discrete Bayesian network B. VE calls SO to eliminate variables one by one. More specifically, in Algorithm 2, ϕ is the set C of conditional probability tables (henceforth "CPTs") for B, X is a list of query variables, E is a list of observed variables, e is the corresponding list of observed values, and σ is an elimination ordering for variables U−XE, where XE denotes X∪E. Variable Elimination Algorithm VE(ϕ,X,E,e,σ)

Multiply factors with appropriate CPTs while σ is not empty Remove the first variable v from σ ϕ = sum-out(v,ϕ) p(X,E=e) = the product of all factors Ψ∈ϕ return p(X,E=e)/∑Xp(X,E=e)

Ordering Finding the optimal order in which to eliminate variables is an NP-hard problem. As such there are heuristics one may follow to better optimize performance by order:

Minimum Degree: Eliminate the variable which results in constructing the smallest factor possible. Minimum Fill: By constructing an undirected graph showing variable relations expressed by all CPTs, eliminate the variable which would result in the least edges to be added post elimination.

References

Worked examples

Example 1 — a first encounter with Variable elimination

Start with the simplest possible case. Write down what Variable elimination claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In 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 Variable elimination 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 Variable elimination 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 Variable elimination

In research
Variable elimination appears in 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 Variable elimination 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
Variable elimination is common in secondary-school and first-year university syllabi. It links to neighbouring topics Graphical models, so understanding it makes those chapters shorter.
In everyday life
Look for Variable elimination 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 “Variable elimination” →

How to study Variable elimination in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Variable elimination 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 Variable elimination out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Variable elimination in simple terms?

Variable elimination (VE) is a simple and general exact inference algorithm in probabilistic graphical models, such as Bayesian networks and Markov random fields. It can be used for inference of maximum a posteriori (MAP) state or estimation of conditional or marginal distributions over a subset of…

Why does Variable elimination matter?

Because it connects several 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 Variable elimination?

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 Variable elimination.

Tags

  • Graphical models

Keep exploring