DL Unit 3
DL Unit 3
In the context of neural networks and machine learning, classification refers to the task of assigning a label
or category to input data based on its features. The goal is to train a model to learn the mapping between
input data and the corresponding output labels. Neural networks, a type of machine learning model, are
particularly well-suited for classification tasks.
1. Input Data: The data you want to classify is presented to the neural network as input. Each piece of input
data is represented by a set of features.
2. Architecture: The neural network consists of layers of interconnected nodes (neurons) organized into an
architecture. The first layer is the input layer, which receives the input data. The middle layers are called
hidden layers, and the final layer is the output layer, which produces the classification result.
3. Weights and Bias: Each connection between nodes in the neural network has a weight associated with it.
These weights are parameters that the network learns during training. Additionally, each node has a bias
term. The weights and biases are adjusted during training to minimize the difference between the predicted
output and the actual labels.
4. Activation Function: Each node in the hidden and output layers typically applies an activation function to
the weighted sum of its inputs. This introduces non-linearity into the network, enabling it to learn complex
relationships in the data.
5. Training: The neural network is trained using a labeled dataset, where each input is associated with a
correct output label. The training process involves adjusting the weights and biases using optimization
algorithms to minimize the difference between the predicted output and the actual labels.
1
6. Loss Function: The difference between the predicted output and the actual label is quantified using a loss
function. The goal during training is to minimize this loss.
7. Backpropagation: The optimization process, often referred to as backpropagation, involves propagating the
error backward through the network, adjusting the weights and biases to reduce the error.
8. Output: Once the neural network is trained, it can be used to classify new, unseen data by passing it through
the network. The output of the network represents the predicted class or label.
Common types of neural network architectures used for classification include feedforward neural
networks, convolutional neural networks (CNNs) for image data, and recurrent neural networks
(RNNs) for sequential data.
The choice of architecture depends on the nature of the input data and the specific requirements of
the classification task.
1.Binary classification
• It is a process or task of classification, in which a given data is being classified into two classes. It’s
basically a kind of prediction about which of two groups the thing belongs to.
• Let us suppose, two emails are sent to you, one is sent by an insurance company that keeps sending
their ads, and the other is from your bank regarding your credit card bill.
• The email service provider will classify the two emails; the first will be sent to the spam folder and
the second will be kept in the primary one.
2
• This process is known as binary classification, as there are two discrete classes: spam and primary.
So, this is a problem of binary classification.
Examples: YES or NO, MALE or FEMALE, SPAM or NOT SPAM, CAT or DOG, etc.
• This are some popular algorithms that can be used for binary classification include:
• Logistic Regression
• k-Nearest Neighbors
• Decision Trees
• Support Vector Machine
• Naive Bayes
4.8 Positive
3.2 Negative
4.5 Positive
2.9 Negative
4.0 Positive
1.8 Negative
4.7 Positive
3
3.0 Negative
4.2 Positive
3.5 Negative
• We have 10 movie reviews.
• Each review is represented by one feature: "Average Rating," which is a numerical
value.
• We want to classify these reviews as either "Positive" or "Negative" based on their
average rating
• Let's say we use a decision threshold of 3.5. If the average rating is greater than or
equal to 3.5, we classify the review as "Positive"; otherwise, it's classified as
“Negative”.
4.8 >= 3.5 → Positive ,3.2 < 3.5 → Negative
4.5 >= 3.5 → Positive,2.9 < 3.5 → Negative
4.0 >= 3.5 → Positive,1.8 < 3.5 → Negative
4.7 >= 3.5 → Positive,3.0 < 3.5 → Negative
4.2 >= 3.5 → Positive,3.5 >= 3.5 → Positive
• Based on our simple classification threshold, we have classified reviews 1, 3, 5, 7, 9,
and 10 as "Positive," and reviews 2, 4, 6, and 8 as "Negative.
4
2. Multiclass Classification.
Multi-class classification is the task of classifying elements into different classes. Unlike binary, it
doesn’t restrict itself to any number of classes.
If a classification problem has more than two outcomes, then it is called as Multi-class Classifier.
Examples of multi-class classification are
• Classification of news in different categories,
• Classifying books according to the subject,
• Classifying students according to their streams etc.
• In these, there are different classes for the response variable to be classified in and thus according to
the name, it is a Multi-class classification.
Popular algorithms that can be used for multi-class classification include:
• k-Nearest Neighbors.
• Decision Trees.
• Naive Bayes.
• Random Forest.
• Gradient Boosting.
Title Category
5
"New Movie Releases This Week" Entertainment
7
For instance, if you input the news wire "New Smartphone with Advanced Features Released" into
your trained multi-class classification model, it should predict the class as "Technology.“
This example demonstrates the concept of classifying news wires into multiple categories, and in
practice, machine learning algorithms and natural language processing techniques are used to
perform such classifications on larger datasets
Multi-class
Parameters Binary classification
classification
The most popular algorithms used by the Popular algorithms that can be used for