Seyed Masoud Hosseini · Overview · Study log · Weekly summaries · Ideas · Search · Transcript · RSS feed
Machine Learning · Lecture 17 of 21 · 1:18:10
Lecture 16: Independent Component Analysis & Reinforcement Learning
Study guide
What this lecture covers
This lecture closes out CS229's unit on unsupervised learning by finishing independent component analysis (ICA), then opens the course's final major topic, reinforcement learning. The first half answers a specific question left over from the previous lecture: why must the source signals in ICA be non-Gaussian, and how do you turn an assumed source density into a maximum-likelihood algorithm that unmixes them? The second half asks a different question: how do you train a system to act well when there is no single correct answer to imitate, only a signal for when it did well or poorly?
By the end you should be able to explain why Gaussian sources make ICA unidentifiable, derive the density of the observed signal x from the density of the sources s and the unmixing matrix W, and describe how the ICA gradient-ascent update recovers a matrix that separates mixed voices. You should also be able to state the five components of a Markov decision process (MDP) and explain, using the grid-world example, what a policy and a discount factor do.
Key ideas
- Rotational ambiguity: if the sources were Gaussian, their joint distribution would be rotationally symmetric, so no unmixing matrix could tell which axis is which source; ICA therefore requires non-Gaussian sources.
- CDF vs PDF: a random variable's cumulative distribution function
F(s)gives the probability of being below a value; differentiating it recovers the probability density function, and ICA is built by choosing a CDF for the sources rather than a PDF directly. - Density transformation: because
x = As = W^-1 s, the density ofxis not simply the density ofsevaluated pointwise; it must be scaled by the absolute value of the determinant ofWto stay normalized. - Sigmoid as source CDF: choosing the sigmoid function as the CDF of each source gives a density with fatter tails than a Gaussian, which fits real signals such as speech better than a Gaussian would; the Laplacian (double exponential) density also works.
- Maximum likelihood update: stochastic gradient ascent on the log-likelihood of
W, using the derivative given in the lecture notes, converges to an unmixing matrix that recovers the original sources ass = Wx. - State transition probabilities:
P_sagives the probability of moving to each possible next states'after taking actionain states; the grid-world example models a robot that only reaches its intended cell 80% of the time. - Discount factor:
gamma, a number just below 1, shrinks the weight of rewards further in the future, which both encourages getting to positive rewards sooner and makes many reinforcement learning algorithms provably converge. - Policy: the output of a reinforcement learning algorithm is typically a policy, a mapping from states to actions, which is executed by always taking the action the policy assigns to the current state.
Walkthrough
Why ICA needs non-Gaussian sources (3:07)
The lecture reopens the cocktail-party picture from before: sources uniform between -1 and 1 can be recovered because their joint distribution has corners that pin down the correct unmixing directions. If the sources were Gaussian instead, their joint density would be rotationally symmetric, so any rotation of the axes would look equally valid, and no algorithm could recover the true speaker directions. This is stated as a general fact: ICA is only possible when the source distribution is non-Gaussian.
From CDF to the density of x (8:09)
To build the model, the lecture introduces the cumulative distribution function as an alternative to specifying a density directly, since ICA will define the source density indirectly through a CDF. Using a worked one-dimensional example (s uniform on [0,1], x = 2s), it shows that naively substituting s = Wx into the source density gives the wrong answer for continuous variables; the correct density of x must be multiplied by the absolute value of the determinant of W to remain a valid, normalized density.
Choosing a source density and deriving the ICA update (18:32)
Since Gaussian sources are ruled out, the lecture picks the sigmoid function as the CDF for each speaker's voice; its derivative gives a fatter-tailed density that better matches real signals, and the Laplacian density is offered as an equally workable alternative. Combining the per-speaker densities (assuming independence) with the determinant correction gives the density of x as a function of W. Maximizing the resulting log-likelihood by stochastic gradient ascent yields an update rule for W; after it converges, the sources are recovered as s = Wx.
ICA in practice: EEG and natural images (33:57)
The lecture shows ICA cleaning EEG recordings, treating overlapping brain signals (heartbeat, eye blinks, cognitive activity) as independent sources mixed across scalp electrodes; removing the recovered heartbeat and eye-blink components leaves a cleaner signal for downstream analysis. It also describes applying ICA to natural image patches, where the independent components come out looking like edge detectors, a result connected to earlier hierarchical sparse-coding work, including the well-known "Google cat" neural network result, and to open questions about nonlinear extensions of ICA.
Number of sources versus number of sensors (40:01)
The lecture addresses a practical question: what if the number of microphones and speakers differ? More microphones than speakers can be handled by allowing some recovered sources to come out silent, or by explicitly modeling fewer sources than sensors. Fewer microphones than speakers is described as a genuinely hard, still-active research problem, workable in limited cases (for example, separating one male and one female voice from a single microphone) but unreliable in general.
Introducing reinforcement learning (49:23)
The lecture motivates reinforcement learning with tasks like flying a helicopter or playing chess or Go, where there is no single correct action to imitate at each step, so supervised learning does not directly apply. Instead, a designer specifies a reward function that scores outcomes as good or bad (for example, +1 for a win, -1 for a loss), and the algorithm must learn by itself which actions lead to more reward. The credit assignment problem is introduced: when a late reward arrives, the algorithm has to work out which earlier actions actually caused it.
MDPs, the grid-world example, and discounting (56:29)
Reinforcement learning problems are formalized as Markov decision processes, defined by a five-tuple: states, actions, state transition probabilities, a discount factor gamma, and a reward function. Using a simple grid-world robot with an 80% chance of moving as commanded and 10% chances of slipping sideways, the lecture shows how rewards (+1 at a goal cell, -1 at a hazard cell, small negative rewards elsewhere) shape behavior, and how the discount factor pulls positive rewards earlier and pushes penalties later while also helping convergence proofs. It closes by defining a policy as a mapping from states to actions and showing the optimal policy for the example grid, where the robot sometimes takes a longer but safer route to avoid a chance of stepping into the penalty cell.
Before you watch
- Review the earlier ICA lecture's cocktail-party setup (mixing matrix
A, unmixing matrixW, sourcess, observationsx) and its two harmless ambiguities (speaker order and sign). - Be comfortable with the relationship between a probability density function and its cumulative distribution function.
- Recall the earlier unsupervised learning methods in this course (k-means, mixture of Gaussians and EM, factor analysis, PCA), since this lecture explicitly places ICA alongside them.
- Basic familiarity with matrix determinants and stochastic gradient ascent will make the ICA derivation easier to follow.
Check your understanding
- Why does a Gaussian source distribution make independent component analysis impossible, while a uniform or Laplacian distribution does not?
- In the derivation of the density of
x, why can't you simply substitutes = Wxinto the density ofs, and what correction factor fixes this? - What role does the sigmoid function play in the ICA model, and why is a Gaussian CDF not a valid choice?
- What is the credit assignment problem, and why does it make reinforcement learning harder than supervised learning?
- In the grid-world example, why might the optimal policy choose a longer route toward the goal instead of the shortest one?
Vocabulary
- rotational ambiguity (noun)
- A situation where multiple rotated versions of a solution are equally valid.
Rotational ambiguity makes Gaussian sources impossible for ICA to separate. - cumulative distribution function (CDF) (noun)
- A function giving the probability that a random variable is below a certain value.
ICA defines each source's distribution using a CDF. - probability density function (PDF) (noun)
- A function describing how likely different values of a continuous variable are.
Differentiating the CDF gives the probability density function. - fatter tails (phrase)
- Describes a distribution with more extreme values than a standard bell curve.
The sigmoid-based density has fatter tails than a Gaussian. - Laplacian distribution (noun)
- A probability distribution shaped like two exponential curves back to back, with a sharp peak.
The Laplacian distribution is another valid choice for ICA's source density. - log-likelihood (noun)
- The logarithm of how probable the observed data is under a model.
Maximizing the log-likelihood produces the ICA update rule. - stochastic gradient ascent (noun)
- An optimization method that increases a function's value using one example at a time.
Stochastic gradient ascent updates W to better separate the sources. - sparse coding (noun)
- A representation method where data is explained using only a few active components at a time.
ICA's edge-detector result connects to sparse coding research. - reinforcement learning (noun)
- Learning to act well through a reward signal instead of labeled examples.
Reinforcement learning trains an agent using rewards instead of correct answers. - reward function (noun)
- A function that scores how good or bad an outcome or action was.
The reward function gives +1 for a win and -1 for a loss. - credit assignment problem (noun)
- The challenge of figuring out which earlier actions caused a later reward.
The credit assignment problem makes reinforcement learning harder than supervised learning. - Markov decision process (MDP) (noun)
- A formal framework describing states, actions, and rewards for sequential decision-making.
Reinforcement learning problems are formalized as Markov decision processes. - state (noun)
- A specific situation or configuration the system can be in.
The robot's position on the grid is its current state. - state transition probability (noun)
- The chance of moving to a particular next state after taking an action.
The state transition probability captures the robot's 80% chance of moving correctly. - discount factor (noun)
- A number slightly less than one that reduces the value of rewards received later.
The discount factor gamma makes earlier rewards more valuable than later ones. - policy (noun)
- A rule mapping each state to the action to take there.
The optimal policy tells the robot which action to take in every state. - grid-world (noun)
- A simple simulated environment made of a grid of cells used to teach reinforcement learning.
The grid-world example shows a robot navigating toward a goal. - hazard (noun)
- A dangerous or undesirable situation to be avoided.
The grid has a hazard cell that gives a negative reward. - EEG (electroencephalogram) (noun)
- A recording of electrical activity in the brain measured from the scalp.
ICA can clean overlapping signals in an EEG recording. - edge detector (noun)
- A feature that responds to sharp changes in brightness in an image.
ICA applied to natural images produces components that act like edge detectors.
Chapters
- 0:00 <Untitled Chapter 1>
- 7:29 develop the ica algorithm
- 33:47 let me wrap up with some ica examples
- 36:19 zooming into the eeg plot
- 1:07:52 discount factor
From the YouTube description
For more information about Stanford’s Artificial Intelligence professional and graduate programs, visit: https://stanford.io/ai
Andrew Ng
Adjunct Professor of Computer Science
https://www.andrewng.org/
To follow along with the course schedule and syllabus, visit:
http://cs229.stanford.edu/syllabus-autumn2018.html
← Lecture 15: PCA and ICA · Lecture 17: MDPs, Value Iteration and Policy Iteration →
