Discovering Structure
with Unsupervised Learning

Week-10 · ML-2026

Compress, map, group — and learn a latent model

Alexei Kornaev,
Dr. Sc., Prof.

Innopolis University

Researcher at the RC for AI,
National RC for Oncology n.a. N.N. Blokhin

Educational draft · Instructor review pending

Pencil illustration of cloaked figures on a snowy stone wall overlooking mountains and a forest.

Lecture map

  1. Compress: PCA
  2. Map: SNE and t-SNE
  3. Group: k-means
  4. Learn a reconstruction
  5. Train a latent model

Print / save as PDF

Four questions, four tests

Purpose Evidence
Compress Reconstruction on new observations
Map Neighbor identities preserved
Group Metric, stability, usefulness
Generate Sampling law and model diagnostics

Choose the question before judging the result.

Compress: PCA

  1. Compress: PCA
  2. Map: SNE and t-SNE
  3. Group: k-means
  4. Learn a reconstruction
  5. Train a latent model

One number locates a point on a line

Four centered points project onto a 45-degree line. Retained squared length is 32 and residual squared length is 8; total 40. Dashed segments meet the projection line at right angles.

Filled blue circles: observations; open green circles: projections; dashed orange segments: lost residuals. Point numbers identify the same observations in both views. Move the angle with the slider or arrow keys; the data stay fixed.

Move the slider to rotate the projection line.

hi=v⊤(xi−x‾)h_i=v^\top(x_i-\bar x) x̂i=x‾+hiv\widehat x_i=\bar x+h_iv

Filled circles mark observations. Open circles mark projections. Dashed lines show residuals.

At 45°: retained 32, lost 8.

Rotate coordinates; then discard one

The same observations are centered, rotated into principal coordinates, and projected onto one coordinate.

The same observations are centered, rotated into principal coordinates, and projected onto one coordinate.

Follow the same numbered observations through the panels.

Changing basis is reversible; dropping coordinates loses information.

Which line loses least?

For x̃i=xi−x‾\widetilde x_i=x_i-\bar x and ei=xi−x̂ie_i=x_i-\widehat x_i: ∥x̃i∥2=hi2+∥ei∥2.\|\widetilde x_i\|^2=h_i^2+\|e_i\|^2.

∑i∥x̃i∥2⏟fixed=∑ihi2⏟kept+∑i∥ei∥2⏟lost.\underbrace{\sum_i\|\widetilde x_i\|^2}_{\text{fixed}}= \underbrace{\sum_i h_i^2}_{\text{kept}}+\underbrace{\sum_i\|e_i\|^2}_{\text{lost}}.

Maximum retained variance gives minimum squared projection error.

Covariance records joint variation

C=1nXc⊤Xc.C=\frac1nX_c^\top X_c.

Each row of XcX_c is one centered observation. Diagonal entries are feature variances. Off-diagonal entries measure how two features vary together.

Matching signs contribute positively; opposite signs negatively.

Changing metres to centimetres multiplies that feature’s variance by 10,000.

Feature scales define what counts as large variation.

Why an eigenvector?

Var⁡(h)=v⊤Cv,v⊤v=1.\operatorname{Var}(h)=v^\top Cv,\qquad v^\top v=1.

∇v\nabla_v is the vector of partial derivatives with respect to the components of vv.

∇v{v⊤Cv−λ(v⊤v−1)}=0⇒Cv=λv.\nabla_v\{v^\top Cv-\lambda(v^\top v-1)\}=0\ \Rightarrow\ Cv=\lambda v.

v⊤Cv=λ.v^\top Cv=\lambda.

The largest eigenvalue gives the most retained variance.

Algorithm 1 · Fit PCA and encode

Input: training rows X:n×DX:n\times D and retained dimension dd.

  1. Learn x‾\bar x; center Xc=X−𝟏x‾⊤X_c=X-\mathbf1\bar x^\top.
  2. Form C=Xc⊤Xc/nC=X_c^\top X_c/n; find its orthonormal eigenvectors.
  3. Sort eigenvalues; retain V=[v1,…,vd]V=[v_1,\ldots,v_d].
  4. Encode H=XcVH=X_cV; save mean, basis and preprocessing.

