0% found this document useful (0 votes)
14 views44 pages

Cyberbullying Detection on Twitter Using ML

Uploaded by

teju20043
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)
14 views44 pages

Cyberbullying Detection on Twitter Using ML

Uploaded by

teju20043
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

Introduction Detection and prediction of Future Mental disorder from Social Media Data

Using Machine Learning, Ensemble Learning, and Large Language Models.

1. INTRODUCTION
Social media platforms are nowadays used by almost every single person on earth.
People use it to express their feelings and attitudes towards everything, including
other people, products, weather, social events, and political issues. Natural language
processing and new techniques have also led to the development of many new
technological advancements that are used by all people in their ordinary life. Most
and modern techniques used by people worldwide are Machine translation,
information extraction, information retrieval, question answering, text memorization,
automatic assistance, and recommendation chat-bots and apps, etc. Together Social
media platforms with and have made a lot of things easier to people, like fast
communication across different countries, giving people the ability to know news
that happens everywhere on spot, not just that but it gave them the ability to express
what they think and feel using posts and comments.

1.1 Purpose
Social media networks such as Facebook, Twitter, Flickr, and Instagram have become
the preferred online platforms for interaction and socialization among people of all
ages. While these platforms enable people to communicate and interact in previously
unthinkable ways, they have also led to malevolent activities such as cyber-bullying.
Cyberbullying is a type of psychological abuse with a significant impact on society.
Cyber-bullying events have been increasing mostly among young people spending
most of their time navigating between different social media platforms. Particularly,
social media networks such as Twitter and Facebook are prone to CB because of their
popularity and the anonymity that the Internet provides to abusers. In India, for
example, 14 percent of all harassment occurs on Facebook and Twitter, with 37
percent of these incidents involving youngsters. Moreover, cyberbullying might lead
to serious mental issues and adverse mental health effects. Most suicides are due to
the anxiety, depression, stress, and social and emotional difficulties from cyber-
bullying events.

1
Introduction Detection and prediction of Future Mental disorder from Social Media Data
Using Machine Learning, Ensemble Learning, and Large Language Models.

1.2 Scope
This motivates the need for an approach to identify cyberbullying in social media
messages (e.g., posts, tweets, and comments). In this article, we mainly focus on the
problem of cyberbullying detection on the Twitter platform. As cyberbullying is
becoming a prevalent problem in Twitter, the detection of cyberbullying events from
tweets and provisioning preventive measures are the primary tasks in battling
cyberbullying threats. Therefore, there is a greater need to increase the research on
social networks-based CB in order to get greater insights and aid in the development
of effective tools and approaches to effectively combat cyberbullying problem.
Manually monitoring and controlling cyberbullying on Twitter platform is virtually
impossible. Furthermore, mining social media messages for cyberbullying detection
is quite difficult. For example, Twitter messages are often brief, full of slang, and
may include emojis, and gifs, which makes it impossible to deduce individuals’
intentions and meanings purely from social media messages. Moreover, bullying can
be difficult to detect if the bully uses strategies like sarcasm or passive-aggressiveness
to conceal it. Despite the challenges that social media messages bring, cyberbullying
detection on social media is an open and active research topic. Cyberbullying
detection within the Twitter platform has largely been pursued through tweet
classification and to a certain extent with topic modeling approaches. Text
classification based on supervised machine learning (ML) models are commonly used
for classifying tweets into bullying and non-bullying tweets. Deep learning (DL)
based classifiers have also been used for classifying tweets into bullying and non-
bullying tweets. Supervised classifiers have low performance in case the class labels
are unchangeable and are not relevant to the new events.

1.3 Need For System


Utilize Twitter API to collect tweets containing relevant keywords associated with
cyberbullying. Split the labeled dataset into training and testing sets. Train a machine
learning model (e.g., Support Vector Machine, Naive Bayes, Random Forest) using
the training data. Optimize model hyperparameters using techniques like grid search
or random search. To evaluate the efficacy of the DEA-RNN model, comprehensive
experimentation was conducted using a dataset comprising 10,000 tweets.
Comparative analysis was performed against state-of-the-art algorithms including Bi-
2
Introduction Detection and prediction of Future Mental disorder from Social Media Data
Using Machine Learning, Ensemble Learning, and Large Language Models.

directional Long Short Term Memory (Bi-LSTM), SVM, Multinomial Naive Bayes
(MNB), and Random Forests (RF). The experimental findings consistently
demonstrate the superior performance of DEA-RNN across various scenarios.
Notably, in scenario 3, the model exhibited exceptional accuracy, precision, recall,
F1-score, and specificity, achieving an average of 90.45%, 89.52%, 88.98%, 89.25%,
and 90.94% respectively. Defines the critical issue of CB on social media platforms
and proposes a cutting-edge solution in the form of the DEA-RNN hybrid deep
learning model. Through meticulous experimentation and comparative analysis, the
effectiveness of the proposed model is established, showcasing its superiority over
existing approaches in detecting instances of CB on the Twitter platform.

1.3.1 Existing System


