0% found this document useful (0 votes)
23 views30 pages

Comment Toxicity Classification Report

The seminar report titled 'Comment Toxicity Classification Using Deep Learning' by Bhavyatha M discusses the development of a deep learning model aimed at classifying toxic comments on social media platforms. The project addresses the increasing prevalence of toxic comments and aims to create a safer online environment by utilizing Natural Language Processing techniques to identify various forms of toxicity. The report includes acknowledgments, a declaration of originality, an abstract summarizing the project's objectives, and a literature survey on existing methods for toxicity classification.

Uploaded by

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

Comment Toxicity Classification Report

The seminar report titled 'Comment Toxicity Classification Using Deep Learning' by Bhavyatha M discusses the development of a deep learning model aimed at classifying toxic comments on social media platforms. The project addresses the increasing prevalence of toxic comments and aims to create a safer online environment by utilizing Natural Language Processing techniques to identify various forms of toxicity. The report includes acknowledgments, a declaration of originality, an abstract summarizing the project's objectives, and a literature survey on existing methods for toxicity classification.

Uploaded by

Bhavyatha M
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

VISVESVARAYA TECHNOLOGICAL UNIVERSITY

BELAGAVI, KARNATAKA

A Seminar Report on
“Comment Toxicity Classification Using Deep Learning”
Submitted in the partial fulfillment for the requirements for the conferment of Degree of
BACHELOR OF ENGINEERING
in

INFORMATION SCIENCE AND ENGINEERING

By
Miss. BHAVYATHA M 1BY20IS040

Under the guidance of

Dr. Shanti D.L


Associate Professor, BMSIT&M

2023-2024
VISVESVARAYA TECHNOLOGICAL UNIVERSITY
BELAGAVI, KARNATAKA
BMS INSTITUTE OF TECHNOLOGY & MANAGEMENT
YELAHANKA, BENGALURU-560064

DEPARTMENT OF INFORMATION SCIENCE & ENGINEERING

CERTIFICATE

This is to certify that the Seminar (18ISS86) entitled “COMMENT TOXICITY CLASSIFICATION
USING DEEP LEARNING” is a bonafide work carried out by “BHAVYATHA M (1BY20IS040)
partial fulfillment for the award of Bachelor of Engineering Degree in Information Science and
Engineering of the Visvesvaraya Technological University, Belagavi during the year 2023-2024. It
is certified that all corrections/suggestions indicated for Internal Assessment have been incorporated
in this report. The seminar report has been approved as it satisfies the academic requirements with
respect to seminar work for the B.E Degree.

Signature of the Guide Signature of the HOD


Dr. Shanti D. L Dr. Pushpa S K

Signature of the Coordinator


Dr. Drakshaveni G
ACKNOWLEDGEMENT

I am happy to present this Technical Seminar after completing it successfully. This seminar
would not have been possible without the guidance, assistance and suggestions of many
individuals. I would like to express our deep sense of gratitude and indebtedness to each and
every one who has helped us make this project a success.

I heartily thank our Principal, Dr. Sanjay H A, BMS Institute of Technology &
Management for his constant encouragement and inspiration in taking up this seminar.

I heartily thank our Head of Department Dr. Pushpa S K, Dept. of Information Science
and Engineering, BMS Institute of Technology & Management for her constant
encouragement and inspiration in taking up this seminar.

I heartily thank our seminar coordinator Dr. Drakshaveni G, Professor, Dept. of


Information science and Engineering, for her constant follow-up and advice throughout the
course of the Project work.

I gracefully thank our seminar guide, “Dr. Shanti D. L, Associate Professor”, Dept. of
Information Science and Engineering, for her encouragement and advice throughout the
course of the seminar.

Special thanks to all the staff members of Information Science Department for their help and
kind co-operation.

Lastly, I thank our parents and friends for their encouragement and support given to us in order
to finish this precious work.

By,
Bhavyatha M

i
BMS INSTITUTE OF TECHNOLOGY & MANAGEMENT YELAHANKA,
BANGALORE-64

DEPARTMENT OF INFORMATION SCIENCE AND ENGINEERING

Declaration

I, hereby declare that the Technical Seminar titled “COMMENT TOXICITY


CLASSIFICATION USING DEEP LEARNING” Is a record of original project work
undertaken for the award of the degree Bachelor of Engineering in Information Science and
Engineering of the Visvesvaraya Technological University, Belagavi during the year 2023-
2024. I have completed this project under the guidance of Dr. Shanti D.L.

I also declare that this project report has not been submitted for the award of any degree,
diploma, associate ship, fellowship or other title anywhere else.

Student Photo Photo

USN 1BY20IS040

Name BHAVYATHA M

Signature

