Machine Learning
Machine Learning
MC4301
ASSIGNMENT 3
1
PERCEPTRON:
In Machine Learning and Artificial Intelligence, Perceptron is the most
commonly used term for all folks. It is the primary step to learn Machine
Learning and Deep Learning technologies, which consists of a set of weights,
input values or scores, and a threshold. Perceptron is a building block of an
Artificial Neural Network. Initially, in the mid of 19th century, Mr. Frank
Rosenblatt invented the Perceptron for performing certain calculations to
detect input data capabilities or business intelligence. Perceptron is a linear
Machine Learning algorithm used for supervised learning for various binary
classifiers. This algorithm enables neurons to learn elements and processes
them one by one during preparation. In this tutorial, "Perceptron in Machine
Learning," we will discuss in-depth knowledge of Perceptron and its basic
functions in brief. Let's start with the basic introduction of Perceptron.
Perceptron model is also treated as one of the best and simplest types of
Artificial Neural networks. However, it is a supervised learning algorithm of
binary classifiers. Hence, we can consider it as a single-layer neural network
with four main parameters, i.e., input values, weights and Bias, net sum, and
an activation function.
2
Basic Components of Perceptron
Mr. Frank Rosenblatt invented the perceptron model as a binary classifier
which contains three main components. These are as follows:
This is the primary component of Perceptron which accepts the initial data into
the system for further processing. Each input node contains a real numerical
value.
Activation Function:
These are the final and important components that help to determine whether
the neuron will fire or not. Activation Function can be considered primarily as
a step function.
3
NEURAL NETWORKS:
4
Forward Propagation:
• Input Layer: Each feature in the input layer is represented by a node on
the network, which receives input data.
• Weights and Connections: The weight of each neuronal connection
indicates how strong the connection is. Throughout training, these weights
are changed.
• Hidden Layers: Each hidden layer neuron processes inputs by multiplying
them by weights, adding them up, and then passing them through an
activation function. By doing this, non-linearity is introduced, enabling the
network to recognize intricate patterns.
• Output: The final result is produced by repeating the process until the
output layer is reached.
Backpropagation:
• Loss Calculation: The network’s output is evaluated against the real goal
values, and a loss function is used to compute the difference. For a
regression problem, the Mean Squared Error (MSE) is commonly used as
the cost function.
Loss Function:
• Gradient Descent: Gradient descent is then used by the network to
reduce the loss. To lower the inaccuracy, weights are changed based on
the derivative of the loss with respect to each weight.
• Adjusting weights: The weights are adjusted at each connection by
applying this iterative process, or backpropagation, backward across the
network.
5
• Training: During training with different data samples, the entire process
of forward propagation, loss calculation, and backpropagation is done
iteratively, enabling the network to adapt and learn patterns from the
data.
• Actvation Functions: Model non-linearity is introduced by activation
functions like the rectified linear unit (ReLU) or sigmoid. Their decision on
whether to “fire” a neuron is based on the whole weighted input.
6
CONVOLUTIONAL NEURAL NETWORK:
A Convolutional Neural Network (CNN) is a type of Deep Learning neural
network architecture commonly used in Computer Vision. Computer vision
is a field of Artificial Intelligence that enables a computer to understand and
interpret the image or visual data.
When it comes to Machine Learning, Artificial Neural Networks perform
really well. Neural Networks are used in various datasets like images, audio,
and text. Different types of Neural Networks are used for different purposes,
for example for predicting the sequence of words we use Recurrent Neural
Networks more precisely an LSTM, similarly for image classification we use
Convolution Neural networks. In this blog, we are going to build a basic
building block for CNN.
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.
The Convolutional layer applies filters to the input image to extract features,
the Pooling layer downsamples the image to reduce computation, and the
7
fully connected layer makes the final prediction. The network learns the
optimal filters through backpropagation and gradient descent.
Convolutional Layer
• The convolutional layer is the core building block of a CNN. This layer
uses a set of filters (or kernels), small matrices, that slide over the input
image or previous layer’s output. These filters are used to detect simple
patterns like edges, lines, and textures.
• Each filter produces an output called a feature map. As the model learns,
these filters automatically adjust to capture relevant features for the
task.
• Stride and padding are used to control the filter's movement across the
input, affecting the spatial dimensions of the output feature maps.
Pooling Layer
• Pooling layers help reduce the spatial dimensions of the feature maps
while retaining significant information. This makes the network more
computationally efficient and reduces the risk of overfitting.
• Max pooling and average pooling are common pooling techniques. Max
pooling takes the maximum value from a feature map region, while
average pooling computes the average value.
• Pooling helps the CNN become more translation invariant, meaning it
can recognize objects regardless of their position in the image.
8
Activation Functions
• The fully connected layers are typically used near the end of a CNN to
combine the features learned by the convolutional layers and make the
final classification.
• Each neuron in a fully connected layer is connected to every neuron in
the previous layer, allowing the model to learn a weighted combination
of high-level features.
DEEP LEARNING:
9
Deep learning works by using artificial neural networks to learn from data.
Neural networks are made up of layers of interconnected nodes, and each
node is responsible for learning a specific feature of the data. Building on our
previous example with images – in an image recognition network, the first
layer of nodes might learn to identify edges, the second layer might learn to
identify shapes, and the third layer might learn to identify objects.
As the network learns, the weights on the connections between the nodes are
adjusted so that the network can better classify the data. This process is called
training, and it can be done using a variety of techniques, such as supervised
learning, unsupervised learning, and reinforcement learning.
Deep learning applications
Deep learning can be used in a wide variety of applications, including:
CNNs are used for image recognition and processing. They are particularly
good at identifying objects in images, even when those objects are partially
obscured or distorted.
Deep reinforcement learning
Deep reinforcement learning is used for robotics and game playing. It is a type
of machine learning that allows an agent to learn how to behave in an
environment by interacting with it and receiving rewards or punishments.
10
Recurrent neural networks (RNNs)
RNNs are used for natural language processing and speech recognition. They
are particularly good at understanding the context of a sentence or phrase,
and they can be used to generate text or translate languages.
11
without enough with fewer
hidden layers parameters due
to shared weights
Training Simple Backpropagatio Backpropagation Uses various
Algorith perceptron n with gradient with optimizations
m learning rule, descent optimizations for for
adjusts weights convolutional backpropagatio
based on errors layers n; sometimes
employs
distributed or
parallel
computing
Activatio Typically a step Sigmoid, ReLU, Commonly uses Uses ReLU,
n function tanh, etc. ReLU for hidden Sigmoid, Tanh,
Function layers, Softmax Softmax, and
s for output others
depending on
the application
Input Numeric, low- Numeric, low to Images or grid- Can handle
Type dimensional high- like data (e.g., various data
dimensional audio types: text,
spectrograms) images, video,
and structured
or unstructured
data
Interpret Highly Moderate Interpretable to a Often regarded
ability interpretable interpretability certain extent; as a "black box"
however, due to the
understanding complexity of
individual filter layers and
significance in parameters
deep layers can
be challenging
12
13