Exercises

ex-sp-ch31-01

Easy

Implement the reparameterisation trick: given mu and logvar, sample z.

ex-sp-ch31-02

Easy

Compute the KL divergence between N(mu, sigma^2) and N(0, 1) analytically and numerically.

ex-sp-ch31-03

Easy

Implement the ELBO loss for a VAE with BCE reconstruction and Gaussian KL.

ex-sp-ch31-04

Easy

Create linear and cosine noise schedules for T=1000 steps. Plot alpha_bar_t.

ex-sp-ch31-05

Easy

Implement a simple GAN discriminator for 28x28 images.

ex-sp-ch31-06

Medium

Train a VAE on MNIST and visualise latent space with 2D latent dim.

ex-sp-ch31-07

Medium

Implement latent space interpolation between two images in a trained VAE.

ex-sp-ch31-08

Medium

Train a DCGAN on MNIST and generate sample images.

ex-sp-ch31-09

Medium

Implement DDPM training: forward noising and noise prediction with a U-Net.

ex-sp-ch31-10

Medium

Implement DDPM sampling (reverse process) and generate images from noise.

ex-sp-ch31-11

Hard

Implement flow matching for 2D toy data (e.g., two moons). Visualise the learned flow.

ex-sp-ch31-12

Hard

Implement beta-VAE and show how increasing beta disentangles latent dimensions.

ex-sp-ch31-13

Hard

Implement KL annealing to prevent posterior collapse in a VAE.

ex-sp-ch31-14

Hard

Add spectral normalisation to a GAN discriminator and compare training stability.

ex-sp-ch31-15

Challenge

Train a diffusion model to generate wireless channel realisations and evaluate with channel statistics.

ex-sp-ch31-16

Challenge

Implement conditional diffusion: generate channels conditioned on SNR or user location.