New observation: h=V⊤(x−x‾)h=V^\top(x-\bar x) with saved statistics.

Algorithm 2 · Reconstruct

Input: scores HH and the same saved mean and basis.

  1. Expand X̂c=HV⊤\widehat X_c=HV^\top.
  2. Restore the center: X̂=X̂c+𝟏x‾⊤\widehat X=\widehat X_c+\mathbf1\bar x^\top.
  3. Reverse any earlier scaling using saved statistics.
  4. Compare in the same units: MSE=∥X−X̂∥F2/(nD)\mathrm{MSE}=\|X-\widehat X\|_F^2/(nD).

Restoring the feature count does not restore discarded information.

Worked PCA · Observe and center

1 · Observations X=(53351−1−11).X=\begin{pmatrix}5&3\\3&5\\1&-1\\-1&1\end{pmatrix}. n=4,D=2,d=1n=4,\ D=2,\ d=1.

2 · Center x‾=(22),Xc=(3113−1−3−3−1).\bar x=\binom22,\quad X_c=\begin{pmatrix}3&1\\1&3\\-1&-3\\-3&-1\end{pmatrix}. Track point 1: (5,3)→(3,1)(5,3)\to(3,1).

Worked PCA · Covariance and directions

3 · Covariance C=14Xc⊤Xc=(5335).C=\tfrac14X_c^\top X_c=\begin{pmatrix}5&3\\3&5\end{pmatrix}.

4 · Principal directions v1=12(11),λ1=8.v_1=\tfrac1{\sqrt2}\binom11,\quad\lambda_1=8. v2=12(1−1),λ2=2.v_2=\tfrac1{\sqrt2}\binom1{-1},\quad\lambda_2=2.

Worked PCA · Encode and reconstruct

5 · Retain and encode V=v1,H=XcV=(2222−22−22).V=v_1,\quad H=X_cV=\begin{pmatrix}2\sqrt2\\2\sqrt2\\-2\sqrt2\\-2\sqrt2\end{pmatrix}. Point 1: h1=(3+1)/2h_1=(3+1)/\sqrt2.

6 · Expand and restore X̂=HV⊤+𝟏x‾⊤=(44440000).\widehat X=HV^\top+\mathbf1\bar x^\top=\begin{pmatrix}4&4\\4&4\\0&0\\0&0\end{pmatrix}. Point 1: (5,3)→(4,4)(5,3)\to(4,4).

40=32+840=32+8: retain 80% of variation; per-feature MSE =1=1.

A direction is a signed pixel pattern

MNIST mean image and signed principal-direction pixel weights.

MNIST mean image and signed principal-direction pixel weights.

D=784D=784 measurements; a score weights one shared pattern.

A component need not be a named visual concept.

More coordinates recover more detail

The same five MNIST images reconstructed with increasing numbers of principal coordinates.

The same five MNIST images reconstructed with increasing numbers of principal coordinates.

Same held-out images; one nested basis.

More retained directions remove squared residual components.

Large variation can hide the useful clue

Spirals and two separated strips illustrate distinctions lost by one-dimensional PCA.

Spirals and two separated strips illustrate distinctions lost by one-dimensional PCA.

Predict the retained direction for the two horizontal strips.

High variance and useful class information can point in different directions.

Map: SNE and t-SNE

  1. Compress: PCA
  2. Map: SNE and t-SNE
  3. Group: k-means
  4. Learn a reconstruction
  5. Train a latent model

SNE · Give each point a neighborhood

Stochastic neighbor embedding (SNE) places each observation at a point on a map.

For input point xix_i, turn distances to the other points into weights. Normalize across candidates j≠ij\ne i: pj∣i=exp⁡(−∥xi−xj∥2/(2τi2))∑ℓ≠iexp⁡(−∥xi−xℓ∥2/(2τi2)). p_{j\mid i}= \frac{\exp(-\|x_i-x_j\|^2/(2\tau_i^2))} {\sum_{\ell\ne i}\exp(-\|x_i-x_\ell\|^2/(2\tau_i^2))}.