utilized the SVM and Information Gain based feature selection method for detecting
cyberbullying events in tweets. Muneer and Fati used various classifiers, namely
AdaBoost, Light Gradient Boosting Machine, SVM, RF, Stochastic Gradient Descent,
Logistic Regression, and Multinomial Naive Bayes, for cyberbullying events
identification in tweets. This study extracted features using Word2Vec and TF-IDF
methods. Dalvi et al. used SVM and Random Forests models with TF-IDF for feature
extraction for detecting cyberbullying in tweets. Although SVM in these models
achieved high performance, the model complexity increases when the class labels are
increased. Al-garadi et al. investigated cyberbullying identification using different
ML classifiers such as RF, Naïve Bayes, and SVM based on various extracted
features from Twitter such as tweet content, activity, network, and user. Huang et al.
suggested an approach for identifying CB from social media, which integrated the
social media features and textual content features. The features are ranked using
Information Gain method. Well-known classifiers such as Naïve Bayes, J48, and
Bagging and Dagging are utilized. The findings implied that social characteristics
could aid in increasing the accuracy of cyberbullying detection. Squicciarini et al.
utilized a decision tree classifier with social network, personal, and textual features to
identify Cyberbullying and cyberbullying prediction on social networks like
[Link] and MySpace. Balakrishnan et al. utilized different ML algorithms such as
RF, NB, and J48 to detect cyberbullying events from tweets and classify tweets to
different cyberbullying classes such as aggressors, spammers, bullies, and normal.

3
Introduction Detection and prediction of Future Mental disorder from Social Media Data
Using Machine Learning, Ensemble Learning, and Large Language Models.

The study concluded that the emotional feature does not impact the detection rate.
Despite its efficiency, this model is limited to a small dataset with fewer class labels.

Disadvantages
• The system is not implemented properly cyberbullying detection due to absence of an
effective ML classifiers.
• Difficulty in acquiring large, high-quality labeled datasets.
• High computational resource requirements for training and inference.
• Lack of interpretability in the model's predictions.
• Challenges in hyperparameter tuning and optimization.
• Variability in effectiveness across different linguistic and cultural contexts.

1.3.2 Proposed System


Propose a hybrid deep learning-based approach, called DEA-RNN, which
automatically detects bullying from tweets. The DEA-RNN approach combines
Elman type Recurrent Neural Networks (RNN) with an improved Dolphin
Echolocation Algorithm (DEA) for fine tuning the Elman RNN's parameters. DEA-
RNN can handle the dynamic nature of short texts and can cope with the topic models
for the effective extraction of trending topics. DEA-RNN outperformed the
considered existing approaches in detecting cyberbullying on the Twitter platform in
all scenarios and with various evaluation metrics. The contributions of this article can
be summarized as the following: Develop an improved optimization model of DEA
for use to automatically tune the RNN parameters to enhance the performance;
Propose DEA-RNN by combining the Elman type RNN and the improved DEA for
optimal classification of tweets; A new Twitter dataset is collected based on
cyberbullying keywords for evaluating the performance of DEA-RNN and the
existing methods; and The efficiency of DEA-RNN in recognizing and classifying
cyberbullying tweets is assessed using Twitter datasets. The thorough experimental
results reveal that DEA-RNN outperforms other competing models in terms of recall,
precision, accuracy, F1 score, and specificity.

4
Introduction Detection and prediction of Future Mental disorder from Social Media Data
Using Machine Learning, Ensemble Learning, and Large Language Models.

Advantages
• An effective models help in processing to extract meaningful topics.
• An effective system than which is mainly tested and trained by SVM, Multinomial
Naive Bayes (MNB),Random Forests (RF) classifiers.
• Enhanced capability to capture hierarchical features and temporal dependencies in
Twitter data.
• Improved accuracy in identifying cyberbullying instances.
• Robust performance across diverse cyberbullying scenarios and linguistic variations
• Potential for real-time processing and scalability in handling large-scale Twitter data
streams.

5
Introduction Detection and prediction of Future Mental disorder from Social Media Data
Using Machine Learning, Ensemble Learning, and Large Language Models.

1.4 Architecture

Fig.1.4 Architecture
6
SRS Detection and prediction of Future Mental disorder from Social Media Data
Using Machine Learning, Ensemble Learning, and Large Language Models.

2. Software Requirement Analysis And Specification


2.1 Product Perspective
An essential aspect necessitates assurance, which involves bridging the gap between
product management and development. It entails thoroughly defining a product in
terms of its associated requirements, encompassing all the necessary specifications
that must be explicitly described and continuously available.

Fig. 2.1 Product Perspective

2.2 Product Function


In product management, the product requirements specification serves as the central
tool, fulfilling the following purposes:

a) It articulates how product management addresses partner needs and requests.

b) It communicates to development teams what the product or new features to be


developed will entail.

c) The accompanying figure illustrates these relationships, focusing on the product


perspective.

d) Product management is responsible for defining a product perspective that aligns


with the expectations and requirements of the product's stakeholders. Additionally, it
should consider and serve relevant relationships with adjacent systems.

7
SRS Detection and prediction of Future Mental disorder from Social Media Data
Using Machine Learning, Ensemble Learning, and Large Language Models.

Fig. 2.2 Characteristics of product perspective

The key characteristics of the product perspective include:


• Describes the external view of the product.

• Answers the question "What"...

• Represents what the product is.

• Describes what the product does.

• Addresses both the business and usage aspects of the product.

• Utilizes problem domain language and concepts.

• Presents a "Black Box" view, focusing on the external behavior and functionality
of the product without delving into its internal workings.