ii
ABSTRACT

With the growing use of social media platforms, there's been a significant rise in toxic
comments, highlighting the need to reduce toxicity. The field of classifying toxic comments
has seen considerable progress, with several new approaches emerging. These
developments showcase innovative applications of Natural Language Processing (NLP) for
identifying various types of toxicity in comments. The objective is to discern and
categorize different types of toxic behavior, such as obscenity, identity-based hate, threats,
general toxicity, insults, and severe toxicity. Our algorithm uses comments from online
platforms to classify them as toxic or non-toxic.

The objective is to create a deep learning model which can detect different forms of
toxicity, including threats, obscenity, insults, and identity-based hate. Online discussions on
topics people care about can be challenging due to the risk of abuse and harassment, which
causes many to stop expressing their opinions or shy away from seeking diverse
perspectives. Social media platforms struggle to manage these issues effectively, leading
some to limit or completely shut down user comments. To address these challenges, we aim
to offer publicly available models via Perspective APIs, including one for detecting toxicity.

iii
INDEX

ACKNOWLEDGEMENT……………………………… i

DECLARATION………………………………………... ii

ABSTRACT……………………………………………... iii

LIST OF FIGURES………………………………….….. v

Chapter No. Chapter Title Page No.

1 Introduction [1-3]
1.2 Motivation 3
1.3 Objective 3
2 Literature Survey [4-7]
2.1 Existing system 7
2.2 Problem Statement 7
2.3 Proposed System 7
3 Requirement Specification [8]
3.1 Functional Requirements 8
3.2 Non-Functional Requirements 8
3.3 Software & hardware Requirements 9
4 Design and Analysis [10-11]
4.1 Design 10 -11

5 Implementation [12-14]
6 Application [15]
7 Conclusion and Future Work [16]
8 References [17 – 18]
LIST OF FIGURES

Figure No. Figure name Page No.

1.1 Alek Minassian Commented on 1


Facebook.

2
Age group with the highest
1.2
exposure to cyberbullying

10
4.1
Model Architecture

5.1 Project Flow Diagram 13

5.2 Output 14

v
Comment Toxicity Classification Using Deep Learning Introduction

CHAPTER I

INTRODUCTION

The rise in use of online platforms enables people to connect with each other, sharing their
feelings and opinions on various events and leaving comments to express their views. For
example, in the figure 1.1, On Facebook, Alek Minassian, the accused individual in the
Toronto van attack, expressed admiration for the "incel rebellion” [2]. The internet can also
serve as a breeding ground for negativity, providing a space for individuals to explore extreme
ideologies and amplify their hatred without facing immediate consequences—until those
sentiments manifest in real-world violence, as noted by Shannon Martinez of the Free
Radicals Project.

[1] The goal of the project is to create a safer online environment by detecting and removing
toxic comments from social media platforms. This approach aims to foster better
communication and connection among users in an increasingly digital world. A neural
network serves as an excellent solution to this issue because human speech patterns can be
challenging for traditional hard-coded algorithms to process, and it's not cost-effective for
companies to hire human moderators to review all content. [1] NLP with neural networks have
emerged as the most effective approach, with the market for this technology projected to reach
US$ 26.4 billion by 2024.

Fig 1.1: Alek Minassian Commented on Facebook.

Dept. of ISE, BMSIT 2023-24 1


Comment Toxicity Classification Using Deep Learning Introduction

According to the research findings depicted in the figure 1.2, it is evident that
cyberbullying predominantly affects the millennial cohort (born between 1980 and 1995),
with a prevalence of 54%. Following closely are the members of Generation Z (born
between 1997 and 2012), comprising 47% of reported cases, trailed by Generation X (born
between 1965 and 1980) at 39%, and lastly, baby boomers (born between 1946 and 1964)
at 18%. Concurrently, data from Polda Metro Jaya indicates a daily average of 25 reported
cyberbullying incidents, a figure anticipated to escalate due to the growing number of
internet users and the inadequate measures in place to address such cases.

Fig 1.2: Age group with the highest exposure to cyberbullying

Dept. of ISE, BMSIT 2023-24 2


Comment Toxicity Classification Using Deep Learning Introduction

1.2 MOTIVATION

 Harmful remarks on social media can create a hostile atmosphere, leading to more
negativity, harassment, and abuse. By identifying and minimizing toxic behavior, we can
create a more welcoming and respectful online space where people feel safe to share
their views.
 Toxicity often targets specific individuals or groups based on race, religion, gender,
sexual orientation or other identifying characteristics. Effective toxicity classification
can safeguard these vulnerable groups from harmful hate speech. and discrimination,
promoting social justice and equality.
 Manually moderating comments is time-consuming and costly for social media
