L15-18-Build and Train Deep Learning Models
Chapter Overview
- In this chapter, we learn about Deep Neural Network (DNN) concepts, their training setup, optimization techniques, weight initialization methods, regularization approaches, hyperparameter optimization, and data preprocessing methods.
DNN Setup for Training
Activation Function: Non-linear functions applied to neuron outputs to enable complex representations. Non-linear mapping is critical for effective DNN performance.
Common activation functions:
- Sigmoid:
- Formula: ( a(x) = \frac{1}{1+e^{-x}} )
- Advantages: Bounded output.
- Problems: Gradient vanishing issue, not zero-centered.
- Tanh:
- Formula: ( a(x) = \tanh(x) )
- Advantages: Bounded & zero-centered output.
- Problems: Gradient vanishing.
- ReLU (Rectified Linear Unit):
- Formula: ( a(x) = \max(0,x) )
- Advantages: Computationally efficient, biologically plausible.
- Problems: Dead neurons, non-zero-centered output.
- Leaky ReLU:
- Formula: ( a(x) = \max(\alpha x, x) ) where ( \alpha \in (0, 1) )
- Advantages: No dead neurons.
- Problems: Non-zero-centered output.
- SoftMax: Utilized for multi-class classification.
- Formula: ( S(yi) = \frac{e^{yi}}{\sum{j} e^{yj}} )
- Generates probability distributions for classification.
- Exponential Linear Unit (ELU): Provides robustness in negative saturation.
- Swish: Found to improve performance in smaller DNN models, has a non-monotonic structure.
Neural Network Design:
Best practices include having a network design that is 'thinner at the top and wider at the bottom'. Wider architectures compensate for loss of information.
- Filter numbers conventionally should be in the form of ( 2^n ).
- Certain architectural features:
- Utilize more convolutions between down-sampling modules.
- Start with ReLU and use alternatives as needed.
- Employ dropout strategically within layers but not after the output layer.
Optimization Techniques
- Stochastic Gradient Descent (SGD): Optimizes with calculated gradients. Can get stuck in local minima.
- Momentum: Enhances convergence speed by accumulating previous gradients to overshoot local minima.
- Nesterov Momentum: Adjusts gradients to consider momentum ahead of the current step.
- Adagrad: Utilizes adaptive learning rates, but may lead to reduced learning rates over time.
- RMSprop: Uses a moving average of gradients to improve learning rate dynamics.
- Adam: Integrates features from both momentum and RMSprop, noted for fast convergence but can oscillate towards the end.
Weight Initialization Techniques
- Proper initialization prevents issues like dead neurons.
- Random Initialization: Zero mean, small standard deviation; does not leverage structural information.
- Xavier Initialization: Accounts for input/output connections; effective for linear/quasi-linear activations.
- Variance Scaling (MSRA): Scales initialization depending on network connections, useful for DNN designs accommodating output filter variations.
Regularization
- Helps with overfitting:
- L-norm Regularization: Adds penalties for weight size (L1 for sparsity and L2 for weight minimization).
- Dropout: Randomly sets neurons to zero during training, promoting better generalization. Used primarily in fully connected layers.
- Batch Normalization: Maintains stable activation distributions, allowing training at larger learning rates and acting as a form of regularization.
Hyperparameter Optimization
- Importance of tuning hyperparameters such as learning rates, batch sizes, regularization methods.
- Learning rate tuning is critical for effective model training.
Data Preprocessing Techniques
- Normalize input data to have zero mean and unit variance for optimal training.
- Engage in data augmentation strategies to enhance model robustness through methods like random shifting or flipping of images.
- Random Erasing: Occludes sections of training images as a further augmentation strategy.
Conclusion
- Comprehensive understanding of DNN structure and optimization techniques leads to effective model training and implementation.