0% found this document useful (0 votes)
13 views8 pages

DL Unit 3

The document provides an overview of classification tasks in neural networks, focusing on binary and multiclass classification. It explains the architecture of neural networks, the training process, and common algorithms used for classification. Examples include classifying movie reviews and news articles into respective categories based on their features.

Uploaded by

rajithagolla1453
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views8 pages

DL Unit 3

The document provides an overview of classification tasks in neural networks, focusing on binary and multiclass classification. It explains the architecture of neural networks, the training process, and common algorithms used for classification. Examples include classifying movie reviews and news articles into respective categories based on their features.

Uploaded by

rajithagolla1453
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 8

UNIT III: Neural Networks

1. Classifying Movie Reviews:


 Binary Classification
2. Classifying newswires:
 Multiclass Classification.

Introduction on Classification in Neural Networks:

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.

Here's a basic overview of how classification works in neural networks:

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.

There are four main types of classification tasks ;they are:


Binary Classification :
• refers to those classification tasks that have two class labels
Multi-Class Classification :
• refers to those classification tasks that have more than two class labels
Multi-Label Classification :
• refers to those classification tasks that have two or more class labels, where one or more class labels
may be predicted for each example
Imbalanced Classification :
• refers to classification tasks where the number of examples in each class is unequally distributed

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

Example of Movie Review in binary classification:


Average Rating Sentiment Label

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.

Example for multiclass classification: news wires

Title Category

"Election Results Announced" Politics

"World Cup Finals Tomorrow" Sports

5
"New Movie Releases This Week" Entertainment

"Budget Debate in Parliament" Politics

"Basketball Championship Finals" Sports

"Interview with Famous Actor" Entertainment

"Prime Minister's Speech" Politics

"Olympic Games Update" Sports

"Movie Awards Ceremony Tonight" Entertainment

"Legislative Proposal Voted On" Politics

We have 10 news articles.


• Each article is represented by a "Title," a textual feature, and we want to classify these articles into
one of three categories: "Politics," "Sports," or "Entertainment.
• You can use text classification techniques like Natural Language Processing (NLP) and machine
learning algorithms to perform this task.
• After training a classifier on this dataset, you can make predictions for new articles by inputting their
titles into the model. For example, if you have a new article titled "New Political Developments," the
classifier might predict it as "Politics.
Example 2: Classification of newswires using Multi-class classifiers
Certainly, here's a simplified numerical example of newswire classification using multiclass
classification without code:
Suppose you have a dataset of newswires and want to classify them into three categories: Sports,
Politics, and Technology. You have the following news articles:
1. **News 1:**
- Title: "Team USA wins gold in the Olympic basketball finals!"
- Category: Sports
2. **News 2:**
- Title: "New government policies announced in annual address."
- Category: Politics
3. **News 3:**
- Title: "Tech giant unveils the next-generation smartphone."
6
- Category: Technology
4. **News 4:**
- Title: "Economic experts analyze the impact of the stock market."
- Category: Politics
5. **News 5:**
- Title: "Nail-biting finish in the World Cup soccer match ends in a tie."
- Category: Sports
In this example:
 - **News 1** is correctly classified as "Sports" because it's about a basketball victory.
 - **News 2** is correctly classified as "Politics" since it discusses government policies.
 - **News 3** is correctly classified as "Technology" because it's about a tech company unveiling a
smartphone.
 - **News 4** is incorrectly classified as "Politics" but is actually more relevant to "Economics." It
discusses stock market impacts.
 - **News 5** is correctly classified as "Sports" due to its focus on a World Cup soccer match.
 This is a simplified example, but in practice, multiclass classification models are trained on a more
extensive dataset with a broader range of news articles and categories. These models use various
techniques such as feature extraction (like TF-IDF or word embeddings) and machine learning
algorithms (like logistic regression, decision trees, or deep learning models) to automatically assign
categories to newswire articles based on their content.

Example 3: Classification of newswires using Multi-class classifiers


Let's say you have a multi-class classification problem for categorizing news wires into four different
classes: "Politics," "Business," "Technology," and "Sports.“
1. *News Wire 1:* - Text: "President's Speech on Healthcare Reform" - Class: Politics
2. *News Wire 2:* - Text: "Stock Market Hits Record High" - Class: Business
3. *News Wire 3:* - Text: "New Smartphone with Advanced Features Released"- Class: Technology
4. *News Wire 4:* - Text: "Soccer Team Wins Championship" - Class: Sports
5. *News Wire 5:* - Text: "Economic Analysis of Tax Policies" - Class: Business
 In this multi-class classification task, each news wire is assigned to one of the four classes. The goal
is to develop a machine learning model that can accurately predict the class of a new news wire based
on its content.

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

There can be any number of classes in it,


It is a classification of two groups, i.e.
No. of classes i.e., classifies the object into more than two
classifies objects in at most two classes.
classes.

The most popular algorithms used by the Popular algorithms that can be used for

binary classification are- multi-class classification include:

 Logistic Regression • k-Nearest Neighbors


Algorithms used  k-Nearest Neighbors • Decision Trees
 Decision Trees • Naive Bayes
 Support Vector Machine • Random Forest.
 Naive Bayes • Gradient Boosting

Examples of multi-class classification


Examples of binary classification include-
include:
 Email spam detection (spam or not).
Examples • Face classification.
 Churn prediction (churn or not).
• Plant species classification.
 Conversion prediction (buy or not).
• Optical character recognition.

You might also like