pj∣ip_{j\mid i} is the probability of choosing jj as a neighbor of ii.

SNE · Choose the neighborhood scale

Gaussian neighbor weights and normalized probabilities for four candidates.

Small τi\tau_i concentrates probability on close neighbors.

A larger τi\tau_i spreads probability over more points.

Perplexity is the effective number of neighbors. Choose a target and adjust τi\tau_i separately for each point.

SNE · Move the map to match neighborhoods

Give each observation a map position yiy_i. Use Gaussian weights with a fixed scale on the map: qj∣i=exp⁡(−∥yi−yj∥2)∑ℓ≠iexp⁡(−∥yi−yℓ∥2). q_{j\mid i}=\frac{\exp(-\|y_i-y_j\|^2)} {\sum_{\ell\ne i}\exp(-\|y_i-y_\ell\|^2)}.

Move all yiy_i to minimize the sum of neighborhood mismatches: L=∑i∑j≠ipj∣ilog⁡pj∣iqj∣i.L=\sum_i\sum_{j\ne i}p_{j\mid i}\log\frac{p_{j\mid i}}{q_{j\mid i}}.

If pj∣ip_{j\mid i} is large, a tiny qj∣iq_{j\mid i} is costly.

t-SNE modifies SNE

The same MNIST images mapped by t-SNE at several neighborhood scales and initializations.

Symmetric pairs: combine both input neighbor directions.

Student kernel: use (1+∥yi−yj∥2)−1(1+\|y_i-y_j\|^2)^{-1} on the map. Its slower decay helps ease crowding.

Read the map through local neighbors. Island gaps depend on the fit.

Group: k-means

  1. Compress: PCA
  2. Map: SNE and t-SNE
  3. Group: k-means
  4. Learn a reconstruction
  5. Train a latent model

K-means · Assign, update, repeat

  1. Initialize KK centers μ1,…,μK\mu_1,\ldots,\mu_K at random.
  2. Assign each point xix_i to its nearest center: ci=arg⁡min⁡1≤k≤K∥xi−μk∥2c_i=\arg\min_{1\le k\le K}\|x_i-\mu_k\|^2.
  3. Update each center to the arithmetic mean of its assigned points.
  4. Repeat steps 2–3 until assignments stabilize.

L=1m∑i=1m∥xi−μci∥2.L=\frac1m\sum_{i=1}^m\|x_i-\mu_{c_i}\|^2.

There are mm points. Each squared distance sums over the DD feature coordinates.

Watch assignment and update separately

Six successive assign/update endpoints show 300 fixed observations changing membership as centers move to means. Objective values do not increase.

Assign: points change groups while centers stay fixed.

Update: centers move to group means while memberships stay fixed.

What shape can a center represent?

Identical curved observations colored by generating group and by nearest-center clustering.

Identical curved observations colored by generating group and by nearest-center clustering.

Nearest-center regions favor compact groups.

Compactness, stability and usefulness need separate checks.

When k-means works well

Two compact synthetic groups shown before and after k-means. Circles and triangles mark fitted assignments and crosses mark fitted centers.

With K=2K=2, the fit recovers both generating groups in this sample.

When brightness is the wrong feature

Original chest X-ray and three color-coded intensity maps for K=2, 3 and 4. Dark blue denotes the lowest fitted intensity group and pale yellow the highest.

The dataset labels this image Pneumonia.

K = 2, 3, 4: each fit divides brightness into more bands. Panel titles give fitted centers from darkest to brightest.

Dark blue marks the lowest band. Pale yellow marks the highest. Bright hardware and tissue can share a band.

Data provider: NIH Clinical Center · NIH ChestX-ray14 download · Wang et al., CVPR 2017

Learn a reconstruction

  1. Compress: PCA
  2. Map: SNE and t-SNE
  3. Group: k-means
  4. Learn a reconstruction
  5. Train a latent model

Training an autoencoder

Schematic encoder, numerical code, decoder, reconstruction loss and weight updates.

