An encoder is the first part of an autoencoder: it transforms an input into a compact representation. Its layers reduce the data to progressively fewer neurons, ending at a bottleneck whose values form an embedding, or latent representation. A decoder then attempts to reconstruct the original input from that representation. section 16.2.1
Figure 16.2 Example of an AE. The neural network learns to condense any input to as many elements as appear in the middle layer and then reconstruct the data to its original values.
The diagram shows where compression ends and reconstruction begins: the narrow middle layer is the encoder’s output. section 16.2.1
For tabular data, an autoencoder processes one row at a time, with inputs corresponding to columns; for images, inputs can correspond to pixels. The goal is not to predict a separate target but to reproduce the input with little loss. Reconstruction error can then help identify potential outliers, rather than establishing that every poorly reconstructed item is a meaningful anomaly. section 16.2.1 section 16.4
Image encoder
A CIFAR10 example normalizes images and defines a TensorFlow Keras encoder with convolutional layers, a flattening step, and a dense layer producing a 1,024-value encoding. An alibi-detect autoencoder then reconstructs images: a boat image is reconstructed closely, while a noise-perturbed version has high reconstruction error and is flagged as an outlier. section 16.4
An encoder also appears in a bidirectional generative adversarial network (BiGAN). There it acts as an inverse mapper, taking data toward the latent vector used by the generator. At prediction time, the encoded data can pass through the generator for a reconstruction comparison and through the discriminator for another outlier signal. This is a related role, not the autoencoder’s symmetric encoder–decoder arrangement. section 16.2.3




