platforms. Developing automated toxicity classification systems can streamline the
moderation process, reduce costs, and improve efficiency, allowing platforms to focus
on other critical aspects of user experience and community building.

1.3 OBJECTIVES
 The primary objective is to create a deep learning model which can accurately classify
toxic comments from different social media platforms. This model ought to be capable
of distinguishing different types of toxicity, such as threats, obscenity, insults, identity-
based hate, and severe toxicity, with high precision and recall.

 To improve the model's understanding of context within comments. This involves


implementing techniques like word embeddings, attention mechanisms, and other NLP
approaches to ensure that the model can correctly interpret the sentiment and intent
behind words and phrases.

 To minimize the rate of wrong positives and wrong negatives in toxicity classification.
This involves fine-tuning the model to avoid misclassifying benign comments as toxic
and ensuring that genuinely toxic comments are accurately identified.

Dept. of ISE, BMSIT 2023-24 3


Comment Toxicity Classification Using Deep Learning Literature Survey

CHAPTER II

LITERATURE SURVEY
[1] A. Garlapati, N. Malisetty and G. Narayanan, "Classification of Toxicity in
Comments using NLP and LSTM," 2022 8th International Conference on Advanced
Computing and Communication Systems (ICACCS), Coimbatore, India, 2022.
The document discusses various Natural Language Processing and Machine Learning
techniques used for toxicity classification in online comments. It highlights specific methods
and tools commonly used in NLP, including parts of speech (POS), named entity recognition
(NER), and text preprocessing techniques such as stop word removal and stemming. The
document also explores the deployment of deep learning models, specifically Long Short
Term Memory and Gated Recurrent Unit, for classifying toxic comments. Additionally, it
mentions the use of Spacy NLP for text processing and PyLDAVis, a visualization tool for
topic modeling. These are the key points outlined in the provided excerpts.
[2] K. A. Kumar and B. Kanisha, "Analysis of Multiple Toxicities Using ML Algorithms
to Detect Toxic Comments," 2022 2nd International Conference on Advance Computing
and Innovative Technologies in Engineering (ICACITE),2022.
The document outlines a comprehensive approach to developing a deep learning model for toxic
comment classification. It uses the jigsaw toxic comments dataset from Kaggle and employs TF-
IDF for text vectorization during preprocessing. The neural network is built with Keras,
integrating layers like Embedding, Bidirectional LSTM, and Fully Connected Layers to process
and classify comments. The training process involves using backpropagation and gradient descent
optimization, with dataset splitting for training and validation, and cross-validation for
hyperparameter tuning. Potential avenues for future research involve improving the model with
additional features, addressing ethical considerations like bias mitigation, and exploring evolving
communication dynamics. The document concludes by emphasizing the need for ethical
deployment of content moderation systems, balancing toxicity moderation with the principles of
free speech.

Dept. of ISE, BMSIT 2023-24 4


Comment Toxicity Classification Using Deep Learning Literature Survey

[3] Rahul, H. Kajla, J. Hooda and G. Saini, "Classification of Online Toxic Comments
Using Machine Learning Algorithms," 2020 4th International Conference on Intelligent
Computing and Control Systems (ICICCS), Madurai, India, 2020.
The document explores the classification of toxic online comments through various machine
learning algorithms. It emphasizes the significance of this task to mitigate harm in society,
referring to instances where people have been detained due to harmful content on social
media. It underscores the importance of identifying and removing harmful content before
publishing to prevent further incidents. The paper discusses six machine learning
techniques—logistic regression, random forest, SVM classifier, naive bayes, decision tree,
and KNN classification—used to classify toxic comments within the Kaggle dataset. It
describes the process of data cleaning and exploratory visualization to extract features for
model development. The document details how ML techniques were applied and then
compares their results using evaluation metrics such as accuracy, hamming loss, and log loss
to determine their effectiveness in detecting toxic comments.
[4] M. Husnain, A. Khalid and N. Shafi, "A Novel Preprocessing Technique for Toxic
Comment Classification," 2021 International Conference on Artificial Intelligence
(ICAI), Islamabad, Pakistan, 2021.
The document outlines a preprocessing technique for toxic comment classification,
emphasizing the importance of feature extraction and engineering. Key steps in this process
include tokenization, removing stop words, stemming, and analysing n-grams. By applying
these methods, a dataset was created with ten thousand word vectors for each comments to
train and evaluate ML algorithms. The document presents results from cross-validation with
various classification models, including Logistic Regression and Naive Bayes, with box plots
to compare model accuracies and variations. These results demonstrate the different machine
learning models and approaches in classifying toxic comments while addressing the potential
for overfitting and other challenges.
[5] M. Aquino et al., "Toxic Comment Detection: Analyzing the Combination of Text
and Emojis," 2021 IEEE 18th International Conference on Mobile Ad Hoc and Smart
Systems (MASS), Denver, CO, USA, 2021.
The document explores the combination of textual data and emoticons to identify comments
that may be toxic or harmful within a specific context. It investigates the patterns in text and
emojis that could indicate toxic content, providing a more comprehensive approach to

