Deep Learning Assignment Guide
Deep Learning Assignment Guide
Two techniques typically used to handle data imbalance are resampling and the use of appropriate algorithms. Resampling involves either oversampling the minority class (e.g., using methods like SMOTE) or undersampling the majority class to balance the class distribution . Additionally, employing specialized algorithms such as cost-sensitive learning, where different misclassification costs are assigned implicitly by weighting negative examples (non-fraudulent) higher, can help in providing balanced learning .
The vanishing gradient problem hinders the learning dynamics of deep neural networks by causing gradients to decay to near-zero values as they propagate backwards through the layers. This diminishes the updates for early-layer weights and restricts the network’s ability to learn deep hierarchical features . Solutions include using activation functions like ReLU, which maintain consistent gradients, and initializing weights using methods like Xavier or He uniform initialization to prevent small initial values . Batch normalization is also a common technique, as it normalizes inputs across a mini-batch, stabilizing the learning process .
LSTM and GRU models generally outperform traditional RNNs for tasks involving long-term dependencies due to their gating mechanisms that control information flow across time steps. LSTMs have input, output, and forget gates, allowing them to maintain, update, and forget information selectively, whereas GRUs use reset and update gates, achieving similar control with fewer parameters . These mechanisms prevent the vanishing gradient issue by enabling the model to maintain useful information over extended sequences, unlike traditional RNNs, which struggle with gradient decay .
RNNs struggle with long-term dependencies due to vanishing or exploding gradients. When gradients are backpropagated through many layers in an RNN, they may become exceedingly small (vanishing) or large (exploding), impeding the learning of long-range information . LSTM and GRU architectures mitigate this problem by introducing gating mechanisms that control information flow. A key feature is the forget gate, which allows these cells to retain or discard information from previous time steps selectively, thus maintaining long-term dependencies more effectively .
Deep neural networks differ from shallow neural networks primarily in depth, i.e., the number of layers. Deep networks have multiple hidden layers enabling them to learn complex hierarchical representations of data, whereas shallow networks typically have only one or two hidden layers offering limited representational capacity . In image recognition tasks, deep architectures generally outperform shallow ones because they can capture intricate patterns and features across various levels of abstraction, such as edges, textures, and objects. This capability allows deep networks to generalize better and accurately identify images .
In a CNN for handwritten digit recognition, convolutional layers apply filters to extract spatial hierarchies of features, such as edges or textures, from input images . Pooling layers reduce dimensionality, retaining important structural features while decreasing computational load and risk of overfitting . Fully connected layers interpret the learned features to classify the images into digits. Increasing the number of filters may enhance feature extraction but increases computation and memory requirements. Adding more pooling layers could further reduce dimensionality and computation but might also lose important information. Larger kernel sizes capture broader features but may miss finer details .
Essential considerations for constructing evaluation metrics for a highly imbalanced dataset include focusing on metrics that reflect the model's ability to correctly identify minority class instances, such as fraud cases, rather than overall accuracy, which can be misleading . Precision and recall assess different aspects of detection capability, with precision highlighting the proportion of correctly identified positive instances and recall capturing the detection rate of actual positives. The F1-score combines these metrics to provide a balanced view. Adjusting the classification threshold and using ROC and precision-recall curves are also crucial for a nuanced understanding of performance .
Increasing the number of filters in a CNN enhances feature extraction capability by capturing more patterns but can lead to higher computational requirements and memory usage . Adding more pooling layers reduces the spatial dimension progressively, which speeds up computations and decreases overfitting risk but might lead to loss of important information. Larger kernel sizes can capture broader context in images, which may increase the network's ability to generalize; however, they also involve more parameters, which could complicate the model and slow down the training .
The output of the neuron is calculated as follows: sigmoid(1.5 * 0.8 - 0.3) = sigmoid(0.9) = 1 / (1 + e^(-0.9)) ≈ 0.7109 . The vanishing gradient problem is a significant issue when using sigmoid activation functions in deep networks. This problem occurs because gradients multiply layer by layer during backpropagation, and sigmoid's derivatives are small in the saturated regions near 0 and 1, causing gradients to diminish. As a result, it leads to slow learning or failure to update weights in early layers .
In credit card fraud detection, using standard accuracy as a metric is not suitable because it can be misleading in imbalanced datasets. If fraudulent cases are rare, a classifier might achieve high accuracy by simply predicting all transactions as non-fraudulent, yet it would miss actual fraud cases . Precision and recall are more appropriate metrics. Precision focuses on the correctness of positive predictions, while recall assesses the model's ability to detect all actual positive cases. The F1-score, which is the harmonic mean of precision and recall, provides a balanced evaluation when dealing with class imbalance .