Schematic encoder, numerical code, decoder, reconstruction loss and weight updates.

The encoder maps an image to code hh. The decoder reconstructs the input. Reconstruction error updates both networks.

Algorithm · Train, check, use

Stage Operation
Specify Encoder, decoder, bottleneck and loss
Forward H=fψ(X)H=f_\psi(X); X̂=gθ(H)\widehat X=g_\theta(H)
Score L=1BD∑i,j(xij−x̂ij)2L=\frac1{BD}\sum_{i,j}(x_{ij}-\widehat x_{ij})^2
Update Clear gradients; backpropagate; update both networks
Check Measure held-out reconstruction with fixed weights
Use Encode/reconstruct a new image with fixed weights

Why require a bottleneck?

X:(B,D)→H:(B,d)→X̂:(B,D),d<D.X:(B,D)\ \longrightarrow\ H:(B,d)\ \longrightarrow\ \widehat X:(B,D),\qquad d<D.

A constraint makes copying harder and forces information selection.

A small code still does not guarantee meaningful features.

What did this AE preserve?

Original MNIST images and deterministic autoencoder reconstructions at two bottleneck dimensions.

Original MNIST images and deterministic autoencoder reconstructions at two bottleneck dimensions.

Same held-out images; bottlenecks of 2 and 16.

Measure recovery separately from recognition.

Does reconstruction help recognition?

Freeze encoder → encode → train labeled probe → validate choices → test once.

Ask where labels enter this experiment.

Downstream usefulness needs a declared task.

Train a latent model

  1. Compress: PCA
  2. Map: SNE and t-SNE
  3. Group: k-means
  4. Learn a reconstruction
  5. Train a latent model

VAE · Learn inference and reconstruction together

The encoder gives each image a distribution of possible codes.

A sampled code enters the decoder; the same input supplies the reconstruction target.

No digit label or correct code is provided.

Three distributions, three roles

Distribution Question
p(𝒛)p(\mathbf z) Codes before observing this image?
pθ(𝒛∣𝒙)p_\theta(\mathbf z\mid\mathbf x) Which codes explain it under the model?
qψ(𝒛∣𝒙)q_\psi(\mathbf z\mid\mathbf x) What can the encoder approximate?

These describe image codes, rather than network-weight uncertainty.

From a code to a code distribution

Schematic VAE training with per-image code distributions, prior, sampling and ELBO.

Schematic VAE training with per-image code distributions, prior, sampling and ELBO.
  1. Encode: the image gives a mean and spread for its latent code.
  2. Sample and decode: draw a code and predict the image’s pixel means.
  3. Train: explain the original image and penalize departure from the fixed prior.

The diagram uses ϕ\phi for the encoder weights we call ψ\psi.

The loss has two jobs

Reconstruction cost: retain information that helps explain this image.

Prior KL cost: compare this image’s approximate posterior with the shared prior.

We will derive why these terms belong together.

Encoder · Two vectors for every image

𝝁(𝒙),log⁡𝝈(𝒙)∈ℝd.\boldsymbol\mu(\mathbf x),\ \log\boldsymbol\sigma(\mathbf x)\in\mathbb R^d.

𝝈=exp⁡(log⁡𝝈),𝝈2=exp⁡(2log⁡𝝈).\boldsymbol\sigma=\exp(\log\boldsymbol\sigma),\qquad\boldsymbol\sigma^2=\exp(2\log\boldsymbol\sigma).

qψ(𝒛∣𝒙)=𝒩(𝒛;𝝁,diag⁡(𝝈2)).q_\psi(\mathbf z\mid\mathbf x)=\mathcal N(\mathbf z;\boldsymbol\mu,\operatorname{diag}(\boldsymbol\sigma^2)).

Each batch output has shape (B,d)(B,d): 2d2d scalars per image.

Decoder · Means, then an observation model

gθ(𝒛)∈ℝDis a vector of pixel means.g_\theta(\mathbf z)\in\mathbb R^D\quad\text{is a vector of pixel means.}

