Discriminator
A discriminator is the model component of a generative adversarial network that distinguishes real data from data generated by its generator.
Learn Generative AI with PyTorch
The GAN component that learns to distinguish real training images or samples from fake generated ones.
- How it is used
- Judges real and generated samples during adversarial training so the generator can improve.
- How deep it goes
- Builds dense and convolutional discriminators and walks through their training updates, without deriving adversarial objectives mathematically.
- Examples
- Uses exponential-growth pairs, multiples-of-five samples, grayscale clothing images, and color anime faces.
- What you can do after
- Build it from scratch in PyTorch, train it against real and generated batches, and retain the generator for sampling.
Read how Learn Generative AI with PyTorch explains discriminator →
Inside Deep Learning: Math, Algorithms, Models
In a GAN, the neural network that scores whether an example is real or generated.
- How it is used
- Scores real and generated examples to provide the adversarial training signal that guides the generator.
- How deep it goes
- Explains binary and Wasserstein losses, alternating updates, gradient penalties, and convolutional design choices; defers broader architectural search.
- Examples
- Uses MNIST digits, a toy two-dimensional grid, BCEWithLogitsLoss, and a convolutional discriminator with average pooling.
- What you can do after
- Build and train fully connected or convolutional discriminators with PyTorch GAN and WGAN-GP loops.
Read how Inside Deep Learning: Math, Algorithms, Models explains discriminator →
Evolutionary Deep Learning: Genetic algorithms and neural networks
A GAN discriminator is the neural-network component of a generative adversarial network that distinguishes generated samples from real data.
- How it is used
- Supplies real-versus-fake feedback that drives generator improvement in adversarial image generation.
- How deep it goes
- Implements a convolutional Keras classifier and alternating training loop, then examines imbalance and vanishing-gradient symptoms.
- Examples
- Uses single-class digit images, a convolutional Keras model, face-versus-not-face reuse, and an optimizer swap that exposes vanishing gradients.
- What you can do after
- Build it from scratch as a Keras convolutional discriminator, train it against real and generated batches, and recognize imbalance symptoms.
Read how Evolutionary Deep Learning: Genetic algorithms and neural networks explains discriminator →
Build a Text-to-Image Generator (from Scratch)
A discriminator is a neural-network component that distinguishes generated samples from samples drawn from the target data distribution.
- How it is used
- Distinguishes real data from generated data while adversarially improving image realism.
- How deep it goes
- Defines inputs, classification, minimax competition, and VQGAN integration without detailing internal discriminator architecture.
- Examples
- Uses real training images, generated samples, and VQ-VAE reconstructions as real-versus-fake classification cases.
- What you can do after
- Evaluate how adversarial classification improves perceptual realism in GAN and VQGAN image generation.
Read how Build a Text-to-Image Generator (from Scratch) explains discriminator →
Grokking Machine Learning
A discriminator is the component of a generative adversarial network that distinguishes real data from synthetic data.
- How it is used
- Distinguishes real images from generator-produced images while a GAN is trained.
- How deep it goes
- Defines the role and training inputs, but does not detail the discriminator’s architecture or objective.
- Examples
- Uses generated human faces and the Which Face Is Real? challenge to illustrate real-versus-fake judgments.
- What you can do after
- Evaluate generated images by attempting to distinguish them from real images.
Outlier Detection in Python
A discriminator is the component of a generative adversarial network that distinguishes real observations from generated observations.
- How it is used
- Uses adversarial real-versus-synthetic classification as a signal for detecting outliers.
- How deep it goes
- Explains the discriminator’s adversarial training, inputs, equilibrium, and outlier-detection role, but does not derive its network architecture.
- Examples
- Uses real data X, generated data G(z), random noise z, GAN diagrams, and a PyOD ALAD implementation.
- What you can do after
- Diagnose outliers by applying a trained discriminator and, in BiGANs, combining its probabilities with reconstruction error.
Read how Outlier Detection in Python explains discriminator →
Introduction to Generative AI, Second Edition
A discriminator is the component of a generative adversarial network that evaluates whether data is authentic or synthetic.
- How it is used
- Evaluates synthetic data against training examples within a generative adversarial network.
- How deep it goes
- Defines the component and its competitive feedback loop but does not explain implementation details.
- Examples
- Uses counterfeit artworks and synthetic images to illustrate authenticity judgments.
- What you can do after
- Understand how adversarial feedback helps distinguish generated data from authentic data.
Read how Introduction to Generative AI, Second Edition explains discriminator →
Data Without Labels
The classification component of a generative adversarial network that distinguishes real data from data produced by the generator.
- How it is used
- Uses binary classification to evaluate generated data and provide training feedback within a GAN.
- How deep it goes
- Explains inputs, probabilities, loss, parameter updates, and iterative training without detailing network architecture or implementation code.
- Examples
- Uses real datasets, generated datasets, random noise, real-or-fake probabilities, and binary cross-entropy loss as working examples.
- What you can do after
- Evaluate generated samples and understand how discriminator feedback improves a GAN’s generator.
Related concepts
- generative adversarial networkpart of · A generative adversarial network is a generative model with a generator and discriminator trained in competition, enabling the generator to produce samples resembling a target dataset or distribution.
- classifierkind of · A classifier is a predictive computational model that assigns inputs to one or more discrete classes or categories.
- optimizerconfigured by · An optimizer is an algorithm or procedure that adjusts model parameters or other decisions to improve an objective function.
- criticalternative to · A critic is the scoring network in a Wasserstein generative adversarial network that assigns realness scores rather than real-or-fake probabilities.
- MuseGANhas part · A music-generation GAN variant in this chapter that produces multidimensional representations of musical pieces for later conversion to MIDI.
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.







