AE Machine Learning for Health Research
Interactive representation-learning lab

Medical Autoencoder Explainer

A tiny convolutional autoencoder compresses 28×28 blood-cell images through a 32-number bottleneck — with no cell-type labels in the loss. Click feature maps to see encode / decode, then colour the same latent space by biology, reconstruction error, or a simulated acquisition site.

1. Pick a microscopy tile

Real BloodMNIST test images (white-blood-cell / platelet tiles). The autoencoder never saw a class label. This gallery only drives section 2 below — it is not connected to the latent-space playground.

Loading model…

2. Follow the image through the autoencoder

This is an hourglass, not a mirror. The encoder shrinks space with 3×3 stride-2 convolutions (28→14→7). The decoder is a learned upsample with 4×4 transposed convolutions (7→14→28) — not the encoder run backwards. Hover a map to see which previous maps feed it. Click to open the math and play a sliding window, as in the CNN explainer.

Click a pixel on the input (or any map) to pin a location through the hourglass.
Original
—
Reconstruction
decoder output
|difference|
MSE —

MSE is dominated by size, stain, and coarse shape. A visually “good” reconstruction can still drop the tiny nuclear details a haematologist uses.

Δz = 0 · click a purple bar, then drag — reconstruction updates live
feature maps (− / 0 / +) showing 8 of 16 / 32 conv channels · all 32 latent bars

3. Play with the latent space

PCA and UMAP are viewing devices, not biological axes. This playground is independent of the gallery above: click a point here to pick a cell, then Set A / Set B and interpolate. Colour by simulated site to see that unsupervised latents also encode acquisition.

Click a point, then Set A or Set B
A / B not set
Cell A
Decoded z(α)
Cell B

Pixel cross-fade (blends the two photographs — not a decode):

α = 0.00

Site A / Site B do not exist in BloodMNIST. Half the cohort is given a mild stain/illumination shift so you can see that the encoder stores technical variation as well as morphology.

What this architecture is doing in clinic-shaped language

No labels, still clustered

The loss never mentions cell type. If lymphocytes separate from neutrophils, it is because morphology explains pixels — not because the model “knows” haematology. See the autoencoder tutorial.

Pretty ≠ preserved

MSE averages over every pixel. A small nuclear inclusion barely moves the loss. Reconstruction quality is a proxy, not a guarantee of clinically useful information.

Latents encode the scanner too

Unsupervised compression keeps whatever explains variance: biology and stain, illumination, site. That is why derived phenotypes can fail to transport. See external validation.

Decoder ≠ inverse encoder

A symmetric autoencoder would undo each layer with the same kernel size. This one does not: 3×3 stride-2 down, 4×4 transposed-conv up, so 7×7 lands back on 28×28. The upsample is learned, not a fixed “unpool.”

PCA / UMAP are not axes of disease

They flatten 32 numbers so you can look. Distances are not clinically calibrated, and a 2D picture is not the representation. See the PCA guide and the CNN explainer for the supervised sister lab.

Teaching model only. About 115 thousand parameters on 28×28 tiles, trained without labels. It is not a medical device, not validated for care, and not a substitute for a pathologist or hematologist. Cell-type labels here are morphological classes, not patient diagnoses. Site A/B are simulated.

Layer math

Press Esc or the Close button (top right) to dismiss.