pθ(𝒙∣𝒛)=𝒩(𝒙;gθ(𝒛),sx2𝑰).p_\theta(\mathbf x\mid\mathbf z)=\mathcal N(\mathbf x;g_\theta(\mathbf z),s_x^2\mathbf I).

Evaluating the distribution at an image gives one scalar density.

Latent 𝝈\boldsymbol\sigma and pixel spread sxs_x have different roles.

What should training improve?

pθ(𝒙)=∫pθ(𝒙∣𝒛)p(𝒛)d𝒛.p_\theta(\mathbf x)=\int p_\theta(\mathbf x\mid\mathbf z)p(\mathbf z)\,d\mathbf z.

We would like to increase log⁡pθ(𝒙)\log p_\theta(\mathbf x).

The nonlinear decoder makes this integral difficult.

The encoder proposes image-specific codes for a computable bound.

Expose the bound with Bayes’ rule

Fix 𝒙\mathbf x; expectations are over qψ(𝒛∣𝒙)q_\psi(\mathbf z\mid\mathbf x). DKL(qψ(𝒛∣𝒙)∥pθ(𝒛∣𝒙))=𝔼qψ(𝒛∣𝒙)[log⁡qψ(𝒛∣𝒙)−log⁡pθ(𝒛∣𝒙)].\begin{aligned} D_{\mathrm{KL}}(q_\psi(\mathbf z\mid\mathbf x)\|p_\theta(\mathbf z\mid\mathbf x))\\ =\mathbb E_{q_\psi(\mathbf z\mid\mathbf x)}[\log q_\psi(\mathbf z\mid\mathbf x)-\log p_\theta(\mathbf z\mid\mathbf x)]. \end{aligned}

log⁡pθ(𝒛∣𝒙)=log⁡pθ(𝒙∣𝒛)+log⁡p(𝒛)−log⁡pθ(𝒙).\log p_\theta(\mathbf z\mid\mathbf x)=\log p_\theta(\mathbf x\mid\mathbf z)+\log p(\mathbf z)-\log p_\theta(\mathbf x).

The posterior comparison is a derivation tool.

Substitute Bayes and group the terms

For fixed 𝒙\mathbf x, abbreviate q=qψ(𝒛∣𝒙)q=q_\psi(\mathbf z\mid\mathbf x).

DKL(q∥pθ(𝒛∣𝒙))=𝔼q[log⁡q−log⁡p(𝒛)]−𝔼q[log⁡pθ(𝒙∣𝒛)]+log⁡pθ(𝒙).\begin{aligned} D_{\mathrm{KL}}(q\|p_\theta(\mathbf z\mid\mathbf x)) &=\mathbb E_q[\log q-\log p(\mathbf z)]\\ &\quad-\mathbb E_q[\log p_\theta(\mathbf x\mid\mathbf z)]\\ &\quad+\log p_\theta(\mathbf x). \end{aligned}

The first expectation is the prior KL.

Evidence equals bound plus inference gap

ℰ(𝒙)=𝔼q[log⁡pθ(𝒙∣𝒛)]−DKL(q∥p(𝒛)).\mathcal E(\mathbf x)=\mathbb E_q[\log p_\theta(\mathbf x\mid\mathbf z)]-D_{\mathrm{KL}}(q\|p(\mathbf z)).

log⁡pθ(𝒙)=ℰ(𝒙)+DKL(q∥pθ(𝒛∣𝒙))⏟nonnegative gap.\log p_\theta(\mathbf x)=\mathcal E(\mathbf x)+\underbrace{D_{\mathrm{KL}}(q\|p_\theta(\mathbf z\mid\mathbf x))}_{\text{nonnegative gap}}.

Thus ℰ(𝒙)≤log⁡pθ(𝒙)\mathcal E(\mathbf x)\le\log p_\theta(\mathbf x).

The prior KL belongs in the bound; posterior KL measures its gap.

Change the sign to get a loss