8
SRS Detection and prediction of Future Mental disorder from Social Media Data
Using Machine Learning, Ensemble Learning, and Large Language Models.

2.3 User Characteristics


This section outlines the characteristics of users in three distinct contexts: the end
user who interacts with the machine translation system; the end user of the final
product of the translation process, which may include post-editing; the organization
producing the machine translation system.
Relevant stakeholders may include:

• Interpreters

• Post-editors

• Translation buyers

• Translation managers

• Higher-level

2.4 Modules
Data Collection and Preprocessing Module
This module collects twitter data and perform preprocessing by removing irrelevant
information as URLs, hashtags, mentions.

Word Embedding Module


It converts preprocessed text data into dense vector representations and utilizes pre-
trained model like word2vec to capture semantic relationships between words.

Text classification Module


Applies deep learning models as RNN for text classification. Trains the classification
model on labelled data where examples are annotated as cyberbullying and non-
cyberbullying.

Contextual Features Extraction Module


This module extract features from dataset and build training dataset and utilize DEA
to extract hierarchical representations of text data. Captures semantic features and
patterns in conversations.

9
SRS Detection and prediction of Future Mental disorder from Social Media Data
Using Machine Learning, Ensemble Learning, and Large Language Models.

2.5 Functional Requirements and Non-Functional Requirements


2.5.1 Functional Requirements
Functional requirements delineate the intended actions of the system and can be
segmented into various categories:

• Specifies the data the system should accept.

• Defines the results or data the system should generate.

• Determines the data that must be stored by the system.

• Describes the calculations or processes the system needs to perform.

Input Design:
Input design facilitates interaction between the information system and users,
establishing processes for data preparation and entry. It involves methods to
transform transaction data into usable formats, such as reading from documents or
direct entry. Input design aims to streamline processes, minimize errors, and ensure
user security and privacy. Key considerations include:

• Defining input data requirements.

• Organizing and coding data.

• Providing user guidance.

• Implementing input validations and error handling.

2.5.2 Non-Functional Requirement


Non-functional requirements (NFRs) address fundamental aspects of software
systems, focusing on qualities beyond specific functionalities. Failure to address
NFRs adequately can result in user dissatisfaction, software conflicts, and increased
time and cost to rectify issues.

Types of Non-Functional Requirements


• Scalability: The system's ability to handle increasing loads without
compromising performance.
• Reliability: The system's ability to perform consistently and predictably under
various conditions.

10
SRS Detection and prediction of Future Mental disorder from Social Media Data
Using Machine Learning, Ensemble Learning, and Large Language Models.
• Regulatory Compliance: Ensuring the system adheres to relevant regulations or
standards.
• Maintainability: Ease of maintaining and updating the system over time.
• Serviceability: The ease with which the system can be repaired or serviced.
• Utility: The usefulness and value provided by the system to users.
• Availability: Ensuring the system is accessible and operational when needed.
• Usability: The system's ease of use and user experience.
• Interoperability: The system's ability to interact and operate with other systems
or components.
• Environmental Considerations: Factors related to the environmental impact of
the system, such as energy consumption or sustainability.

Addressing non-functional requirements is crucial for ensuring the overall success


and effectiveness of a software system. Each requirement category contributes to the
system's overall performance, reliability, and user satisfaction, making them essential
considerations throughout the development lifecycle.

11
SRS Detection and prediction of Future Mental disorder from Social Media Data
Using Machine Learning, Ensemble Learning, and Large Language Models.

2.6. System Specifications


2.6.1. Software Requirements
➢ Operating System : Windows 11 Ultimate.
➢ Coding Language : Python.
➢ Front-End : Python.
➢ Back-End : Django

[Link] Requirements

➢ Processor : Intel i3 processor


➢ RAM : 4 GB(min)
➢ Hard Disk : 500 GB

12
SRS Detection and prediction of Future Mental disorder from Social Media Data
Using Machine Learning, Ensemble Learning, and Large Language Models.

2.7 SDLC Methodologies


Software Development Life Cycle Models and Methodologies

[Link] 2.7 SDLC

The Software Development Life Cycle (SDLC) is a series of stages that provide a
structured approach to the software development process. It encompasses
understanding the business requirements, eliciting needs, converting concepts into
functionalities and features, and ultimately delivering a product that meets business
needs. A proficient software developer should possess adequate knowledge to select
the appropriate SDLC model based on project context and business requirements.

Therefore, it is essential to select the right SDLC model tailored to the specific
concerns and requirements of the project to ensure its success. To explore more about
choosing the right SDLC model, you can follow this link for additional information.
Furthermore, to delve deeper into software lifecycle testing and SDLC stages, follow
the highlighted links here.

The exploration will cover various types of SDLC models, their benefits,
disadvantages, and when to use them. SDLC models can be viewed as tools to enhance
product delivery. Therefore, understanding each model, its advantages, disadvantages,
and the appropriate usage is crucial to determine which one suits the project context.

13
SRS Detection and prediction of Future Mental disorder from Social Media Data
Using Machine Learning, Ensemble Learning, and Large Language Models.

Types of Software developing life cycles (SDLC)

• Waterfall Model
• V-Shaped Model
• Evolutionary Prototyping Model
• Spiral Method (SDM)
• Iterative and Incremental Method
• Agile development

2.7.1 Waterfall Model