Dept. of ISE, BMSIT 2023-24 5


Comment Toxicity Classification Using Deep Learning Literature Survey

comment analysis. The document also outlines various algorithms and techniques used for
detecting and categorizing toxic comments. These methodologies could be instrumental in
developing novel approaches for comment moderation on online platforms, allowing for
better identification of harmful content that may not be captured through text-based analysis
alone.
[6] V. Swetha, R. Anuhya, E. S. Sowmya and A. Geethanjali, "Building a Toxic Comments
Classification Model," 2021 5th International Conference on Electronics,
Communication and Aerospace Technology (ICECA), Coimbatore, India, 2021.
The document explores the process of building a toxic comments classification model that
employs a range of machine learning algorithms. It discusses the importance of accuracy and
hamming loss metrics in evaluating the performance of these algorithms and determining the
most toxic comment. Information design principles are highlighted as crucial for bridging the
gap between data frameworks and clients, ensuring effective information availability and
exchange strategies. The dataset from Kaggle, specifically the Kaggle Toxic Comments
dataset, is utilized for calculations to identify the most precise technique. The document
outlines the system structure, including dataset handling, module implementation such as
Count Vectorizer, and the utilization of ML algorithms like SVM, Naive Bayes, Logistic
Regression, Random Forest, Decision Tree, and KNN. It emphasizes the significance of
assessment measurements in gauging the quality of these machine learning algorithms.
[7] I. Gladwin, E. V. Renjiro, B. Valerian, I. S. Edbert and D. Suhartono, "Toxic Comment
Identification and Classification using BERT and SVM," 2022 8th International
Conference on Science and Technology (ICST), Yogyakarta, Indonesia, 2022.
SVM is recognized for its strong performance in text classification, often achieving higher
accuracy compared to other classification algorithms. It accomplishes this by reducing
empirical misclassification and maximizing geometric margins through predefined
hyperplanes. The document outlines the BERT architecture, which employs a two-way,
multi-layer Transformer encoder with a self-attention mechanism. BERT uses specific tokens
like [CLS] and [SEP] for sequence classification tasks. The classification process
encompasses several stages, which includes folding, tokenizing, filtering, stemming, and
splitting the data into train and test sets. These preprocessing steps are important for
preparing text for both SVM and BERT model.

Dept. of ISE, BMSIT 2023-24 6


Comment Toxicity Classification Using Deep Learning Literature Survey

[8] K. Dubey, R. Nair, M. U. Khan and P. S. Shaikh, "Toxic Comment Detection using
Comment Toxicity Classification Using Deep Learning Literature Survey

LSTM," 2020 Third International Conference on Advances in Electronics, Computers


and Communications (ICAECC), Bengaluru, India, 2020.
The document discusses about toxic text classifier model using Long Short-Term Memory
and artificial neural networks. It outlines the key steps in the design and implementation
process, which include data preprocessing, dataset analysis, and the utilization of LSTM to
mitigate issues related to vanishing and exploding gradients. The structure of artificial
neurons and LSTM's extended capabilities, which allow the network to retain long
sequences, are also explained. These characteristics make LSTM a suitable choice for
processing sequential text data and for addressing common challenges in training deep
neural networks.

SL. TITLE AUTHORS METHODOLOGY LIMITATIONS


NO.
1 Classification of Garlapati, Anusha, 1. Long Short-Term Memory (LSTM) LSTM and GRU are
Toxicity in Comments Neeraj Malisetty, and 2. Gated Recurrent Unit. often considered black
using NLP and LSTM, Gayathri Narayanan LSTM model achieved accuracy of boxes, making it
2022. 94% and GRU model achieved challenging to interpret
accuracy of 92%. how they arrive at their
predictions
2 Analysis of Multiple K. A. Kumar and B. The neural network is built with challenges in accurately
Toxicities Using ML Kanisha Keras, integrating layers like capturing all nuances of
Algorithms to Detect Embedding, Bidirectional LSTM language, the potential
Toxic Comment, 2022 for biases in the data.

3 Classification of Online Rahul, Jatin Hooda, The methodology involved data specific models and
Toxic Comments Using Harsh Kajla, Gajanand preprocessing steps such as algorithms, such as
Machine Learning Saini converting short phrases to their NLP, LTS M, CNN, and
Algorithms,2020. original forms, removing stop Logistic Regression are
words, eliminating links and used, but it might not
hashtags, lemmatization, parts of cover all existing
speech tagging, and converting models and algorithms
words to lowercase. used in toxic comment
classification.

