Reconstruction loss
Reconstruction loss is a measure of the discrepancy between an input or observation and the output a model reconstructs from it or its representation.
Outlier Detection in Python
Reconstruction error is a measure of the discrepancy between an observation and the output reconstructed from its encoded or generated representation.
- How it is used
- Scores observations for outlier detection by measuring how poorly learned patterns reconstruct them.
- How deep it goes
- Explains PCA’s Euclidean scoring and encoder–decoder reconstruction, then compares model choices without deriving a universal loss formula.
- Examples
- Contrasts a PCA point that breaks a feature relationship with a noisy image reconstructed by an autoencoder.
- What you can do after
- Apply it via PyOD or alibi-detect to score candidate outliers, while checking preparation, model capacity, and comparative performance.
Read how Outlier Detection in Python explains reconstruction loss →
Math and Architectures of Deep Learning
The discrepancy between an input and its reconstruction.
- How it is used
- Measures round-trip fidelity while training autoencoders to learn compact latent representations.
- How deep it goes
- Defines the input–reconstruction discrepancy, demonstrates MSE and binary cross-entropy implementations, and relates it to ELBO regularization.
- Examples
- Uses PCA projection onto a best-fit plane and MNIST image reconstruction with autoencoders and VAEs.
- What you can do after
- Apply it via PyTorch MSE or binary cross-entropy to train and compare autoencoder-style reconstructions.
Read how Math and Architectures of Deep Learning explains reconstruction loss →
Graph Neural Networks in Action
A measure of the discrepancy between an input and the output reconstructed from its latent representation.
- How it is used
- Trains decoders to reproduce molecular graphs or predict future poses from encoded graph-based data.
- How deep it goes
- Defines reconstruction error through an autoencoder, then implements adjacency binary cross-entropy and scaled pose mean squared error without a formal derivation.
- Examples
- Uses molecular adjacency matrices with QED prediction and sensor-pose trajectories with next-timestep targets.
- What you can do after
- Apply it via PyTorch loss functions when training molecular graph generators or neural relational inference models.
Read how Graph Neural Networks in Action explains reconstruction loss →
Build AI Drug Discovery Pipelines
A reconstruction loss quantifies the discrepancy between an input and the output reconstructed from its encoded representation.
- How it is used
- Trains molecular autoencoders to retain enough information to reconstruct their input SMILES strings.
- How deep it goes
- Explains token-level cross-entropy, tensor reshaping, and padding exclusion in a PyTorch loss function.
- Examples
- Uses molecular SMILES sequences and decoder token scores to illustrate reconstruction.
- What you can do after
- Apply it via PyTorch cross-entropy to decoder scores and target token IDs while ignoring padding.
Read how Build AI Drug Discovery Pipelines explains reconstruction loss →
Delivering Machine Learning Projects: From design to deployment
A reconstruction error is the discrepancy between an input and the output reconstructed from its encoded representation.
- How it is used
- Uses reconstruction errors as an anomaly-detection feature for regional news articles.
- How deep it goes
- Defines reconstruction error as input-output discrepancy and applies it operationally, without detailing the loss formula or autoencoder internals.
- Examples
- Measures reconstruction errors for individual news articles against an autoencoder trained on regional historical articles.
- What you can do after
- Diagnose anomalous articles by comparing their reconstructions with their inputs.
Build a Text-to-Image Generator (from Scratch)
A reconstruction loss measures the discrepancy between input data and the data reconstructed from its latent representation.
- How it is used
- Trains encoder–decoder models to preserve image content through latent compression and reconstruction.
- How deep it goes
- Explains pixel-wise mean absolute error, backpropagation, and its combination with KL divergence or quantization loss.
- Examples
- Uses high-resolution color images, pixel-wise mean absolute error, latent grids, and codebook-based VQ-VAE reconstructions.
- What you can do after
- Diagnose reconstruction quality by comparing original and decoded images and tracking the loss used for parameter updates.
Read how Build a Text-to-Image Generator (from Scratch) explains reconstruction loss →
Learn Generative AI with PyTorch
The loss term that measures pixel-level mismatch between an input image and its reconstruction in a VAE.
- How it is used
- Trains autoencoders and VAEs to make reconstructed images resemble their inputs at the pixel level.
- How deep it goes
- Defines pixel-wise mean squared error and demonstrates its training-loop implementation, stopping short of alternative reconstruction metrics.
- Examples
- Uses handwritten-digit reconstructions and human-face reconstructions to compare inputs with decoder outputs.
- What you can do after
- Apply it via PyTorch by calculating reconstruction error, backpropagating it, and inspecting reconstructed images.
Read how Learn Generative AI with PyTorch explains reconstruction loss →
Financial AI in Practice
A reconstruction error is the difference between an input and the output produced when a model attempts to reconstruct that input.
- How it is used
- Uses reconstruction error as an anomaly score for potential transaction fraud.
- How deep it goes
- Works through per-transaction error calculation, distribution checks, and threshold selection without prescribing a universally correct cutoff.
- Examples
- Compares reconstruction errors for legitimate and fraudulent credit card transactions using class summaries and scatter plots.
- What you can do after
- Apply it via NumPy and pandas to score test transactions and examine labeled error distributions.
Read how Financial AI in Practice explains reconstruction loss →
Deep Learning with R, Third Edition
A reconstruction loss measures the discrepancy between original data or representations and their model-generated reconstructions.
- How it is used
- Trains self-supervised models to recover original data from partial or compressed representations.
- How deep it goes
- Defines the metric and its training role, but does not specify a particular numerical error formula.
- Examples
- Uses partial internet-scale data recovery and decoded image reconstruction as concrete examples.
- What you can do after
- Evaluate/understand how reconstruction objectives support representation learning and VAE image generation.
Read how Deep Learning with R, Third Edition explains reconstruction loss →
Evolutionary Deep Learning: Genetic algorithms and neural networks
Reconstruction loss is a loss value measuring the discrepancy between an input example and the output reconstructed from it.
- How it is used
- Measures input-output fidelity while training autoencoders and contributes one term of a VAE objective.
- How deep it goes
- Defines MSE and binary cross entropy implementation choices, combines them with KL divergence, and defers statistical-distance theory.
- Examples
- Demonstrates MSE and binary cross entropy inside a Keras VAE loss, with normalized metrics for comparing their scales.
- What you can do after
- Implement reconstruction and combined VAE losses in Keras, then compare MSE and binary cross entropy during training.
Deep Learning with Python, Third Edition
A loss that measures how well a model reproduces its input or a corrupted version of it.
- How it is used
- Trains variational autoencoders to make decoded samples match their initial inputs.
- How deep it goes
- Explains its training role and contrasts it with regularization, but does not specify a reconstruction formula.
- Examples
- Uses an encoder-decoder image pipeline and an autoencoder diagram mapping x to a reconstructed x'.
- What you can do after
- Builds a VAE training objective that compares decoded images with their original inputs.
Read how Deep Learning with Python, Third Edition explains reconstruction loss →
Also covered in
What to know first
- autoencoderAn autoencoder is a neural network that encodes input data into an internal representation and decodes it to reconstruct the input or an approximation.
- meanThe mean is a measure of central location equal to the arithmetic average of numerical observations, or the probability-weighted average of a random variable’s possible values.
- mean squared errorMean squared error is the arithmetic mean of the squared differences between corresponding predicted and reference numerical values.
- normal distributionA normal distribution is a continuous probability distribution with a symmetric, bell-shaped density determined by its mean and variance.
Related concepts
- variational autoencoderused by · A variational autoencoder is a generative neural network that learns a probabilistic latent representation of data and decodes samples from it to reconstruct or generate data.
- mean absolute errormeasured by · Mean absolute error is the arithmetic mean of the absolute differences between corresponding predicted and observed numerical values.
- mean squared errormeasured by · Mean squared error is the arithmetic mean of the squared differences between corresponding predicted and reference numerical values.
- anomaly scoreequivalent to · An anomaly score is a numerical measure of how unusual an item is relative to expected patterns or a specified reference.
- autoencoderproduced by · An autoencoder is a neural network that encodes input data into an internal representation and decodes it to reconstruct the input or an approximation.
- OutlierAEmeasured by · OutlierAE is an alibi-detect detector class that identifies outliers using an autoencoder's reconstruction error.
Questions about reconstruction loss
What is reconstruction loss?
Reconstruction loss is a measure of the discrepancy between an input or observation and the output a model reconstructs from it or its representation.
Which Manning books explain reconstruction loss?
Outlier Detection in Python, Math and Architectures of Deep Learning, Graph Neural Networks in Action, Build AI Drug Discovery Pipelines, Delivering Machine Learning Projects: From design to deployment, Build a Text-to-Image Generator (from Scratch), Learn Generative AI with PyTorch, Financial AI in Practice and 3 more.
What should I know before learning reconstruction loss?
Manning books that teach reconstruction loss usually introduce autoencoder, mean, mean squared error and normal distribution first.
What is reconstruction loss also called?
Reconstruction loss is also called reconstruction error.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.










