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 →
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
- Scores payment transactions for anomaly-based fraud detection by measuring how poorly an autoencoder reconstructs them.
- How deep it goes
- Works through legitimate-only training, per-transaction MSE and MAE, distribution checks, and operational threshold selection.
- Examples
- Uses credit-card transactions, Python error calculations, class-grouped summary statistics, and scatter plots of legitimate and fraudulent scores.
- What you can do after
- Apply it via an autoencoder to score transactions and evaluate thresholds against fraud separation and review capacity.
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 →
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 squared errormeasured by · Mean squared error is the arithmetic mean of the squared differences between corresponding predicted and target numerical values.
- mean absolute errormeasured by · Mean absolute error is the arithmetic mean of the absolute differences between corresponding predicted and reference numerical values.
- anomaly scoreequivalent to · An anomaly score is a numerical measure of how anomalous an observation or event is relative to a reference or expected pattern.
- 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.
- principal component analysisused by · Principal component analysis is a linear dimensionality-reduction technique that transforms data into orthogonal components ordered by the variance they capture.
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.