The Waterfall Model follows a linear, sequential flow, where progress moves steadily
downwards (like a waterfall) through the phases of software development. Each stage
in the development cycle begins only after the previous stage is completed. The
waterfall approach does not accommodate going back to a previous stage to address
changes in requirements. It is the oldest and most well-known method used for
software development. The five-stage waterfall model, based on Winston W. Royce's
requirements, divides development processes into the following stages:

• Analysis
• Design
• Implementation
• Testing
• Operation

14
SRS Detection and prediction of Future Mental disorder from Social Media Data
Using Machine Learning, Ensemble Learning, and Large Language Models.

The waterfall model can be broken down into multiple phases.:

[Link] 2.8.1 water fall model

Advantages
• Simple to clarify for the clients.
• Structures approach.
• Stages and exercises are distinct.
• Assists with arranging and timetable the task.

15
SRS Detection and prediction of Future Mental disorder from Social Media Data
Using Machine Learning, Ensemble Learning, and Large Language Models.

2.8 System Study

The feasibility study evaluates the practicality of the project and enhances fundamental
understanding through a comprehensive approach. During system assessment, the integrity
evaluation of the proposed structure is crucial to ensure it does not burden the organization.
Three key assessments conducted during feasibility appraisal are:

• Economic Feasibility

• Technical Feasibility

• Social Feasibility
Economic Feasibility
This study examines the financial impact of the system on the organization. It assesses the
resources available for system development and justifies expenses. The design should be
economically viable, leveraging freely available enhancements wherever possible, with
consideration given to necessary purchases.

Technical Feasibility
This study assesses the specific requirements of the system and ensures it does not overly
strain existing technical resources. Excessive demands on technical resources can lead to
burdens on users. The design should have modest technical requirements, minimizing
unnecessary changes.

Social Feasibility
This aspect examines the level of acceptance of the system by users. It involves
establishing effective means to familiarize users with the system and ensuring they
perceive it as a necessity rather than a threat. User confidence should be bolstered
through clear communication and user training. Social feasibility encompasses
analyzing how individuals interact within the system or organization and evaluating
social impacts to understand.

16
SRS Detection and prediction of Future Mental disorder from Social Media Data
Using Machine Learning, Ensemble Learning, and Large Language Models.

2.9 Methodology and Algorithms


Decision tree classifiers
Decision tree classifiers are widely applied across various domains due to their ability
to capture descriptive decision-making knowledge from provided data. One of their
most notable features is their capability to be generated from training sets. The
process for generating decision trees based on a set of objects (S), each belonging to
one of the classes C1, C2, …, Ck, unfolds as follows:

Step 1: If all objects in S belong to the same class (e.g., Ci), the decision tree for S
comprises a leaf labeled with this class.

Step 2: Otherwise, select a test (T) with potential outcomes (O1, O2,…, On). Each
object in S has a specific outcome for test T, thus partitioning S into subsets (S1,
S2,…, Sn), where each object in Si corresponds to outcome Oi for test T. Test T
becomes the root of the decision tree, and for each outcome Oi, a subsidiary decision
tree is constructed by recursively invoking the same procedure on set Si.

Block Diagram for Decision Tree Algorithm

Root Node: It represents the entire population or sample and this further gets divided
into two or more homogeneous sets.

Splitting: It is a process of dividing a node into two or more sub-nodes.

17
SRS Detection and prediction of Future Mental disorder from Social Media Data
Using Machine Learning, Ensemble Learning, and Large Language Models.

Decision Node: When a sub-node splits into further sub-nodes, then it is called the
decision node.

Leaf / Terminal Node: Nodes do not split is called Leaf or Terminal node.

Pruning: When we remove sub-nodes of a decision node, this process is called


pruning. You can say the opposite process of splitting.

Branch / Sub-Tree: A subsection of the entire tree is called branch or sub-tree.

Gradient boosting
Gradient boosting is a versatile machine learning technique employed in regression
and classification tasks, among others. It constructs a prediction model in the form of
an ensemble of weak prediction models, typically decision trees. When using decision
trees as the weak learner, the resulting algorithm is referred to as gradient-boosted
trees, often surpassing the performance of random forests. The construction of a
gradient-boosted trees model occurs in a stage-wise manner, similar to other boosting
methods, but it stands out by allowing the optimization of an arbitrary differentiable
loss function.

K-Nearest Neighbors (KNN)


K-Nearest Neighbors (KNN) is a straightforward yet highly effective classification
algorithm that operates based on a similarity measure. It is non-parametric and
employs lazy learning, meaning it does not "learn" until presented with a test
example. Whenever there is a new data point to classify, KNN identifies its K-nearest
neighbors from the training data and determines its classification based on their
majority vote or weight vote.

Logistic regression
Logistic regression analysis explores the relationship between a categorical dependent
variable and a set of independent variables. The term "logistic regression" is applied
when the dependent variable has only two values, such as 0 and 1, or Yes and No. On
the other hand, "multinomial logistic regression" is used when the dependent variable
has three or more unique values, like Married, Single, Divorced, or Widowed. While
the nature of data for the dependent variable differs from that of multiple regressions,
the practical application of the procedure remains similar.
18
SRS Detection and prediction of Future Mental disorder from Social Media Data
Using Machine Learning, Ensemble Learning, and Large Language Models.

Logistic regression serves as a competitor to discriminant analysis in analyzing