ℒ(𝒙)=−ℰ(𝒙)=𝔼q[−log⁡pθ(𝒙∣𝒛)]⏟reconstruction cost+DKL(q∥p(𝒛))⏟prior cost.\mathcal L(\mathbf x)=-\mathcal E(\mathbf x) =\underbrace{\mathbb E_q[-\log p_\theta(\mathbf x\mid\mathbf z)]}_{\text{reconstruction cost}}+\underbrace{D_{\mathrm{KL}}(q\|p(\mathbf z))}_{\text{prior cost}}.

Both networks learn through one objective.

Reconstruction · Multiply pixel densities

For one fixed image and sampled code:

pθ(𝒙∣𝒛)=(2πsx2)−D/2exp⁡[−∥𝒙−gθ(𝒛)∥22sx2].p_\theta(\mathbf x\mid\mathbf z)=(2\pi s_x^2)^{-D/2} \exp\!\left[-\frac{\|\mathbf x-g_\theta(\mathbf z)\|^2}{2s_x^2}\right].

Conditional pixel independence gives a product over pixels.

Negative logarithms turn that product into a sum.

Why squared reconstruction error?

For the fixed Gaussian observation model: NLL⁡(𝒙,𝒛)=∥𝒙−gθ(𝒛)∥22sx2+D2log⁡(2πsx2).\operatorname{NLL}(\mathbf x,\mathbf z)=\frac{\|\mathbf x-g_\theta(\mathbf z)\|^2}{2s_x^2}+\frac D2\log(2\pi s_x^2).

Pixel-density product → log-density sum.

For each image, estimate the average over encoder codes with one draw during training.

The observation model determines the reconstruction term.

Four pixels · Encode, sample, decode

Schematic image: 𝒙=(.7,.4,.1,.9)\mathbf x=(.7,.4,.1,.9); D=4D=4, d=2d=2.

𝝁=(2,−1)\boldsymbol\mu=(2,-1), 𝝈=(.5,.2)\boldsymbol\sigma=(.5,.2), 𝝐=(1,−.5)\boldsymbol\epsilon=(1,-.5).

𝒛=𝝁+𝝈⊙𝝐=(2.5,−1.1).\mathbf z=\boldsymbol\mu+\boldsymbol\sigma\odot\boldsymbol\epsilon=(2.5,-1.1).

Suppose gθ(𝒛)=(.8,.2,.2,.8)g_\theta(\mathbf z)=(.8,.2,.2,.8); sx=.25s_x=.25.

Four pixels · Score the original image

Pixel Observed Mean Scaled squared residual
1 .7 .8 .08
2 .4 .2 .32
3 .1 .2 .08
4 .9 .8 .08

NLL⁡=.56+C\operatorname{NLL}=.56+C, where C=2log⁡(2πsx2)C=2\log(2\pi s_x^2).

Prior KL · Use the Gaussian formula

The encoder gives a diagonal Gaussian with means μk\mu_k and standard deviations σk\sigma_k. The prior is standard normal.

DKL(qψ(𝒛∣𝒙)∥p(𝒛))=12∑k=1d[μk2+σk2−1−2logσk]. D_{\mathrm{KL}}\!\left(q_\psi(\mathbf z\mid\mathbf x)\,\|\,p(\mathbf z)\right) =\frac12\sum_{k=1}^d \left[\mu_k^2+\sigma_k^2-1-2\log\sigma_k\right].

Compute this directly from the encoder outputs. It penalizes means away from zero and variances away from one.

Why neither term works alone

Reconstruction alone: no explicit prior cost for distant, extremely narrow image-specific code distributions.

KL alone: every image could receive the same standard normal and pay zero.

Together, the terms balance image information and prior cost.

Shift and stretch fixed noise

Fixed standard-normal points shifted by a mean and stretched by coordinate standard deviations.

Fixed standard-normal points shifted by a mean and stretched by coordinate standard deviations.

𝒛=𝝁+𝝈⊙𝝐\mathbf z=\boldsymbol\mu+\boldsymbol\sigma\odot\boldsymbol\epsilon, 𝝈=exp⁡(log⁡𝝈)\boldsymbol\sigma=\exp(\log\boldsymbol\sigma).