Dept. of ISE, BMSIT 2023-24 7


Comment Toxicity Classification Using Deep Learning Literature Survey

4 A Novel Preprocessing Husnain, Includes logistic Not following grammar rul


Technique for Toxic Muhammad, Regression, decision tree containing an unreasona
Comment Classification, Khalid, Adnan & and Naive Bayes number of punctuations and
2021. Shafi, Numan classification. proper sentence structure.

5 Analysing combination Michael Aquino, The methodology used in Some limitations in


of text and emoji, 2021 Yasiris Ortiz, document involves the such as relying on
Arif Rashid, presentation of research rule-based systems and
Anne M. Tumlin, findings and insights from curated lists of offensive
N. Sertac Artan, the conference, focusing on word
and Huanying Gu topics related to mobile ad
hoc and smart systems.
6 Building a Toxic V. Swetha, It discusses the importance limitations include the need
Comments R. Anuhya, of accuracy and hamming a specific methodology to
Classification E. S. Sowmya, loss metrics in evaluating identify and classify harmful
Model, 2021 A. Geethanjali the performance of these comments, the challenge of
algorithms and determining accurately characterizing the
the most toxic comment. harmfulness of comments

7 Toxic Comment I. Gladwin, The methodology involved specific models and


Identification and E. V. Renjiro, data preprocessing steps algorithms, such as NLP,
Classification using B. Valerian, such as converting short LTS M, CNN, and Logistic
BERT and SVM, 2022. I. S. Edbert phrases to their original Regression are used, but it
D. Suhartono forms, removing stop words, might not cover all existing
eliminating links and models and algorithms used
hashtags, lemmatization, in toxic comment
parts of speech tagging, and classification.
converting words to
lowercase.

Dept. of ISE, BMSIT 2023-24 7


Comment Toxicity Classification Using Deep Learning Literature Survey

8 Toxic Comment Dubey K, The methodology involved data limitations


Detection using Nair R, preprocessing steps such as surrounding the
LSTM, 2020 Khan M. U, converting short phrases to manual reviewing of
Shaikh S. their original forms, removing offensive content
stop words, eliminating links online, highlighting
and hashtags, lemmatization, that it is labor-
parts of speech tagging, and intensive and time-
converting words to lowercase. consuming.

2.1 EXISTING SYSTEM


The existing systems used in prediction of comment toxicity are: Machine learning
approaches using logistic regression, SVM, random forest, Deep learning approach
using CNN.
2.2 PROBLEM STATEMENT
To develop a prototype of online hate and abuse comment classifier which is used to
classify hate and offensive comments so that, it can be controlled and restricted from
spreading hatred and cyberbullying.
2.3 PROPOSED SYSTEM
Project addresses the need to filter out hate speech, abusive comments, and toxic
language from social media. Due to the rapid increase in growth of online
communication, the prevalence of hateful and abusive comments poses a threat to
individuals' emotional and mental well-being. [2] Manual monitoring and filtering of
these comments have become impractical due to the volume of online content.
Therefore, there is a critical need for an automated method to accurately identify and
classify toxic comments to create a safer and cleaner online environment. This project
aims to leverage deep learning models, for development of text classifier that can
effectively and efficiently distinguish between toxic and non-toxic comments.

Dept. of ISE, BMSIT 2023-24 7


Comment Toxicity Classification Using Deep Learning Software Requirement Specification

CHAPTER III

SOFTWARE REQUIREMENT SPECIFICATION


3.1 FUNCTIONAL REQUIREMENTS

 System Input: The model should accept text comments as input for analysis.
 Toxicity Classification: The model should classify the input comments into various
categories of toxicity, possibly including "Severe Toxic," "Insult," and others.
 Natural Language Processing (NLP) Techniques: The modelshould utilize NLP
techniques like TF-IDF (Term Frequency-Inverse Document Frequency) to process
and also understand the comments.

 Machine Learning Model: The model should employ a Long Short-Term Memory
(LSTM) based ML model to perform the comment toxicity classification. 

3.2 NON - FUNCTIONAL REQUIREMENTS

 Performance: The system must efficiently process large datasets of tweets and
comments and deliver classification results quickly.
 Accuracy: The system should achieve a high level of accuracy in classifying toxic
and non-toxic comments to make sure the toxicity classifier works effectively.
 Scalability: The system should be scalable to handle increasing volumes of data
and users without a significant degradation in performance.
 Usability: The model should have user-friendly interface and be easily accessible