categorical-response variables. Many statisticians favor logistic regression due to its
versatility and suitability for modeling various situations compared to discriminant
analysis. This preference arises from logistic regression's ability to not assume that
the independent variables follow a normal distribution, unlike discriminant analysis

Naive Bayes
The naive Bayes approach is a supervised learning method founded on a simple
assumption: it presumes that the presence or absence of one feature of a class is
independent of the presence or absence of any other feature. Despite its simplicity, it
demonstrates robustness and efficiency comparable to other supervised learning
techniques. One explanation often highlighted in the literature is based on
representation bias.

The naive Bayes classifier operates as a linear classifier, akin to linear discriminant
analysis, logistic regression, or linear support vector machines (SVMs). However, the
distinction lies in the method used to estimate the classifier's parameters, known as
the learning bias. Although the naive Bayes classifier finds extensive use in the
research community due to its ease of programming, parameter estimation simplicity,
rapid learning even with large datasets, and reasonably good accuracy compared to
other methods, it remains less popular among practitioners seeking practical results.
Researchers appreciate its simplicity and efficacy. However, practitioners often
struggle with its interpretability and deployment, as they may not grasp its relevance
or utility.

Random forests
Random forests, also known as random decision forests, represent an ensemble
learning technique used for classification, regression, and other tasks. They function
by constructing numerous decision trees during training. For classification tasks, the
output of the random forest is determined by the class selected by the majority of
trees. Conversely, for regression tasks, the mean or average prediction of the
individual trees is returned. Random decision forests aim to mitigate the issue of
decision trees overfitting to their training set.

19
SRS Detection and prediction of Future Mental disorder from Social Media Data
Using Machine Learning, Ensemble Learning, and Large Language Models.

In general, random forests tend to outperform individual decision trees, although they
may have lower accuracy compared to gradient boosted trees. Nonetheless, the
performance of random forests can be influenced by the characteristics of the data.

The concept of random decision forests was first introduced in 1995 by Tin Kam Ho,
who utilized the random subspace method. This method, as formulated by Ho, serves
as an implementation of the "stochastic discrimination" approach to classification
initially proposed by Eugene Kleinberg.

Support Vector Machine (SVM)


Support Vector Machine (SVM) represents a discriminant machine learning
technique commonly used in classification tasks. It aims to find a discriminant
function, based on an independently and identically distributed training dataset, that
accurately predicts labels for newly acquired instances. Unlike generative machine
learning approaches, which necessitate computations of conditional probability
distributions, a discriminant classification function assigns a data point x to one of the
classes involved in the classification task. Compared to generative approaches,
discriminant methods may be less powerful, particularly in outlier detection
scenarios. However, they require fewer computational resources and less training
data, especially in multidimensional feature spaces and when only posterior
probabilities are necessary. Geometrically, learning a classifier equates to identifying
the equation for a multidimensional surface that optimally separates the different
classes in the feature space.

SVM is a discriminant technique that solves convex optimization problems


analytically, consistently yielding the same optimal hyperplane parameters. In
contrast, genetic algorithms (GAs) and perceptrons, both widely used for
classification in machine learning, may produce solutions highly dependent on
initialization and termination criteria. With a specific kernel transforming data from
the input space to the feature space, SVM training returns uniquely defined model
parameters for a given training set, whereas perceptron and GA classifier models vary
with each training iteration.

20
SRS Detection and prediction of Future Mental disorder from Social Media Data
Using Machine Learning, Ensemble Learning, and Large Language Models.

2.10. Technologies Used


Python

What Is a Script?
A script is a text file containing instructions that form a Python program, allowing
you to execute the program immediately in an interactive mode. Here are key points
about scripts:
Reusability: Scripts can be executed repeatedly without the need to retype the entire
code each time.
Editability: Scripts are editable, enabling you to make multiple versions by changing
statements from one file to another using a word processor. This facilitates the
creation of various tasks with minimal effort.
Creation Tools: Any text editor, such as Microsoft Notepad, Microsoft WordPad,
Microsoft Word, or any word processor, can be used to create Python script files.
Distinguishing Between a Script and a Program
Script:
Scripts are distinct from the core code of the application, often written or modified
near the end-user. They are typically translated from source code or bytecode, while
the applications they control are compiled to native machine code.
Program:
A program has an executable format that the computer can directly use to execute the
instructions. It can exist in both its logical source code form and as compiled
executable programs.
Python Overview:
Python is an open-source, general-purpose programming language known for its
simplicity and versatility. Here are some key features and concepts about Python

Object-Oriented, Procedural, Functional:


Python supports multiple programming paradigms, including object-oriented,
procedural, and functional programming.

21
SRS Detection and prediction of Future Mental disorder from Social Media Data
Using Machine Learning, Ensemble Learning, and Large Language Models.

Interpreted and Interactive:


Python is interpreted at runtime by the interpreter, allowing for immediate execution
without the need for compilation. It also offers an interactive environment where you
can interact with the interpreter directly.
Beginner-Friendly:
Python is considered an excellent language for beginner programmers due to its
simplicity and readability. It supports the development of a wide range of
applications, from simple text processing to web development and games.
Dynamic versus Static
Python is a dynamically-typed language, contrasting with statically-typed languages
like C/C++ and Java. In static languages, developers must explicitly declare the data
type of each variable, specifying whether it's an integer, float, or another type. For
instance, in C, declaring a variable to contain a floating-point number requires
specifying its type as "float".

