Unit4 Deep Learning
Unit4 Deep Learning
RNN (Recurrent Neural Network) is a type of neural network used for processing sequential data like time series, speech, or text. Unlike
regular neural networks, RNNs have loops that allow information to be passed from one step to the next, making them good at
remembering previous inputs.
Types of RNN:
1. Basic RNN: Standard type that uses previous hidden state and current input to produce output. It struggles with long-term memory.
2. LSTM (Long Short-Term Memory): Solves the short-term memory problem. It uses gates (input, forget, output) to control what to
remember or forget.
3. GRU (Gated Recurrent Unit): Similar to LSTM but has fewer gates (reset and update). It’s simpler and faster than LSTM.
4. Bidirectional RNN: Processes input in both forward and backward directions, capturing more context.
5. Deep RNN: Uses multiple RNN layers to learn complex features
Encoder-Decoder Architecture is used in tasks like machine translation (e.g., English to French). It works in two steps:
1. Encoder: Takes input sequence (like a sentence) and converts it into a fixed-length context vector. It summarizes the input.
2. Decoder: Uses the context vector to generate the output sequence (translated sentence or response).
This architecture is commonly used in: Language translation, Chatbots, Text summarization
Advanced versions use attention mechanism to focus on important parts of the input during decoding.
1. Feedforward Neural Network (FNN): Basic type where information flows in one direction. Used for simple prediction tasks.
2. Convolutional Neural Network (CNN): Best for image processing, like face or object recognition. It detects patterns using filters.
3. Recurrent Neural Network (RNN): Best for sequential data like speech, text, or time series. It remembers past inputs.
4. Autoencoders: Used for data compression and noise removal. Learns to compress and then reconstruct input data.
5. Generative Adversarial Networks (GANs): Used to generate new data like fake images. Works with a Generator and
Discriminator competing with each other.
6. Transformer: Modern model for language tasks like translation or summarization. Uses attention instead of recurrence, and it's
very fast and accurate.
WSN (Wireless Sensor Network) performance is evaluated using several performance metrics (or matrices) that measure efficiency
and effectiveness:
1. Energy Efficiency: Since sensor nodes run on batteries, energy consumption must be minimal to increase network lifetime.
2. Latency: Time taken for data to travel from sensor node to base station. Lower latency is better.
3. Throughput: Amount of data successfully transmitted per unit time.
4. Packet Delivery Ratio (PDR): Ratio of successfully delivered packets to the total packets sent.
5. Scalability: The network’s ability to maintain performance as the number of nodes increases.
6. Coverage: Area monitored effectively by the sensor network.
7. Fault Tolerance: Ability of the network to continue functioning despite node failures.
These matrices help in evaluating and improving the performance of WSN applications like environmental monitoring, health tracking, etc.
Default baseline models are simple models used to set a reference point for evaluating the performance of more complex machine
learning models.
Purpose:
Examples:
Baseline models are useful in early stages of model development or when testing the effectiveness of algorithms.
A Recurrent Neural Network (RNN) is a neural network designed to process sequential data by maintaining a hidden state that
captures past information.
RNN Architecture:
Key Features:
Shared weights: The same weights are used at every time step.
Feedback Loop: Hidden state carries information from past steps (temporal memory).
8) Draw and Explain Architecture for Long Short-Term Memory (LSTM) [6 Marks]
LSTM is a type of RNN designed to solve the vanishing gradient problem by introducing a memory cell and gates to control the flow of
information.
Computational Implementation:
1. Vectors and Matrices: Each gate (input, forget, output) uses its own weight matrices and bias vectors.
2. Element-wise Operations: Gates use sigmoid activation (output between 0 and 1) to decide "how much" to keep or discard.
3. Memory Cell Update:
o Forget Gate: Multiplies old cell state to forget part of it.
o Input Gate: Adds new candidate information to cell state.
o Output Gate: Produces final output from updated cell state.
Key Operations:
This allows LSTM to retain or discard information across long sequences, making it better at tasks like language translation or time-
series forecasting.
A Deep Generative Model is a type of deep learning model that can generate new data that looks similar to the training data. It learns
the probability distribution of the input data and uses it to produce similar outputs.
Key Idea: Instead of just classifying or predicting, generative models create new samples like images, text, or audio.
Types:
Example: A GAN trained on human face images can generate new realistic face images that do not belong to any real person.
Use Cases:
Data augmentation
Image synthesis
Text generation
11) How does GAN Training Scale with Batch Size? [6 Marks]
In GAN (Generative Adversarial Network) training, batch size affects both training stability and output quality.
Scaling Issues:
Too large batch size can make training unstable or make the Discriminator overpower the Generator.
Some architectures like StyleGAN use progressive growing and adaptive batch sizes to maintain stability.
Conclusion: Batch size must be carefully selected based on hardware and model behavior.
13) What is RNN? What is the need of RNN? Explain working of RNN. [6 Marks]
RNN (Recurrent Neural Network) is a type of neural network designed to process sequential data by using loops in its architecture to retain
memory of previous inputs.
Need of RNN:Traditional neural networks treat each input independently. But in tasks like speech recognition, language modeling, or
time-series prediction, past information is important. RNNs remember previous inputs, making them suitable for such tasks.
o Current input xt
o Previous hidden state ht−1
LSTM is a special kind of RNN that solves the vanishing gradient problem by introducing a cell state and gates.
Bidirectional LSTM:
It uses two LSTMs: one processes the sequence forward, the other backward.
Their outputs are combined (e.g., concatenated).
This helps the model get context from both past and future inputs.
Use Case: Very useful in NLP tasks like named entity recognition or machine translation.
Unfolding means breaking down a recurrent network over time into a sequence of operations (like a feedforward network).
Example:
x1 → h1 → x2 → h2 → x3 → h3
This unfolded graph makes it easier to apply backpropagation through time (BPTT) to update weights during training.
Types of RNN:
1. Vanilla RNN:
o Basic RNN model with one hidden state looped over time.
o Prone to vanishing gradient problems.
2. LSTM (Long Short-Term Memory):
o Designed to remember long-term dependencies using gates and memory cells.
3. GRU (Gated Recurrent Unit):
o A simpler version of LSTM with fewer gates (no separate cell state).
4. Bidirectional RNN:
o Processes data in both forward and backward directions.
5. Deep RNN:
o Has multiple RNN layers stacked on top of each other for deeper learning.
Encoder-Decoder is a neural network architecture used for sequence-to-sequence tasks (Seq2Seq), where input and output are both
sequences but may be of different lengths.
Architecture:
1. Encoder:
o Processes the input sequence (e.g., a sentence in English).
o Produces a fixed-size context vector (summary of input).
2. Decoder:
o Takes the context vector.
o Generates output sequence (e.g., a sentence in French), one word at a time.
3. Often uses LSTM or GRU units.
Application: