ArticleslgStudy

computer science

EM algorithm and GMM model

EM algorithm and GMM model 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 EM algorithm and GMM model rather than just read about it. In short: In statistics, EM (expectation maximization) algorithm handles latent variables, while GMM is the Gaussian mixture model. Background In the picture below, are shown the red blood cell hemoglobin concentration and the red blood cell volume data of two groups of people, the Anemia group and the control group (i.e. the group of people without Anemia).

EM algorithm and GMM model — main illustration
EM algorithm and GMM model — illustration

Key takeaways

  • EM algorithm and GMM model 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 EM algorithm and GMM model to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of EM algorithm and GMM model from memory before moving on to harder problems.

Reference excerpt

In statistics, EM (expectation maximization) algorithm handles latent variables, while GMM is the Gaussian mixture model.

Background In the picture below, are shown the red blood cell hemoglobin concentration and the red blood cell volume data of two groups of people, the Anemia group and the control group (i.e. the group of people without Anemia). As expected, people with Anemia have lower red blood cell volume and lower red blood cell hemoglobin concentration than those without Anemia.

x is a random vector such as x:=(red blood cell volume,red blood cell hemoglobin concentration), and from medical studies it is known that x are normally distributed in each group, i.e. x∼𝒩(μ,Σ). z is denoted as the group where x belongs, with zi=0 when xi belongs to the Anemia group and zi=1 when xi belongs to the control group. Also z∼Categorical⁡(k,ϕ) where k=2, ϕj≥0, and ∑j=1kϕj=1. See Categorical distribution. The following procedure can be used to estimate ϕ,μ,Σ. A maximum likelihood estimation can be applied:

ℓ(ϕ,μ,Σ)=∑i=1mlog⁡(p(x(i);ϕ,μ,Σ))=∑i=1mlog⁡∑z(i)=1kp(x(i)∣z(i);μ,Σ)p(z(i);ϕ) As the zi for each xi are known, the log likelihood function can be simplified as below:

ℓ(ϕ,μ,Σ)=∑i=1mlog⁡p(x(i)∣z(i);μ,Σ)+log⁡p(z(i);ϕ) Now the likelihood function can be maximized by making partial derivative over μ,Σ,ϕ, obtaining:

ϕj=1m∑i=1m1{z(i)=j} μj=∑i=1m1{z(i)=j}x(i)∑i=1m1{z(i)=j} Σj=∑i=1m1{z(i)=j}(x(i)−μj)(x(i)−μj)T∑i=1m1{z(i)=j} If zi is known, the estimation of the parameters results to be quite simple with maximum likelihood estimation. But if zi is unknown it is much more complicated.

Being z a latent variable (i.e. not observed), with unlabeled scenario, the expectation maximization algorithm is needed to estimate z as well as other parameters. Generally, this problem is set as a GMM since the data in each group is normally distributed.

In machine learning, the latent variable z is considered as a latent pattern lying under the data, which the observer is not able to see very directly. xi is the known data, while ϕ,μ,Σ are the parameter of the model. With the EM algorithm, some underlying pattern z in the data xi can be found, along with the estimation of the parameters. The wide application of this circumstance in machine learning is what makes EM algorithm so important.

EM algorithm in GMM The EM algorithm consists of two steps: the E-step and the M-step. Firstly, the model parameters and the z(i) can be randomly initialized. In the E-step, the algorithm tries to guess the value of z(i) based on the parameters, while in the M-step, the algorithm updates the value of the model parameters based on the guess of z(i)of the E-step. These two steps are repeated until convergence is reached. The algorithm in GMM is: Repeat until convergence:

1. (E-step) For each i,j, set wj(i):=p(z(i)=j|x(i);ϕ,μ,Σ)

2. (M-step) Update the parameters ϕj:=1m∑i=1mwj(i) μj:=∑i=1mwj(i)x(i)∑i=1mwj(i) Σj:=∑i=1mwj(i)(x(i)−μj)(x(i)−μj)T∑i=1mwj(i)

With Bayes' rule, the following result is obtained by the E-step: p(z(i)=j|x(i);ϕ,μ,Σ)=p(x(i)|z(i)=j;μ,Σ)p(z(i)=j;ϕ)∑l=1kp(x(i)|z(i)=l;μ,Σ)p(z(i)=l;ϕ) According to GMM setting, these following formulas are obtained: p(x(i)|z(i)=j;μ,Σ)=1(2π)n/2|Σj|1/2exp⁡(−12(x(i)−μj)TΣj−1(x(i)−μj)) p(z(i)=j;ϕ)=ϕj In this way, a switch between the E-step and the M-step is possible, according to the randomly initialized parameters.

References

Illustrations

EM algorithm and GMM model: GMM without labels
GMM without labels
EM algorithm and GMM model: GMM Training on artificial data
GMM Training on artificial data

Worked examples

Example 1 — a first encounter with EM algorithm and GMM model

Start with the simplest possible case. Write down what EM algorithm and GMM model 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 EM algorithm and GMM model 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 EM algorithm and GMM model 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 EM algorithm and GMM model

In research
EM algorithm and GMM model 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 EM algorithm and GMM model 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
EM algorithm and GMM model is common in secondary-school and first-year university syllabi. It links to neighbouring topics Machine learning, Regression models, so understanding it makes those chapters shorter.
In everyday life
Look for EM algorithm and GMM model 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 “EM algorithm and GMM model” →

How to study EM algorithm and GMM model in 20 minutes

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

Frequently asked questions

What is EM algorithm and GMM model in simple terms?

In statistics, EM (expectation maximization) algorithm handles latent variables, while GMM is the Gaussian mixture model. Background In the picture below, are shown the red blood cell hemoglobin concentration and the red blood cell volume data of two groups of people, the Anemia group and the contr…

Why does EM algorithm and GMM model 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 EM algorithm and GMM model?

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 EM algorithm and GMM model.

Tags

  • Machine learning
  • Regression models

Keep exploring