Unit III
Unit III
1.Input Layers:
It’s the layer in which we give input to our model. The number of neurons in this
layer is equal to the total number of features in our data (number of pixels in the
case of an image).
2.Hidden Layer: The input from the Input layer is then fed into the hidden layer.
There can be many hidden layers depending on our model and data size. Each
hidden layer can have different numbers of neurons which are generally greater
than the number of features. The output from each layer is computed by matrix
multiplication of the output of the previous layer with learnable weights of that
layer and then by the addition of learnable biases followed by activation
function which makes the network nonlinear.
3.Output Layer: The output from the hidden layer is then fed into a logistic
function like sigmoid or softmax which converts the output of each class into the
probability score of each class.
• The data is fed into the model and output from each layer is
obtained from the above step is called feedforward, we then
calculate the error using an error function, some common error
functions are cross-entropy, square loss error, etc.
• The error function measures how well the network is
performing. After that, we backpropagate into the model by
calculating the derivatives. This step is
called Backpropagation which basically is used to minimize
the loss.
• cross-entropy measures the difference between the discovered
probability distribution of a classification model and the predicted
values.
• The cross-entropy loss function is used to find the optimal solution by
adjusting the weights of a machine learning model during training.
The objective is to minimize the error between the actual and
predicted outcomes. A lower cross-entropy value indicates better
performance.
Convolution Neural Network
• Convolutional Neural Network (CNN) is the extended version
of artificial neural networks (ANN) which is predominantly
used to extract the feature from the grid-like matrix dataset.
For example visual datasets like images or videos where data
patterns play an extensive role.
CNN architecture
• Convolutional Neural Network consists of multiple layers like
the input layer, Convolutional layer, Pooling layer, and fully
connected layers.
How Convolutional Layers works
• Multiple RNN cells can be stacked together to form the encoder. RNN
reads each inputs sequentially
• For every timestep (each input) t, the hidden state (hidden vector) h
is updated according to the input at that timestep X[i].
• After all the inputs are read by encoder model, the final hidden state
of the model represents the context/summary of the whole input
sequence.
• Example: Consider the input sequence “I am a Student” to be
encoded. There will be totally 4 timesteps ( 4 tokens) for the Encoder
model. At each time step, the hidden state h will be updated using
the previous hidden state and the current input.
Case study- spam classification
• https://medium.com/@azimkhan8018/email-spam-detection-with-
machine-learning-a-comprehensive-guide-b65c6936678b
What is Sentiment Analysis?