Algorithm · One VAE training step

  1. Encode: predict 𝝁\boldsymbol\mu and log⁡𝝈\log\boldsymbol\sigma.
  2. Sample: 𝒛=𝝁+exp⁡(log⁡𝝈)⊙𝝐\mathbf z=\boldsymbol\mu+\exp(\log\boldsymbol\sigma)\odot\boldsymbol\epsilon.
  3. Reconstruct: decode 𝒛\mathbf z; score the original image.
  4. Score: add NLL and prior KL; average over the batch.
  5. Update: backpropagate; update both networks; repeat.

Sum pixel and latent contributions within each image.

Batch loss · Average the per-image costs

For image ii, draw 𝒛i\mathbf z_i from qψ(⋅∣𝒙i)q_\psi(\cdot\mid\mathbf x_i).

Ri=−log⁡pθ(𝒙i∣𝒛i),Ki=DKL(qψ(⋅∣𝒙i)∥p). R_i=-\log p_\theta(\mathbf x_i\mid\mathbf z_i),\qquad K_i=D_{\mathrm{KL}}\!\left(q_\psi(\cdot\mid\mathbf x_i)\,\|\,p\right). ℒ̂batch=1B∑i=1B(Ri+Ki).\widehat{\mathcal L}_{\mathrm{batch}}=\frac1B\sum_{i=1}^B(R_i+K_i).

Sum over pixels in RiR_i and over latent coordinates in KiK_i. Then average over images.

Generation and interpolation

How would you choose a method tomorrow?

PCA: saved linear coordinates. t-SNE: inspect neighbors.

K-means: compact groups.

AE: nonlinear reconstruction. VAE: latent probabilistic learning.

Next: construct training relationships for useful representations.

Questions that changed the picture

2006: learned low-dimensional reconstruction — Hinton & Salakhutdinov.

2008: local-affinity maps — van der Maaten & Hinton.

2013/2014: joint latent generation and inference — Kingma & Welling.

History connects methods to the problems they addressed.

AE · t-SNE · AEVB

People of the day: Kingma and Hinton

Instructor-supplied pencil portrait of Diederik P. Kingma, reused from Week 07.

Diederik P. (Durk) Kingma

Variational autoencoders with Max Welling.

Instructor-supplied sketch of Geoffrey Hinton, reused from Week 04.

Geoffrey Hinton

Autoencoders with Ruslan Salakhutdinov; t-SNE with van der Maaten.

Portraits reused from Weeks 07/04. AEVB · Autoencoders (2006) · t-SNE (2008).

References: geometry, grouping and maps

References: learned latent representations

VAE supplement · Generation and interpolation

Return to the VAE overview

After training · Use the fixed decoder

Schematic prior code enters a fixed decoder; a separate lower panel depicts a chosen interpolation path.

Schematic prior sampling and a chosen interpolation path.

Draw a code from the prior. The trained decoder gives observation parameters. A chosen path between codes illustrates interpolation.

Three operations with fixed weights

Operation Algorithm Label
Reconstruct Encode an image; use mean or draw; decode Mean-code or posterior-draw reconstruction
Generate Draw prior code; decode; optionally draw observation Decoder mean or observation draw
Interpolate Choose two codes and (1−α)𝒛(a)+α𝒛(b)(1-\alpha)\mathbf z^{(a)}+\alpha\mathbf z^{(b)} Chosen path, usually decoded means

Prior codes: decoded means and observation draws

Fresh prior code decoder means above Gaussian observation draws using those same codes.

Fresh prior code decoder means above Gaussian observation draws using those same codes.

Fixed trained MNIST model · fresh prior codes · sx=.25s_x=.25.

A grid explores the decoder

Seven-by-seven grid of decoded mean images at chosen latent coordinates.

Seven-by-seven grid of decoded mean images at chosen latent coordinates.

A uniform coordinate grid is not probability-weighted prior sampling.

A chosen path between two inferred codes

Eight decoded means along a line between the first two held-out mean codes.

Eight decoded means along a line between the first two held-out mean codes.

Endpoints are reconstructions; intermediate outputs are not random samples.