However, Python eliminates the need for such explicit declarations. Variables in
Python are simply named containers that hold values. Python's interpreter
dynamically determines the data type of each variable based on the value assigned to
it. This flexibility allows Python to handle various data types seamlessly, even if they
change during program execution.

For example, if a variable is declared as a float but later assigned a value that exceeds
the range of a float, Python automatically promotes it to a double without requiring
explicit intervention. This dynamic behavior extends to operations like arithmetic,
where Python automatically adjusts the data type to accommodate the operands.

Python's approach to memory management is also dynamic. When a variable is


created, Python allocates memory dynamically based on the data type of the variable.
This dynamic memory allocation allows Python to adapt to changing data types and
sizes during program execution.

Python supports a variety of standard data types, including:

Numbers: Python's numeric data types store numerical values and are created when a
value is assigned to them.

22
SRS Detection and prediction of Future Mental disorder from Social Media Data
Using Machine Learning, Ensemble Learning, and Large Language Models.

Strings: Strings represent sequences of characters and can be enclosed in single or


double quotes. Python provides various string manipulation methods for working
with strings.

Lists: Lists are versatile data structures that can hold elements of different data types.
They are enclosed in square brackets and support indexing and slicing operations.

Tuples: Tuples are similar to lists but are immutable, meaning their elements cannot
be modified after creation. They are enclosed in parentheses and are often used for
fixed collections of data.

Dictionaries: Dictionaries are key-value pairs that allow mapping between keys and
corresponding values. They are enclosed in curly braces and support efficient lookup
operations

23
System design Detection and prediction of Future Mental disorder from Social Media Data
Using Machine Learning, Ensemble Learning, and Large Language Models.

3. System Design
3.1 Database Design (E-R Diagram)
An Entity-Relationship (ER) model illustrates the structure of a database using a
visual representation known as an Entity-Relationship Diagram (ER Diagram). This
model serves as a blueprint for designing the database schema and capturing the
relationships between different entities and attributes.

The ER model provides a systematic approach to organizing and conceptualizing the


data within a database system. It represents entities as well as the relationships
between them, helping to clarify how data elements are connected and organized.

3.1.1 ER model
1. The Emergency Room model corresponds to an Entity-Relationship model,
serving as a high-level representation of data structures. It is utilized to illustrate
the data components and relationships within a defined system.
2. It establishes a structured framework for the database. Moreover, it provides a
straightforward and easily understandable perspective on the data.
3. In Entity-Relationship modeling, the organizational database structure is
depicted through a design known as an Entity-Relationship diagram.
4. For instance, consider designing a school database. An educational record could
be represented as an entity with attributes such as name, ID, age, etc. Similarly,
the address could be another entity with attributes like city, street name, zip code,
etc., and there would be a relationship between them.

Fig no 3.1 ER-Model

24
System design Detection and prediction of Future Mental disorder from Social Media Data
Using Machine Learning, Ensemble Learning, and Large Language Models.

Component of ER Diagram

1. Entity
A substance may be anything, class, individual or spot. In the ER frame, a substance
can be tended to as square shapes.

Think about a relationship as a delineation chief, thing, specialist, office, etc can be
taken as a substance.

25
System design Detection and prediction of Future Mental disorder from Social Media Data
Using Machine Learning, Ensemble Learning, and Large Language Models.
[Link] Entity
A substance that depends upon another component called a frail substance. The frail
element contains no critical trait of its own. The feeble substance is addressed by a
twofold square shape.

2. Characteristic
The quality is utilized to depict the property of a section. Obscure is utilized to
address a quality.
For example, id, age, contact number, name, etc can be attributes of a student.

26
System design Detection and prediction of Future Mental disorder from Social Media Data
Using Machine Learning, Ensemble Learning, and Large Language Models.
a. Key Attribute
The key quality is used to address the essential ascribes of a substance. It tends to a
fundamental key. The key property is tended to by a circle with the text underlined.

b. Composite Attribute
A property that made from various attributes is known as a composite quality. The
composite trademark is tended to by an oval, and those circles are related with a
circle.

27
System design Detection and prediction of Future Mental disorder from Social Media Data
Using Machine Learning, Ensemble Learning, and Large Language Models.

c. Multivalued Attribute
A quality can have more than one worth. These qualities are known as a multivalued
property. The twofold oval is used to address multivalued property. For example, a
student can have more than one phone number.

d. Determined Attribute
A property that can be gotten from another quality is known as a decided attribute. It
will in general be tended to by a ran circle.

For example, a singular's age changes long term and can be gotten from one more
quality like Date of birth.

28
System design Detection and prediction of Future Mental disorder from Social Media Data
Using Machine Learning, Ensemble Learning, and Large Language Models.

3. Relationships
A relationship is used to depict the connection between substances. Important stone
or rhombus is utilized to address the relationship.

Sorts of relationship are as per the following:


a. One-to-One Relationship
At the point when just a single instance of a component is connected with the
relationship, then it is known as facilitated [Link] instance, A female can
wed to one male, and a male can wed to one female.

teacher 1 1 student
teach

