0% found this document useful (0 votes)
12 views5 pages

Deep Learning Assignment Overview

The document discusses various neural network architectures, focusing on Convolutional Neural Networks (CNNs) and Recurrent Neural Networks (RNNs), detailing their components, differences from fully connected networks, and real-world applications. It also covers activation functions like ReLU and Tanh, highlighting their advantages and limitations, as well as loss functions such as Mean Squared Error and Cross-Entropy Loss. Additionally, it includes observations from an interactive practice session that emphasizes the importance of balancing model complexity and regularization.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views5 pages

Deep Learning Assignment Overview

The document discusses various neural network architectures, focusing on Convolutional Neural Networks (CNNs) and Recurrent Neural Networks (RNNs), detailing their components, differences from fully connected networks, and real-world applications. It also covers activation functions like ReLU and Tanh, highlighting their advantages and limitations, as well as loss functions such as Mean Squared Error and Cross-Entropy Loss. Additionally, it includes observations from an interactive practice session that emphasizes the importance of balancing model complexity and regularization.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Deep Learning Assignment 01

Question 1: Exploring Neural Network Architectures

1. Convolutional Neural Networks (CNNs):

●​ CNNs excel in tasks involving grid-like data (e.g., images). Convolutional layers
use filters to detect local patterns (edges, textures) by sliding over input regions,
preserving spatial relationships.
●​ Key Components:
○​ Convolutional Layers: Extract hierarchical features (e.g., edges → shapes
→ objects).
○​ Pooling Layers (Max/Average): Reduce spatial dimensions, improving
computational efficiency and translational invariance.
○​ ReLU Activation: Introduces non-linearity after convolutions.
●​ Difference from Fully Connected Networks: CNNs exploit spatial locality,
drastically reducing parameters (weight sharing) compared to dense layers that
treat pixels as independent.
●​ Real-World Application: Beyond self-driving cars, CNNs are used in medical
imaging (e.g., detecting tumors in MRI scans).

2. Recurrent Neural Networks (RNNs):

●​ RNNs process sequential data (text, time series) using loops to pass hidden
states across time steps, capturing temporal dependencies.
●​ Variants:
○​ LSTM: Addresses vanishing gradients with gated mechanisms, retaining
long-term memory.
○​ GRU: Simplified version of LSTM with fewer parameters.
●​ Difference from Fully Connected Networks: Unlike FC networks, RNNs handle
variable-length sequences (e.g., sentences) by updating hidden states iteratively.
●​ Real-World Application: Beyond speech recognition, RNNs power machine
translation (e.g., Google Translate).

Question 2: Beyond Sigmoid: Activation Functions


1. Rectified Linear Unit (ReLU):

●​ Formula:
●​ f(x)=max⁡(0,x)
●​ f(x)=max(0,x)
●​ Advantages:
○​ Avoids vanishing gradients (non-saturating for
○​ x>0
○​ x>0).
○​ Computationally cheap (no exponential operations).
●​ Limitations: "Dying ReLU" issue (neurons stuck at zero for negative inputs).
●​ Usage: Default choice in CNNs and deep networks.

2. Hyperbolic Tangent (Tanh):

●​ Formula:
●​ f(x)=ex−e−xex+e−x
●​ f(x)=
●​ e
●​ x

●​ +e
●​ −x

●​ e
●​ x

●​ −e
●​ −x

●​ ​

●​ (outputs between -1 and 1).


●​ Advantages:
○​ Zero-centered outputs aid faster convergence.
○​ Mitigates vanishing gradients better than Sigmoid.
●​ Limitations: Saturates for extreme inputs (gradients near zero).
●​ Usage: Preferred in RNNs for balanced gradient flow.
Comparison:

●​ ReLU is simpler but risks dead neurons; Tanh avoids this but saturates. Leaky
ReLU (
●​ f(x)=max⁡(0.01x,x)
●​ f(x)=max(0.01x,x)) is a common ReLU variant to prevent neuron death.

Question 3: Exploring Loss Functions

1. Mean Squared Error (MSE):

●​ Formula:
●​ MSE=1n∑i=1n(yi−y^i)2
●​ MSE=
●​ n
●​ 1
●​ ​

●​ ∑
●​ i=1
●​ n
●​ ​

●​ (y
●​ i
●​ ​

●​ −
●​ y
●​ ^
●​ ​

●​ i
●​ ​

●​ )
●​ 2
●​ Usage: Regression tasks (e.g., predicting house prices).
●​ Why Suitable: Smooth and convex, enabling gradient-based optimization.
Penalizes large errors quadratically.
2. Cross-Entropy Loss (Multi-Class):

●​ Formula:
●​ −∑i=1nyilog⁡(y^i)
●​ −∑
●​ i=1
●​ n
●​ ​

●​ y
●​ i
●​ ​

●​ log(
●​ y
●​ ^
●​ ​

●​ i
●​ ​

●​ )
●​ Usage: Classification (e.g., MNIST digit recognition).
●​ Why Suitable: Aligns with softmax outputs, minimizing divergence between
predicted and true probability distributions.

Bonus Activity: Interactive Practice

Experiment Details:

●​ Dataset: Tested on TensorFlow Playground’s "Spiral" dataset.


●​ Observations:
1.​ With 4 hidden layers (5 neurons each), accuracy improved from 72% to
89%, but training took 2x longer.
2.​ ReLU achieved 85% accuracy in 200 epochs vs. Sigmoid’s 60% (gradients
vanished early).
3.​ Overfitting occurred with 8 neurons/layer (99% train vs. 75% test).
Reduced neurons to 3/layer and added L2 regularization, improving test
accuracy to 82%.
Conclusion: Balancing model complexity and regularization is critical. ReLU’s efficiency

makes it ideal for deeper networks

Common questions

Powered by AI

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 .

You might also like