What is the purpose of weight initialization in neural networks?
Weight initialization sets the starting values of the model's weights before training. Good initialization helps the model learn faster and avoid problems like vanishing or exploding gradients.
Click to reveal answer
intermediate
Explain the difference between Xavier (Glorot) and He initialization.
Xavier initialization sets weights to keep variance of activations similar across layers, good for sigmoid/tanh activations. He initialization adjusts weights for ReLU activations to better handle their behavior and avoid dying neurons.
Click to reveal answer
beginner
What problem does He initialization help to solve?
He initialization helps prevent the problem of dying ReLU neurons by scaling weights properly so that the variance of outputs stays stable through layers.
Click to reveal answer
beginner
How does random initialization differ from zero initialization, and why is zero initialization usually bad?
Random initialization assigns small random values to weights, breaking symmetry so neurons learn different features. Zero initialization sets all weights to zero, causing all neurons to learn the same thing and preventing effective training.
Click to reveal answer
beginner
Name two common TensorFlow functions used for weight initialization.
Two common TensorFlow initializers are tf.keras.initializers.GlorotUniform() for Xavier initialization and tf.keras.initializers.HeNormal() for He initialization.
Click to reveal answer
Which weight initialization method is best suited for ReLU activation functions?
AHe initialization
BXavier initialization
CZero initialization
DRandom initialization with zeros
✗ Incorrect
He initialization is designed to work well with ReLU activations by scaling weights to keep variance stable.
Why is zero initialization of weights usually a bad idea?
AIt makes the model too complex
BIt causes all neurons to learn the same features
CIt uses too much memory
DIt speeds up training too much
✗ Incorrect
Zero initialization causes symmetry where all neurons update identically, preventing the network from learning diverse features.
What does Xavier initialization aim to keep stable across layers?
ANumber of neurons
BLearning rate
CVariance of activations
DBias values
✗ Incorrect
Xavier initialization keeps the variance of activations stable to help gradients flow well during training.
Which TensorFlow initializer corresponds to Xavier initialization?
Atf.keras.initializers.Zeros()
Btf.keras.initializers.HeNormal()
Ctf.keras.initializers.RandomNormal()
Dtf.keras.initializers.GlorotUniform()
✗ Incorrect
GlorotUniform is TensorFlow's implementation of Xavier initialization.
What problem can occur if weights are initialized with very large values?
AExploding gradients
BVanishing gradients
CFaster convergence
DBetter accuracy
✗ Incorrect
Large initial weights can cause exploding gradients, making training unstable.
Describe why weight initialization matters and name two common strategies.
Think about how starting weights affect learning speed and stability.
You got /3 concepts.
Explain how He initialization helps with ReLU activations and what problem it prevents.
Consider the behavior of ReLU and how weights influence neuron output.
You got /3 concepts.
Practice
(1/5)
1. Which weight initialization strategy is best suited for layers using ReLU activation in TensorFlow?
easy
A. Zeros initializer
B. GlorotUniform initializer
C. RandomNormal initializer with mean 0
D. HeNormal initializer
Solution
Step 1: Understand activation and initialization relation
ReLU activation benefits from initial weights that maintain variance through layers to avoid dying neurons.
Step 2: Match initializer to activation
HeNormal initializer is designed for ReLU, scaling weights to keep variance stable.
Final Answer:
HeNormal initializer -> Option D
Quick Check:
ReLU uses HeNormal [OK]
Hint: Use HeNormal for ReLU activations to keep variance stable [OK]
Common Mistakes:
Choosing GlorotUniform for ReLU layers
Using zeros initializer causing no learning
RandomNormal without scaling causes slow training
2. Which of the following is the correct syntax to initialize weights with GlorotUniform in TensorFlow?
easy
A. tf.keras.initializers.glorot_uniform()
B. tf.initializers.GlorotUniform()
C. tf.keras.initializers.GlorotUniform()
D. tf.keras.initializers.Glorot_uniform()
Solution
Step 1: Recall TensorFlow initializer module
Initializers are accessed via tf.keras.initializers with exact class names.
Step 2: Check correct class name and casing
The correct class name is GlorotUniform with capital G and U, called as a class with parentheses.
Final Answer:
tf.keras.initializers.GlorotUniform() -> Option C
Quick Check:
Correct class name and module path [OK]
Hint: Use exact class name with correct casing and parentheses [OK]
Common Mistakes:
Using lowercase function names instead of class
Missing parentheses after class name
Using wrong module path tf.initializers
3. What will be the output shape and initializer type of the following TensorFlow layer?
Hint: Don't call kernel_initializer() without shape and dtype [OK]
Common Mistakes:
Confusing string initializer with object
Ignoring required arguments for initializer call
Assuming bias_initializer causes this error
5. You want to initialize weights for a model with mixed activations: ReLU in some layers and sigmoid in others. Which strategy best improves training speed and accuracy?
hard
A. Use HeNormal for ReLU layers and GlorotUniform for sigmoid layers
B. Use GlorotUniform for all layers regardless of activation
C. Use RandomNormal with mean 0 and stddev 1 for all layers
D. Use Zeros initializer for all layers to start from zero
Solution
Step 1: Match initializers to activation functions
HeNormal suits ReLU to maintain variance; GlorotUniform suits sigmoid/tanh to avoid saturation.
Step 2: Understand impact on training
Proper matching prevents slow or stuck training and improves accuracy by keeping gradients healthy.
Final Answer:
Use HeNormal for ReLU layers and GlorotUniform for sigmoid layers -> Option A
Quick Check:
Match initializer to activation for best training [OK]
Hint: Match HeNormal to ReLU, GlorotUniform to sigmoid/tanh [OK]
Common Mistakes:
Using same initializer for all activations
Using zeros initializer causing no learning
Using RandomNormal without scaling
Recommended
Ready to prove it?
Pass the test and this pattern moves unknownstrongwhile earning +1 Grip toward your certificate.