Nothing Special   »   [go: up one dir, main page]

DL Unit-4

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 4

1.(a)What is the difference between CNN and RNN?

CNN

A Convolutional Neural Network is a Deep Learning Algorithm that takes an


image as an input, assigns various weights and biases to various parts of the
image such that they are differentiable from each other.

As shown in the above basic Architecture of a Convolutional Neural Network, a CNN Model consists of several layers through which
the input images undergo pre-processing to get the output. Basically, these layers are differentiated into two parts –

 The first three layers including the Input Layer, Convolution Layer and the Pooling layer which acts as the feature extraction tool to derive
the base level features from the images fed into the model.
 The final Fully Connected Layer and the Output Layer makes use of the output of the feature extraction layers and predicts a class for the
image depending upon the features extracted.

Recurrent Neural Networks

Therefore, an RNN has two inputs: the present and the recent past. This is important because the sequence of data contains
crucial information about what is coming next, which is why an RNN can do things other algorithms can’t. The main and most
important feature of Recurrent Neural Networks is the Hidden state, which remembers some information about a sequence.

CNN is a type of feed-forward artificial neural RNN, unlike feed-forward neural networks- can use
network with variations of multilayer their internal memory to process arbitrary sequences of
perceptron’s designed to use minimal inputs.
amounts of preprocessing.

CNN is considered to be more powerful than RNN includes less feature compatibility when compared
RNN. to CNN.

This CNN takes inputs of fixed sizes and RNN can handle arbitrary input/output lengths.
generates fixed size outputs.

CNN’s are ideal for images and video RNNs are ideal for text and speech analysis.
processing.
1.(b) Explain RNN architecture

A basic Recurrent Neural Network (RNN) is a type of neural network designed for sequence data. Unlike
traditional feedforward neural networks, RNNs have connections that form directed cycles, allowing them
to maintain a hidden state that captures information about previous inputs in the sequence. This makes
RNNs well-suited for tasks involving sequential or time-series data.

The architecture of a basic RNN consists of the following components:

1. Input Layer:
The input layer represents the input features for each time step in the sequence.

2. Recurrent Connection:
The key feature of an RNN is the recurrent connection, which allows information to persist across different
time steps. At each time step, the hidden state from the previous time step is used in combination with the
current input to produce the output and update the hidden state.

3. Hidden State:
The hidden state captures information about previous inputs in the sequence. It is updated at each time step
based on the current input and the previous hidden state.

4. Output Layer:
The output layer produces the output for the current time step based on the current input and the hidden
state.
2.(a) Explain LSTM

What is LSTM?

Long Short-Term Memory is an improved version of recurrent neural network designed by Hochreiter &
Schmidhuber.

A traditional RNN has a single hidden state that is passed through time, which can make it difficult for the network
to learn long-term dependencies. LSTMs model address this problem by introducing a memory cell, which is a
container that can hold information for an extended period.

LSTM architectures are capable of learning long-term dependencies in sequential data, which makes them well-
suited for tasks such as language translation, speech recognition, and time series forecasting.

LSTM Architecture
The LSTM architectures involves the memory cell which is controlled by three gates: the input gate, the forget
gate, and the output gate. These gates decide what information to add to, remove from, and output from the
memory cell.
The input gate controls what information is added to the memory cell.
The forget gate controls what information is removed from the memory cell.
The output gate controls what information is output from the memory cell

Forget Gate
The information that is no longer useful in the cell state is removed with the forget gate.

Input gate
The addition of useful information to the cell state is done by the input gate. First, the information is regulated using the sigmoid
function and filter the values to be remembered similar to the forget gate using inputs ht-1 and xt. .
2.(b) Gated Recurrent Unit (GRU)
Gated Recurrent Unit (GRU) is an improved version of RNN. GRUs were introduced in
2014 by Cho, et al. Like LSTM, it uses gating mechanisms to control the flow of
information between the network cells. GRU aims to solve the problem of vanishing
gradient and performs better than a standard RNN. Let us see what makes them so
effective.
Working of GRU
GRU uses a reset gate and an update gate to solve the vanishing gradient problem.
These gates decide what information to be sent to the output. They can keep the
information from long back without diminishing it as the training continues. We can
visualize the architecture of GRU below:

You might also like