A GAN, or Generative Adversarial Network, is a pair of computer programs that learn together. One tries to create fake data, and the other tries to spot if the data is fake or real. They improve by competing with each other.
Click to reveal answer
beginner
What are the two main parts of a GAN?
The two main parts are the Generator, which makes fake data, and the Discriminator, which checks if data is real or fake.
Click to reveal answer
beginner
Why do we use random noise as input to the Generator?
Random noise is like a blank canvas. The Generator learns to turn this noise into data that looks real, like images or sounds.
Click to reveal answer
beginner
What does the Discriminator output represent?
The Discriminator outputs a number between 0 and 1 that shows how sure it is that the input data is real (close to 1) or fake (close to 0).
Click to reveal answer
beginner
What is the goal of training a GAN?
The goal is for the Generator to make data so real that the Discriminator cannot tell it is fake, and for the Discriminator to get better at spotting fakes. This makes both improve.
Click to reveal answer
What does the Generator in a GAN do?
ACreates fake data from random noise
BClassifies data as real or fake
CPrepares training labels
DEvaluates model accuracy
✗ Incorrect
The Generator creates fake data starting from random noise to fool the Discriminator.
What is the Discriminator's main task?
AGenerate new data samples
BDetect if data is real or fake
CAdd noise to data
DReduce model loss
✗ Incorrect
The Discriminator learns to tell if data is real or generated (fake).
Which loss function is commonly used to train GANs?
ACross-Entropy Loss
BMean Squared Error
CHinge Loss
DL1 Loss
✗ Incorrect
Cross-Entropy Loss is commonly used to train both Generator and Discriminator in GANs.
What input does the Generator receive?
ALabels
BReal images
CRandom noise vectors
DDiscriminator outputs
✗ Incorrect
The Generator takes random noise vectors as input to create fake data.
During GAN training, what happens when the Discriminator gets too good?
ADiscriminator generates data
BTraining stops
CGenerator improves faster
DGenerator struggles to fool Discriminator
✗ Incorrect
If the Discriminator is too good, the Generator finds it hard to fool it, which can slow training.
Explain how the Generator and Discriminator work together in a GAN.
Think of a forger and a detective improving their skills.
You got /4 concepts.
Describe the training process of a simple GAN step-by-step.
Focus on alternating training of two models.
You got /5 concepts.
Practice
(1/5)
1. In a simple GAN, what is the main role of the generator?
easy
A. To classify data as real or fake
B. To create fake data that looks real
C. To optimize the loss function of the discriminator
D. To preprocess the input data
Solution
Step 1: Understand the generator's purpose
The generator's job is to produce fake data samples that resemble real data.
Step 2: Differentiate from discriminator's role
The discriminator's role is to distinguish real from fake data, not the generator's.
Final Answer:
To create fake data that looks real -> Option B
Quick Check:
Generator = create fake data [OK]
Hint: Generator makes fake data to fool discriminator [OK]
Common Mistakes:
Confusing generator with discriminator
Thinking generator classifies data
Assuming generator preprocesses data
2. Which of the following is the correct way to define the input noise vector for the generator in TensorFlow?
easy
A. noise = tf.random.normal([batch_size, noise_dim])
B. noise = tf.zeros([batch_size, noise_dim])
C. noise = tf.ones([batch_size, noise_dim])
D. noise = tf.random.uniform([noise_dim])
Solution
Step 1: Identify typical noise input shape
The noise vector usually has shape [batch_size, noise_dim] to generate a batch of samples.
Step 2: Check correct TensorFlow function
tf.random.normal generates random normal noise, commonly used for GAN input.
Final Answer:
noise = tf.random.normal([batch_size, noise_dim]) -> Option A
Quick Check:
Use tf.random.normal with batch size and noise dim [OK]
Hint: Use tf.random.normal with batch and noise dims [OK]
Common Mistakes:
Using tf.zeros or tf.ones which produce constant noise
Missing batch dimension in noise shape
Using tf.random.uniform without batch dimension
3. Given this TensorFlow code snippet for a GAN training step, what will be the shape of fake_output?