b. One-to-many Relationship
Exactly when simply a solitary illustration of the substance on the left, and more than
one event of a component on the right associates with the relationship then this is
known as a one-to-various connections.
For example, Scientist can envision various manifestations, but the improvement is
done by the really express analyst.

Tweet server
1 1 m Remote user
has

29
System design Detection and prediction of Future Mental disorder from Social Media Data
Using Machine Learning, Ensemble Learning, and Large Language Models.

c. Many-to-One Relationship
Exactly when more than one event of the component on the left, and simply a solitary
event of a substance on the right associates with the relationship then it is known as a
many-to-one relationship.

For example, Student enrolls for only a solitary course, but a course can have various
students.

user M 1 Service
Reques provider
t

d. Many-to-Many Relationship
At the point when more than one event of the substance on the left, and more than one
event of a component on the right associates with the relationship then it is known as
a many-to-various connections.

For example, Employee can allot by numerous exercises and project can have various
specialists.

m users M M logins
has

30
System design Detection and prediction of Future Mental disorder from Social Media Data
Using Machine Learning, Ensemble Learning, and Large Language Models.

[Link] 3.2 E-R Diagram

31
System design Detection and prediction of Future Mental disorder from Social Media Data
Using Machine Learning, Ensemble Learning, and Large Language Models.

3.2 Normalization
Normalization is the primary method for optimizing data in a database to fulfill two
essential criteria:

Data dependencies are logical, ensuring that all related data items are stored together.
Normalization is crucial for various reasons, primarily because it enables databases to
occupy minimal disk space, resulting in enhanced performance.

Normalization is also referred to as data standardization.

The three primary types of normalization are outlined below. Note: "NF" stands for
"Normal Form."

First Normal Form(1NF)

Tables in 1NF should comply with certain standards:

1. Every cell should contain just a solitary (nuclear) esteem.


2. Each part in the table ought to be astoundingly named.
3. All characteristics in a part ought to connect with a comparative region.

UserID Username Password

015 John ********

016 Princess ********

027 Tom ********

028 Claire ********

029 Robert ********

Table no.3.3.1 1NF

32
System design Detection and prediction of Future Mental disorder from Social Media Data
Using Machine Learning, Ensemble Learning, and Large Language Models.

Second Normal Form (2NF)