for users to input and retrieve information without the need for specialized training.
 Reliability: The system should be reliable, with consistent and dependable
performance in classifying toxic comments across different datasets.

Dept. of ISE, BMSIT 2023-24 8

3.3 Hardware Requirements:


 System: The computer's hardware processor type, indicating an Intel Core i3 10th
Comment Toxicity Classification Using Deep Learning Software Requirement Specification

generation.
 Hard Disk: The storage capacity of the computer, measuring 256GB.
 Ram: The amount of system memory available for running programs, which is 8GB.

Software Requirements:
 Operating system: The base software environment used for running programs, in
this case, Windows.
 Software Tool: The specific software application utilized for data handling and
analysis, which is Microsoft Excel 2013.
 Dataset: The collection of data used for analysis or model training, sourced from
[Link].
 Programming Language: The coding language used to implement and run the
project, specified as Python 3.6.9.
 Platform: The cloud-based development environment for coding and collaborating,
identified as Google Colaboratory.

Dept. of ISE, BMSIT 2023-24 9


Comment Toxicity Classification Using Deep Learning System Architecture

CHAPTER IV

SYSTEM ARCHITECTURE

According to the figure 4.1, the system architecture utilizes a combination of Natural Language
Processing and Long Short-Term Memory networks to classify the toxicity of comments. First,
comments are likely retrieved from a source and preprocessed for removing unnecessary
information and standardize the text format. This preprocessing might involve removal of
special characters, converting text to lowercase, and applying stemming or lemmatization
techniques.

[4] Next, the comments are broken down into individual words or phrases, known as tokens.
Each token is then converted into a numerical representation using a pre-trained word
embedding technique, such as GloVe, which captures the semantic relationships between
words. This allows the model to understand the meaning conveyed by the words in a format
suitable for machine learning algorithms.

Fig 4.1: MODEL ARCHITECTURE

Dept. of ISE, BMSIT 2023-24 10


Comment Toxicity Classification Using Deep Learning System Architecture

The core of model lies in its use of LSTMs, a type of RNN adept at handling sequential data
like text. Unlike traditional neural networks, LSTMs can learn long-term dependencies
within sequences. This is crucial for comment classification, as the meaning of a word can
be influenced by its position in the sentence and the overall context of the comment. For
instance, the word "bad" might not be inherently toxic, but it could be indicative of toxicity
when used in a certain context, like "you're bad at this game." The LSTM layer in the model
is designed to capture these subtleties.

Following the word embeddings, the architecture might include convolutional layers, which
are commonly used in image processing but can also be effective for text classification. [5]
These layers aim to extract local features from the sequence of word embeddings, such as n-
grams (sequences of consecutive words) that might be indicative of toxicity. If convolutional
layers are present, they might be followed by max pooling layers reduces the number of
parameters in the model and help prevent overfitting, a condition where the model performs
well on training data but poorly on unseen data.

Finally, the output from the LSTM layer is fed into a fully connected layer. This layer maps
the information from the LSTM to a set of output neurons, typically two in this case - one
for "toxic" and one for "non-toxic”. [6] A sigmoid activation function is applied to the
output of this layer, transforming the values between 0 and 1. This value represents the
probability of the input text belonging to the "toxic" class. A value closer to 1 signifies a
higher likelihood of toxicity.

By combining NLP techniques for text representation and LSTMs for capturing context, this
system architecture aims to effectively classify comments as toxic or non-toxic, promoting a
healthier online environment.

Dept. of ISE, BMSIT 2023-24 11


Comment Toxicity Classification Using Deep Learning Implementation

CHAPTER V

IMPLEMENTATION

1. Data Collection and Pre-processing:


In the first step, a dataset of text comments is collected. This data might be sourced from
social media platforms, online forums, or other sources.
The data is then cleaned and pre-processed. This could include stripping out unnecessary
elements like punctuation and common words. It might also require changing the text to
lowercase and applying stemming or lemmatization techniques

2. Train-Test Split:
Pre-processed data is then split into two sets: a training set and a test set.
Training set is used to train the LSTM model to identify toxic comments.
Test dataset is employed to assess how well the trained model performs.
3. Text Preparation:
Tokenization: The comments from the training set are split into individual words or tokens.
Text-to-Sequence Conversion: Every comment is transformed into a sequence of numbers,
with each number representing a word in the vocabulary.
Word-Index Dictionary: A dictionary is created that maps each word in the vocabulary to a
unique integer. This dictionary is employed to convert the text comments into sequences of
numbers.
Sequence Padding: The Number sequences are extended with padding to make sure they are
all the same length. This is important for the LSTM model, which expects to receive inputs of
a fixed size.

4. Training:

The training data is fed into the LSTM model. The model learns to identify patterns in the
sequences of word vectors that are indicative of toxic comments.

