Deep Learning Assignment Overview
Deep Learning Assignment Overview
Increasing the number of neurons in a hidden layer can lead to better model performance on training data by allowing the network to capture more complex patterns. However, it also increases the risk of overfitting, where the model learns noise and details from the training data that are not generalizable to unseen data, resulting in a high training accuracy but poor test accuracy. In one experiment, overfitting occurred when using 8 neurons per layer, resulting in 99% accuracy on train data but only 75% on test data. Reducing neurons to 3 per layer and adding L2 regularization helped improve generalization, raising test accuracy to 82% .
Cross-Entropy Loss is preferred for classification tasks because it directly aligns with the softmax outputs of networks, minimizing the divergence between predicted and true probability distributions. This loss function effectively measures the performance of a classification model whose output is a probability value between 0 and 1. It penalizes incorrect classifications by measuring the absolute difference between the actual class and the predicted probability, encouraging the model to improve its predictive accuracy in matching the true class probabilities .
Gated Recurrent Units (GRUs) are considered more efficient than Long Short-Term Memory (LSTM) networks because they have fewer trainable parameters due to their simpler architecture. GRUs combine the forget and input gates into a single update gate and merge the cell state and hidden state, reducing the complexity and computational load. Practitioners might prefer GRUs over LSTMs in scenarios where computational resources are limited or when faster training is required. However, LSTMs might be preferred in tasks with longer sequences and more complex dependencies, where the intricate control over information flow they provide can lead to better performance .
The vanishing gradient problem affects deep neural networks by causing gradients to become exceedingly small during backpropagation, particularly across multiple layers. This results in slow convergence and difficulty in training deep networks effectively, as early layers learn very little due to minimal weight updates. Activation functions like the Rectified Linear Unit (ReLU) and its variants are typically chosen to mitigate this issue. ReLU, being non-saturating for positive input regions (x > 0), helps avoid this problem by maintaining gradients that do not vanish. Additionally, the Hyperbolic Tangent (Tanh) can also be used for its zero-centered, albeit saturating, outputs, providing balanced gradient flow in networks like RNNs .
Pooling layers in Convolutional Neural Networks (CNNs) play a crucial role in reducing the spatial dimensions of the input data, which decreases the computational load required for further processing layers. They work by selecting the maximum or average value from small sub-regions of the layer output, thereby effectively condensing the feature map. This not only improves computational efficiency but also contributes to the translational invariance of the model, as pooling reduces sensitivity to small translations and transformations of the input data .
Balancing model complexity with regularization strategies is crucial in neural network training because while a complex model with many layers and neurons can capture intricate data relationships, it also risks overfitting to the training dataset, thus failing to generalize well to new, unseen data. Regularization methods, such as L2 regularization, weight decay, or dropout, are essential to mitigate overfitting by penalizing complex models and thereby encouraging simpler models that generalize better. This balance was evidenced in an experiment where reducing the number of neurons and applying L2 regularization improved test accuracy, highlighting the importance of preventing overfitting by controlling complexity .
Recurrent Neural Networks (RNNs) differ from Fully Connected Networks (FCNs) in their ability to process sequential data through loops that pass hidden states across time steps, capturing temporal dependencies. This allows them to handle variable-length sequences like sentences, which FCNs cannot manage efficiently as they treat each input as independent. RNNs, however, suffer from the vanishing gradient problem, which Long Short-Term Memory networks (LSTMs) address using gated mechanisms that enable the network to retain long-term memory and effectively use past information over extended sequences .
The "Dying ReLU" problem occurs when neurons in a network become inactive and consistently output zero for any input. This situation can prevent the affected neurons from contributing to model training and improvement, ultimately hindering learning. Variations like Leaky ReLU address this issue by allowing a small, non-zero, and constant gradient even when the unit is not active (i.e., the input is negative). This is achieved using a function such as f(x) = max(0.01x, x), ensuring neurons do not entirely "die" by propagating small updates through these neurons .
The Rectified Linear Unit (ReLU) activation function is advantageous because it avoids the vanishing gradient problem by being non-saturating for positive inputs (x > 0) and is computationally cheap due to the absence of exponential operations. However, it suffers from the "dying ReLU" issue, where neurons may become inactive and consistently output zero for negative inputs. Conversely, the Hyperbolic Tangent (Tanh) function provides zero-centered outputs, which can help in faster convergence and better mitigate vanishing gradients compared to the Sigmoid function. Yet, it saturates for extreme inputs leading to near-zero gradients, which can impede learning. Tanh is often preferred in RNNs for balanced gradient flow .
Convolutional Neural Networks (CNNs) maintain spatial relationships within image data through the use of convolutional layers that apply filters to detect local patterns, such as edges and textures, by sliding over regions of the input. These layers extract hierarchical features that evolve from simple to complex, such as from edges to shapes to objects. Additionally, pooling layers (either max or average pooling) reduce the spatial dimensions of the data, which improves computational efficiency and provides some translational invariance. Unlike fully connected networks that treat each pixel independently, CNNs exploit spatial locality by leveraging weight sharing, which drastically reduces the number of parameters .