Tables in 2NF ought to be in 1NF and not have any most of the way dependence (e.g.,
each non-prime quality ought to be dependent upon the table's fundamental key).

User Id Received Data pswd Login


through IOT

1 11 ******** Sign_up

2 12 ******** Sign_up

3 13 ******** Sign_up

4 14 ******** Sign_up

5 15 ******** Sign_up

Table no3.3.2 2NF

Third ordinary structure (3NF)

ID NAME EMAIL STATE CITY COUNTRY

11 Vijay vijay@[Link] AP RZP INDIA

12 Vinod vinod@[Link] AP RZP INDIA

13 Ramu Ramu@[Link] AP RZP INDIA

14 Vishnu vishnu@[Link] AP RZP INDIA

Table no 3.3.3 User Details

33
System design Detection and prediction of Future Mental disorder from Social Media Data
Using Machine Learning, Ensemble Learning, and Large Language Models.

User Details
USER PASSSWORD LOGIN
ID

server ******** Sign_up

Vijay ******** Sign_up

Table no3.3.4 User details

Boyce-Codd Normal Form (BCNF)


Normalization is a critical process in database management aimed at organizing
tables to minimize anomalies and ensure data integrity. It follows a series of stages
known as normal forms. These normal forms help structure tables efficiently and
reduce redundancy and inconsistency in data.

Unnormalized Form (UNF): The initial state of a table where data is not organized
according to any specific rules.

First Normal Form (1NF): In 1NF, each column contains atomic values, and there
are no repeating groups or arrays within a row.

Second Normal Form (2NF): 2NF requires that every non-key attribute be fully
functionally dependent on the primary key.

Third Normal Form (3NF): In 3NF, no transitive dependencies should exist,


meaning that non-key attributes should not depend on other non-key attributes.
Elementary Key Normal Form (EKNF): EKNF is a further refinement of 3NF,
emphasizing the use of elementary keys.
Boyce-Codd Normal Form (BCNF): BCNF addresses anomalies that may arise when
multiple candidate keys exist. It requires that for every non-trivial functional
dependency (X → Y), X must be a superkey.

Fourth Normal Form (4NF): To achieve 4NF, a table must be in BCNF and should
not have multi-valued dependencies.

34
System design Detection and prediction of Future Mental disorder from Social Media Data
Using Machine Learning, Ensemble Learning, and Large Language Models.

Normal Description
Form

First Normal From An alliance is in 1NF enduring it


contains an atomic worth.

Second Normal From An association will be in 2NF


expecting it is in 1NF and all
non-key credits are totally down
to earth ward on the fundamental
key.

Third Normal From An alliance will be in 3NF


enduring it is in 2NF and no
change dependence exists.

Boyce-codd Normal A more grounded importance of


From 3NF is known as Boyce Codd's
common design.

Forth Normal From An association will be in 4NF


expecting it is in Boyce Codd's
commonplace construction and
has no multi-regarded
dependence.

Fifth normal From An association is in 5NF. In case


it is in 4NF and contains no join
dependence, joining should be
lossless.

Essential Tuple Normal Form (ETNF): ETNF is a condition where each attribute in a
tuple is essential to the understanding of the tuple itself.
35
System design Detection and prediction of Future Mental disorder from Social Media Data
Using Machine Learning, Ensemble Learning, and Large Language Models.

Benefits of Normalization:
Reduction of data redundancy: Normalization helps eliminate redundant data by
organizing it efficiently across tables. Improved overall database organization: By
structuring data according to normalization rules, databases become more organized
and easier to manage. Data consistency within the database:

Normalization ensures that data remains consistent across tables, reducing the risk of
inconsistencies. More flexible database design:

Normalization allows for more flexibility in database design, making it easier to


accommodate changes and updates. Upholds the principle of data integrity:
Normalization promotes data integrity by minimizing anomalies and ensuring
accurate representation of data relationships.

Disadvantages of Normalization:
Careless decomposition: If normalization is done without a clear understanding of
user requirements, it can lead to excessive decomposition and unnecessary
complexity in the database design.

Decreased performance: As tables are normalized to higher normal forms such as


4NF or 5NF, it may lead to decreased performance due to increased join operations
and complexity in querying the database.

36
System design Detection and prediction of Future Mental disorder from Social Media Data
Using Machine Learning, Ensemble Learning, and Large Language Models.
3.3 UML Diagrams
The UML diagrams are arranged into fundamental charts, social frameworks, and
besides correspondence frame graphs. The diagrams are logically organized in the
going with figure:

[Link] 3.4 UML Diagram

37
System design Detection and prediction of Future Mental disorder from Social Media Data
Using Machine Learning, Ensemble Learning, and Large Language Models.
Use Case Diagram
A use case diagram in the Unified Modeling Language (UML) is a type of behavioral
diagram described and expressed using a Use-case analysis. Its objective is to present
a graphical representation of the value provided by a system in terms of actors, their
goals (represented as use cases), and any relationships between those use cases. The
primary purpose of a use case diagram is to illustrate which system functions are
performed for which actor.

register

login

Predict Dataset

User
View Dataset

View Accuracy

logut

[Link]: Use Case Diagram

38
System design Detection and prediction of Future Mental disorder from Social Media Data
Using Machine Learning, Ensemble Learning, and Large Language Models.

Class Diagram
In computer programming, a class diagram in the Unified Modeling Language (UML)
is a type of static structural diagram that illustrates the architecture of a system by
displaying the structure's classes, their properties, operations (or methods), and the
relationships among the classes. It delineates which class holds data.

user
username
password
emailid
phone number
adress
gender

Register()
Predict data()
Report()
logut()

[Link]: Class Diagram

39
System design Detection and prediction of Future Mental disorder from Social Media Data
Using Machine Learning, Ensemble Learning, and Large Language Models.

Sequence Diagram
A sequence diagram in Unified Modeling Language (UML) is a type of
communication diagram that illustrates how processes interact with each other and
the order in which they occur. It is a variation of a Message Sequence Chart.
Sequence diagrams are sometimes referred to as event diagrams, event scenarios, or
timing diagrams.

user dataset

register

login

Predict Message

View Result

Accuracy

logout

[Link]: 3.3.3 Sequence Diagram

40
System design Detection and prediction of Future Mental disorder from Social Media Data
Using Machine Learning, Ensemble Learning, and Large Language Models.

Component Diagram
A component diagram is used to break down a large object-oriented system into
smaller components, making them more manageable. It provides a physical view of a
system, such as executables, files, libraries, etc., that reside within the node.

It visualizes not only the relationships but also the organization between the
components present in the system. It assists in forming an executable system. A
component is a single unit of the system, which is replaceable and executable. The
implementation details of a component are hidden, and it requires an interface to
interact and execute a function. It operates like a black box whose behavior is
understood by the inputs and required interfaces.

[Link]:Component Diagram

41
System design Detection and prediction of Future Mental disorder from Social Media Data
Using Machine Learning, Ensemble Learning, and Large Language Models.

Deployment Diagram
The deployment diagram illustrates the physical hardware on which the software will
be deployed. It represents the static deployment view of a system, depicting the nodes
and their relationships. It details how software is distributed across the hardware. The
deployment diagram maps the software architecture created in design to the physical
system architecture, where the software will be executed as a node. As it involves
multiple nodes, the relationships are depicted using communication pathways.

[Link]: Deployment Diagram

42
System design Detection and prediction of Future Mental disorder from Social Media Data
Using Machine Learning, Ensemble Learning, and Large Language Models.

Collaboration Diagram
in a collaboration diagram, the sequence of method calls is depicted using a numbering
technique to illustrate how methods are called sequentially. This numbering indicates the
order in which the methods are invoked. Let's consider the order management system to
describe the collaboration diagram. The method calls in a collaboration diagram resemble
those in a sequence diagram. However, the key difference lies in the fact that while the
sequence diagram focuses solely on method invocation, the collaboration diagram provides
additional information by illustrating the organization of objects involved in the interactions.

[Link]: Collaboration Diagram

43
System design Detection and prediction of Future Mental disorder from Social Media Data
Using Machine Learning, Ensemble Learning, and Large Language Models.

Activity Diagram

ADMIN SYSTEM

Register Take dataset

Login
Pre-processing the data

Upload the data


Train the data

Pre-process the data


Train the model

Testing the data Model performance

View model performance Predict the result

View result

[Link]: Collaboration Diagram

44

You might also like