Dept. of ISE, BMSIT 2023-24 12


Comment Toxicity Classification Using Deep Learning Implementation

Fig 5.1: PROJECT FLOW DIAGRAM

5. Evaluation:

The test data is fed into the trained model. The model predicts whether each comment in the
test set is toxic or non-toxic. The model’s performance is evaluated by comparing its
predictions to the actual labels of the comments in the test set.

Dept. of ISE, BMSIT 2023-24 13


Comment Toxicity Classification Using Deep Learning Implementation

6. Output:

Once a model is determined to have sufficient performance, it can be deployed. Toxic


comments were analysed using natural language processing (NLP). An LSTM model was
used for evaluation, and it predicted the level of toxicity in the test data. The LSTM model,
once trained, achieved an accuracy rate of 94%, indicating strong performance. The fig 5.1
illustrates a user interface designed for front-end interaction, allowing users to submit
comments for toxicity classification. The system would predict a toxicity classification
(toxic or non-toxic) and potentially the type of toxicity for the input comment.

In the below figure, the model outputs a dictionary with labels like “toxic” and “insult”
marked as “True,” while “threat” is marked as “False.” This indicates that the model has
classified the provided comment as toxic and insulting, but not threatening.

Fig 5.2: OUTPUTS

Dept. of ISE, BMSIT 2023-24 14


Comment Toxicity Classification Using Deep Learning Implementation

CHAPTER VI

APPLICATIONS

1. Social Media Platforms:

 Content Moderation: Social media platforms receive massive amounts of comments


daily. Deep learning models analyzes comments in real-time, flagging potentially toxic
ones for human moderators to review. This helps maintain a civil online environment
and reduce exposure to harassment and cyberbullying.
 Automated Warnings/Removals: For clearly toxic comments, the model could
automatically issue warnings to users or remove the comments entirely. This creates a
more immediate deterrent effect.

2. Online Forums and Chat Rooms:

 Promoting Healthy Discussions: Similar to social media, forums and chat rooms can
benefit from real-time toxicity detection. This fosters a more respectful and productive
conversation space.
 Spam and Bot Detection: Toxic comments are often used by spammers and bots. Real
time analysis can help identify and filter out such malicious activity.

3. Customer Service Interactions:

 Identifying Upset Customers: Deep learning models analyzes customer comments on


company websites or social media to identify potentially frustrated or angry customers.
This allows companies to prioritize these interactions and address concerns promptly.
 Improving Customer Service Agent Training: Real-time toxicity detection can be
used to analyze past interactions and identify situations where agents might have
benefited from de-escalation techniques.

Dept. of ISE, BMSIT 2023-24 15


Comment Toxicity Classification Using Deep Learning Conclusion and Future Work

CHAPTER VII

CONCLUSION AND FUTURE WORK

While various techniques can be used for text classification, Long Short-Term Memory
(LSTM) neural networks have proven particularly adept at this task. Their ability to handle
sequential data, like the order of words in a sentence, makes them well-suited for
understanding the nuances of language. When trained on a comprehensive and relevant dataset,
LSTM models can achieve results on unseen data. In this instance, the model successfully
classified sentences as toxic or non-toxic, and even went a step further by estimating the
probability of each classification. This probabilistic output, often represented as a percentage,
provides valuable insights into the model's confidence level. The evaluation metrics, with a
precision of 94.49%, recall of 92.79%, and accuracy of 94.94%, demonstrate the model's
effectiveness in identifying toxic language on the test data. These results are promising and
suggest that the model has the potential to be valuable tool for tasks like content moderation or
sentiment analysis.

Future work:

• Multilingual capabilities: Current systems primarily focus on English. Expanding to


other languages would broaden the reach and impact.
• Nuance and Context: Detecting sarcasm, humor, and cultural references remains a
challenge. Models should account for these subtleties to avoid misclassifications.
• Explainable AI: Making complex models more interpretable will build trust and allow for
targeted improvements.
• Evolving Online Language: Online slang and emerging forms of toxicity require
continuous adaptation of the model and data collection.
• Addressing Bias and Fairness: Bias in training data can lead to unfair or discriminatory
outcomes. Techniques to debias models and ensure fairness across different demographics
are crucial.

Dept. of ISE, BMSIT 2023-24 16


REFERENCES
[1] A. Garlapati, N. Malisetty and G. Narayanan, "Classification of Toxicity in Comments
using NLP and LSTM," 2022 8th International Conference on Advanced Computing and
Communication Systems (ICACCS), Coimbatore, India, 2022.
[2] K. Dubey, R. Nair, M. U. Khan and P. S. Shaikh, "Toxic Comment Detection using
LSTM," 2020 Third International Conference on Advances in Electronics, Computers and
Communications (ICAECC), Bengaluru, India, 2020.
[3] Rahul, H. Kajla, J. Hooda and G. Saini, "Classification of Online Toxic Comments Using
Machine Learning Algorithms," 2020 4th International Conference on Intelligent Computing
and Control Systems (ICICCS), Madurai, India, 2020.
[4] M. Husnain, A. Khalid and N. Shafi, "A Novel Preprocessing Technique for Toxic
Comment Classification," 2021 International Conference on Artificial Intelligence (ICAI),
Islamabad, Pakistan, 2021.
[5] M. Aquino et al., "Toxic Comment Detection: Analyzing the Combination of Text and
Emojis," 2021 IEEE 18th International Conference on Mobile Ad Hoc and Smart Systems
(MASS), Denver, CO, USA, 2021.
[6] V. Swetha, R. Anuhya, E. S. Sowmya and A. Geethanjali, "Building a Toxic Comments
Classification Model," 2021 5th International Conference on Electronics, Communication and
Aerospace Technology (ICECA), Coimbatore, India, 2021.
[7] Garlapati, N. Malisetty and G. Narayanan, "Classification of Toxicity in Comments using
NLP and LSTM," 2022 8th International Conference on Advanced Computing and
Communication Systems (ICACCS), Coimbatore, India, 2022.
[8] I. Gladwin, E. V. Renjiro, B. Valerian, I. S. Edbert and D. Suhartono, "Toxic Comment
Identification and Classification using BERT and SVM," 2022 8th International Conference
on Science and Technology (ICST), Yogyakarta, Indonesia, 2022.
[9] K. A. Kumar and B. Kanisha, "Analysis of Multiple Toxicities Using ML Algorithms to
Detect Toxic Comments," 2022 2nd International Conference on Advance Computing and
Innovative Technologies in Engineering (ICACITE),2022.
[10] Ashish, A. Rani and H. Shyan, "A Comparative Study and Analysis on Toxic Comment
Classification," 2023 International Conference on Sustainable Computing and Smart Systems
(ICSCSS), Coimbatore, India, 2023.

Dept. of ISE, BMSIT 2023-24 17


[11] R. Vinaya Kumar, K.P. Soman and P. Poorna Chandran, “Long short-term memory
based operating log anomaly detection,” 2017 International Conference on Advances in
Communicating, Communications and Informatics (ICACCI), 2017, pp. 236-242.
[12] R. Vinaya Kumar “Amrita-CEN-Senti-DB: Twitter Dataset for Sentimental Analysis and
Application of Classical Machine Learning and Deep Learning.”, TechRxiv (2020).
[13] P. Ram Manohar, “Toxicity of Ayurvedic Medicines and Safety Concerns: Ancient and
Modern Perspectives, In History of Toxicology and Environment Health, Toxicology in
Antiquity” (Second Addition), Academic Press, 2019, ISBN 9780128153390.
[14] Se, S., Vinaya Kumar, R., Kumar, M.A., Soman, K.P. “AMRITA – CEN@SAIL2015:
Sentiment Analysis in Indian Languages. MIKE (2015).
[15] Kakuthota Rakshitha, Ramalingam HM, M Pavithra, Advi HD, Maithri Hedge,
“Sentiment Analysis of Indian regional languages on social media,” Global Transitions
Proceedings, Volume 2, Issue 2, 2021, Pages 414-420.
[16] Guizhu Shen, Qingping Tan, Haoyu Zhang, Ping Zeng, Jianjun Xu, “Deep Learning with
Gated Recurrent Unit Networks for Financial Sequence Predictions”, 8th International
Congress of Information and Communication Technology (ICICT – 2018).
[17] R. Dey and F.M Salem, “Gate-Variants of Gated Recurrent Unit (GRU) Neural
Networks,” International Midwest Symposium on Circuits and Systems (MWSCAS), 2017.
[18] A. Akshith Sagar, J. Sai Kiran, “Toxic Comment Classification using Natural Language
Processing,” International Research Journal of Engineering and Technology (IRJET), 2020.
[19] Navoneel Chakrabarty, “A Machine Learning Approach to Comment Toxicity
Classification,” International Conference on Computational Intelligence in Pattern
Recognition(CIPR), 2019.
[20] P. Vidyullatha, Satya Narayanan Padhy, Javvaji Geetha Priya, Kakarlapudi Srija, Sri
Satyanjani Koppisetti, “Identification and Classification of Toxic Comments Using Machine
Learning Methods,” International Journal of Research and Innovation in Applied
Science(IJRIAS), 2021.

Dept. of ISE, BMSIT 2023-24 18

You might also like