Professional Documents
Culture Documents
Major New
Major New
Major New
ALERTING SYSTEM
Submitted by
BACHELOR OF TECHNOLOGY
in
COMPUTER SCIENCE AND ENGINEERING
JUNE 2023
DEPARTMENT OF COMPUTER SCIENCE &ENGINEERING
VISION
MISSION
i
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING
CERTIFICATE
This is to certify that the thesis work titled ―Distress Prediction and Message
Alerting System” submitted by Ms Kamaraju Meghana (Regd.No.19891A05D9), Ms. Mekala
Amani (Regd.No.19891A05F3), Mr. Busi Aryan Reddy (Regd.No.19891A05H5), in partial
fulfillment of the requirements for the award of the degree of Bachelor of Technology in
Computer Science and Engineering to the Vignan Institute of Technology And
Science, Deshmukhi is a record of bonafide work carried out by us under my guidance and
supervision.
The results embodied in this project report have not been submitted in any university for the
award of any degree and the results are achieved satisfactorily.
External Examiner
ii
DECLARATION
We hereby declare that project entitled ―Distress Prediction and Message Alerting System‖
is bonafide work duly completed by us. It does not contain any part of the project or thesis
submitted by any other candidate to this or any other institute of the university.
All such materials that have been obtained from other sources have been duly acknowledged.
KAMARAJU MEGHANA
(Regd.No.19891A05D9)
MEKALA AMANI
(Regd.No.19891A05F3)
(Regd.No.19891A05H5)
iv
ACKNOWLEDGEMENT
Every project big or small is successful largely due to the effort of a number of
wonderful people who have always given their valuable advice or lent a helping hand. We
sincerely appreciate the inspiration; support and guidance of all those people who have been
instrumental in making this project a success.
We thank our beloved Chairman, Dr. L Rathaiah Sir, who gave us great
encouragement to work.
We thank our beloved CEO, Mr. Boyapati Shravan Sir, we remember him for his
valuable ideas and facilities available in college during the development of the project.
We convey our sincere thanks to Dr. G Durga Sukumar Sir, Principal of our
institution for providing us with the required infrastructure and a very vibrant and supportive
staff.
We would like to thank our Head of the Department of Computer Science And
Engineering, Dr. G. Raja Vikram sir, a distinguished and eminent personality, whose strong
recommendation, immense support and constant encouragement has been great help to us. We
intensely thank him for the same.
We would like to thank our guide of the project, Mr.N.Srianjaneya sir (Associate
Professor) who has invested his full effort in guiding the team in achieving the goal.
Special thanks go to my team mates, who helped me to assemble the parts and gave
suggestions in making this project. We have to appreciate the guidance given by other
supervisor as well as the panels especially in our project presentation that has improved our
presentation skills thanks to their comment and advice's. We take this opportunity to thank all
our lecturers who have directly or indirectly helped our project. We pay our respects and love to
our parents and all other family members and friends for their love and encouragement
throughout our career.
iv
ABSTRACT
iv
TABLE OF CONTENTS
ACKNOWLEDGEMENT .................................................................................................. IV
ABSTRACT ......................................................................................................................... V
1. INTRODUCTION .......................................................................................................... 01
4.1 Introduction..................................................................................................................... 12
iv
4.2.7 Collaboration Diagram………………………………………………………………….28
10 REFERENCES……………………………………………………………………………50
iv
LIST OF TABLES AND FIGURES
iv
Fig 6.3: Wordcloud & output… ............................................................................................. 45
iv
1. INTRODUCTION
Stress can be defined as any type of change that causes physical, emotional or psychological strain.
Stress is your body's response to anything that requires attention or action. Everyone experiences stress to
some degree. The way you respond to stress, however, makes a big difference to your overall well-being.
Stress affects both the brain and body. Little bit of stress is good for people to perform and protect
themselves but too much stress can overwhelm them leading to fight, flight or freeze response. So
learning how to cope with stress is important for our mental and physical wellbeing .
The new realities of working from home, temporary unemployment, home-schooling of children, and
lack of physical contact with other family members, friends and colleagues take time to get used to.
Adapting to lifestyle changes such as these and managing the fear of contracting the virus and worry about
people close to us who are particularly vulnerable, are challenging for all of us. They can be particularly
difficult for people with mental health conditions. It depends on how you react or respond to stress. Most
people manage stress well and continue to function while a few may have difficulty in coping with stress.
Such people should seek help from mental health treatment providers.
The COVID-19 pandemic has had a major effect on our lives. The need for physical distancing and
social restrictions has led to many of us to feeling socially isolated and left to deal with situation on our own.
These challenges that can be stressful, overwhelming and cause strong emotions. It is important for everyone
to understand what stress is, how it affects us and how to manage stress. To benefit from the contagious
nature of stress and its proneness to be influenced by surroundings can help to address this challenge
1
Range of Expertise Includes:
We apply technology with innovation and responsibility to achieve two broad objectives:
To monitor the stress levels of a person based on their social media posts.
The system notifies the stress alert using messages in early stage.
Though the world is in a stage of up gradation, there is yet another problem that has to be
dealt with. Stress! Situations of people being stressful and the consequences of them being
stressed out can be seen all around. This leads to various diseases as large number of nerves get
disrupted inside the brain. A big challenge in the urban cities is stress management. Hence, smart
prediction is a system which can eradicate this problem or at least reduce it to the minimum level.
Though there are few NGO’s that work on reducing stress in people there is a need for the
government to take small steps to help people. Majority of brain and nervous disorders develop
in stressful environment. Safeguarding the levels of stress using technology sources is needed at
present. Majority of the public seem to be disturbed with the unwanted stress. So, predicting the
stress at ealy stage before it results to anxiety and alerting the victim for an emergency is highly
needed. Amounts of stress is largely determined by two factors
1. The social pressures.
2. Understanding patterns.
2
This system assures the cleaning of dustbins soon when the garbage level reaches its
maximum.
1.2 Scope
Waste management is becoming a global concern these days. The world generates almost
a billion tonnes of municipal solid waste annually, with at least 33% of it not managed IN an
environmentally safe manner, per The World Bank report. And it’s further projected to grow to 3.40
billion tonnes by 2050. IoT is one technology that municipalities can employ to better manage
waste. To demonstrate this point, IoT technologies are already main stream for modern supply
chains. Not only has that, but IoT management systems have also proven to be invaluable to
optimize and automate processed in this industry. However, adoption is far greater on the supply
chain side. Though, similar logistic technology can be used to return the waste of those products.
Many IoT based waste management systems are available, but perceived challenges hold them
back.
This has prompted efficiency concerns, considering the growing cries for action on
climate change. IoT is proving to be an effective solution across various areas, but waste
management companies and municipalities haven’t utilized the technology effectively to improve
operational efficiency. The proposed project uses iot equipment such as nodemcu and ultrasonic
sensors in order to detect the minimum threshold level of waste. Later, if there is any fulfillment of
the threshold the notifications are sent using Telegram Bot through which authorities are informed.
Using this kind of a system it is easy for collectors to find the exact location and appropriate bin that
needs to be emptied.
3
2.LITERATURE SURVEY
1. An Efficient Machine Learning Framework for Stress Prediction via Sensor Integrated Keyboard Data
In this paper, an Adaptive Neuro-Fuzzy Inference System aided Fire Works Grey Wolf
Optimization (ANFIS-FWGWO) classification algorithm has been proposed for stress prediction.
In particular, the proposed machine learning framework has been implemented to predict
computer users' stress by using a sensor-integrated keyboard data. Various physiological
parametric data were acquired during two different phases for the experimentation, and the
received data was analyzed using an efficient machine learning framework. Specifically, the
proposed framework encompasses various techniques such as data preprocessing for data
smoothing and the Least Absolute Shrinkage and Selection Operator (LASSO) feature selection
algorithm for identifying the important features on the data set.
In this paper, we built wellbeing prediction models using passively sensed data
from wearable sensors, mobile phones, and weather API, and deep learning methods, and evaluated
the models with the data from new users. We compared deep long short-term memory (LSTM)
network and the combination of convolution neural network (CNN) and the LSTM model. We
found that our deep LSTM model provided performances, in mean absolute error (MAE), as 15.7,
15.6, and 16.8 out of 100 in predicting self-reported mood, health, and stress respectively for new
users.
4
There are many approaches implemented in Stress Detection. In this section, some ofthe
most interesting stress detection methods are presented.
5
2.AI Based Stress Management:
Stress is a natural and common occurrence in humans. It leads to the release of hormones
which help deal with the situation, but chronic stress affects our health and could lead to deleterious
effects like depression, insomnia or headaches and therefore, early detection of stress becomes
imperative to prevent such harmful consequences. This manuscript aims to automate the process of
mental stress detection and help classify a stressed individual from a normal one through the use of
physiological data collected from a wearable device. A publicly available dataset was used to
evaluate our solution. Different Artificial Intelligence models like Artificial Neural Network (ANN),
Hybrid of Artificial Neural Network and Support Vector Machine (ANN-SVM), Stacking Classifier
and Radial Basis Function (RBF) Network were used, and their performance was compared using the
accuracy of predicting correct stress state. During the study, Stacking Classifier gave the highest
accuracy value of 99.92% while the RBF gave the least accuracy of 84.46% for three class
classification of stress. The obtained results indicate the effectiveness of the proposed models in
continuous monitoring of mental stress. The experimental results serve to demonstrate that the
physiological signals can have a significant appositeness in mental stress detection.
Incremental Model is a process of software development where requirements are broken down into
multiple standalone modules of software development cycle. Incremental development is done in steps
from analysis design, implementation, testing/verification, maintenance.
6
Each iteration passes through the requirements, design, coding and testing phases.
And each subsequent release of the system adds function to the previous release until all
designed functionality has been implemented
.
Fig 4: Incremental model
The system is put into production when the first increment is delivered. The
first increment is often a core product where the basic requirements are addressed, and
supplementary features are added in the next increments. Once the core product is analyzed by
the client, there is plan development for the next increment.
7
3. SYSTEM ANALYSIS
This part of our project documentation focuses on existing system, proposed system,
advantages of proposed system, modules in the project along with their description and the
system requirements.
Cost inefficient
Devices are required
Wrong predictions due to variable parameters
Low rate of detecting
Misleading activities
The proposed system is a smart way in which the stress is predicted and notified. Our
main intention is to take a step forward to reduce the shares of mental issues and raise a
healthy world!!This is an ML based project that uses social media posts to detect the stress
and few other softwares to send SMS. The proposed solution will notify the user when the
stress levels are high in order to prevent dangerous situations. It is effective as it notifies
8
before the person moves into depression. Main objective of the project is to detect stress
based on social media posts and notify the victim online.
Highly efficient
9
Advantages of having a proper SRS Documentation.
It provides a realistic basis for estimating product costs, risks and schedules.
It provides an informed basis for deploying a product to new users or new operational environments.
It provides a basis for product enhancement.
It forces a rigorous assessment of requirements before design can begin and minimizes later redesign.
It establishes the basis for agreement between the acquirers or suppliers on what the product is to do (in
market driven projects, the user input may be provided by marketing).
Organizations can use the specifications to develop validation and verification plans.
10
3.3.1 Hardware Requirements:
Ram : 64 GB.
Computer : Laptop
Display : 800x600
11
4.SYSTEM DESIGN
4.1 Introduction
Software design sits at the technical kernel of the software engineering process and is
applied regardless of the development paradigm and area of application. Design is the first
step in the development phase for any engineered product or system. The designer‘s goal is to
produce a model or representation of an entity that will later be built. Beginning, once system
requirement has been specified and analyzed, system design is the first of the three technical
activities -design, code and test that is required to build and verify software.
The importance can be stated with a single word ―Quality‖. Design is the place
where quality is fostered in software development. Design provides us with representations of
software that can assess for quality. Design is the only way that we can accurately translate a
customer‘s view into a finished software product or system. Software design serves as a
foundation for all the software engineering steps that follow. Without a strong design we risk
building an unstable system – one that will be difficult to test, one whose quality cannot be
assessed until the last stage. The purpose of the design phase is to plan a solution of the
problem specified by the requirement document. This phase is the first step in moving from
the problem domain to the solution domain. In other words, starting with what is needed,
design takes us toward how to satisfy the needs. The design of a system is perhaps the most
critical factor affection the quality of the software; it has a major impact on the later phase,
particularly testing, maintenance. The output of this phase is the design document. This
document is similar to a blueprint for the solution and is used later during implementation,
testing and maintenance. The design activity is often divided into two separate phases System
Design and Detailed Design.
System Design also called top-level design aims to identify the modules that should
be in the system, the specifications of these modules, and how they interact with each other to
produce the desired results. At the end of the system design all the major data structures, file
formats, output formats, and the major modules in the system and their specifications are
decided. During, Detailed Design, the internal logic of each of the modules specified in
system design is decided. During this phase, the details of the data of a module is usually
specified in a high-level design description language, which is independent of the target
language in which the software will eventually be implemented.
In system design the focus is on identifying the modules, whereas during detailed
design the focus is on designing the logic for each of the modules. In other works, in system
design the attention is on what components are needed, while in detailed design how the
components can be implemented in software is the issue. Design is concerned with
identifying software components specifying relationships among components. Specifying
software structure and providing blue print for the document phase. Modularity is one of the
desirable properties of large systems. It implies that the system is divided into several
parts. In such a manner, the interaction between parts is minimal clearly specified.
12
During the system design activities, Developers bridge the gap between the
requirements specification, produced during requirements elicitation and analysis, and the
system that is delivered to the user. Design is the place where the quality is fostered in
development. Software design is a process through which requirements are translated into a
representation of software.
A graphical tool used to describe and analyse the moment of data through a system
manual or automated including the process, stores of data, and delays in the system. Data
Flow Diagrams are the central tool and the basis from which other components are developed.
The transformation of data from input to output, through processes, may be described
logically and independently of the physical components associated with the system. The DFD
is also known as a data flow graph or a bubble chart.
DFDs are the model of the proposed system. They clearly should show the
requirements on which the new system should be built. Later during design activity this is
taken as the basis for drawing the system‘s structure charts. The Basic Notation used to create
a DFD‘s are as follows:
13
Source: External sources or destination of data, which may be People, programs, organizations or
Other entities.
Data Store: Here data are stored or referenced by a process in the System.
Use case diagrams model the functionality of a system using actors and use cases. Use cases are
services or functions provided by the system to its users. Use case diagram is useful for
representing the functional requirements of the system using various notations like system, use
case, actors, and relationships.
Draw your system's boundaries using a rectangle that contains use cases. Place actors outside
the system's boundaries.
14
Use Case
Draw use cases using ovals. Label with ovals with verbs that represent the system's functions.
Actors
Actors are the users of a system. When one system is the actor of another system, label the
actor system with the actor stereotype.
Relationships
Illustrate relationships between an actor and a use case with a simple line. For relationships
among use cases, use arrows labelled either "uses" or "extends." A "uses" relationship
indicatesthat one use case is needed by another in order to perform a task. An "extends"
relationship indicates alternative options under a certain use case.
15
Fig:4.1 Use case diagram of distress prediction
16
16
4.2.2 Sequence Diagram:
Class roles:
Class roles describe the way an object will behave in context. Use the UML object symbol to
illustrate class roles, but don't list object attributes.
Activation
Activation boxes represent the time an object needs to complete a task.
Messages:
Messages are arrows that represent communication between objects. Use half-arrowed lines to
represent asynchronous messages. Asynchronous messages are sent from an object that will not
wait for a response from the receiver before continuing its tasks.
17
17
Lifelines:
Lifelines are vertical dashed lines that indicate the objects presence over time.
Destroying Objects:
Objects can be terminated early using an arrow labeled "<< destroy >>" that points to an X.
18
Fig 4.2: Sequence Diagram of distress prediction system
4.2.3ClassDiagram
Class Name
Attributes
Operations
19
Class Name
The name of the class is only needed in the graphical representation of the class. It appears in the
topmost compartment. A class is the blueprint of an object which can share the same relationships,
attributes, operations, & semantics. The class is rendered as a rectangle, including its name, attributes,
and operations in separate compartments.
Attributes
An attribute is named property of a class which describes the object being modeled. In the classdiagram,
this component is placed just below the name-compartment.
Relationships
Dependencies
Generalizations
Associations
Dependency
A dependency means the relation between two or more classes in which a change in one mayforce
changes in the other. However, it will always create a weaker relationship. Dependency indicates that one
class depends on another.
20
Generalization
A generalization helps to connect a subclass to its superclass. A sub-class is inherited from its superclass.
Generalization relationship can't be used to model interface implementation. Class diagram allows
inheriting from multiple superclasses.
Association
21
Fig 4.3: Class Diagram of dumpster management system.
An activity diagram illustrates the dynamic nature of a system by modeling the flow of
control from activity to activity. An activity represents an operation on some class in the system that
results in a change in the state of the system. Typically, activity diagrams are used to model workflow
or business processes and internal operation. Because an activity diagram is a special kindof state chart
diagram, it uses some of the same modeling conventions.
Action states
Action states represent the non-interruptible actions of objects. You can draw an action state inSmart
Draw using a rectangle with rounded corners.
22
Action Flow
Object Flow
Object flow refers to the creation and modification of objects by activities. An object flowarrow
from an action to an object means that the action creates or influences the object. An object flow arrow
from an object to an action indicates that the action state uses the object.
Initial State
A filled circle followed by an arrow represents the initial action state.
Final State
An arrow pointing to a filled circle nested inside another circle represents the final action state.
23
Branching
A diamond represents a decision with alternate paths. The outgoing alternates should be
labeled with a condition or guard expression. You can also label one of the paths "else."
Synchronization
A synchronization bar helps illustrate parallel transitions. Synchronization is also calledforking and
joining.
24
Fig 4.4 : Activity Diagram for Distress prediction System
Object diagrams are dependent on the class diagram as they are derived from the class diagram. It
represents an instance of a class diagram. The objects help in portraying a static view of an object-
oriented system at a specific instant. Both the object and class diagram are similar to some extent; the
only difference is that the class diagram provides an abstract view of a system. It helps invisualizing a
particular functionality of a system.
25
Fundamental Object Diagram Symbols Notations
Object Names
Every single object is represented such as a rectangular shape, which provides the name
through the object as well as class underlined along with shared using a colon.
Object Attributes
Just like classes, it is possible to list object attributes within an individual box. Even so, as
opposed to classes, object attributes must have values allocated to them.
Links
We use a link to symbolize a relationship between two objects. You are able to draw the link
when using the lines applied to class diagrams.
26
4.2.6 Component Diagram
UML Component diagrams are used to only demonstrate the behavior as well as the structure of
asystem. Component diagrams are basically diagrams of the class focusing on components of a
system are often used for modeling of the static implementation view of the system.
Component diagrams have many advantages that can help our team in various ways :
Package: Package in UML can be defined as something that can group elements, and
then givesa namespace for all of those grouped elements.
27
Dependency: Dependency relationship in UML can be defined as a relationship wherein
one of the elements which are the client uses or depends on another element which is the
supplier.
Communication diagrams, like sequence diagrams - a kind of interaction diagram, shows how
objects interact. A communication diagram is an extension of object diagram that shows the
objects along with the messages that travel from one to another. In addition to the associations
among objects, communication diagram shows the messages the objects send each other.
Some commonly used symbols and components of communication diagrams are below.
28
Objects
Objects can be classed as either a supplier or a client. Suppliers call the function that supplies
the message. Clients send the message to the supplier, who receives it.
Object
Link
A straight line connecting two objects indicates a relationship between them. The two objects
area ble to send messages to each other.
Messages
Synchronous message: a sender transmits a message, and must wait for a response before
continuing. This is shown by a straight line and a solid arrowhead.
Asynchronous message: a sender does not need to wait for a response before proceeding.
This is shown by a straight line and a lined arrowhead.
29
Sequence of messages: Typically, messages will have a number and description next to
them. The number determines the order in which messages should be read.
A state diagram is used to represent the condition of the system or part of the system at finite instances of
time. It‘s a behavioral diagram and it represents the behavior using finite state transitions. State diagrams
are also referred to as State machines and State-chart Diagrams.
We use it to state the events responsible for change in state (we do not show what
processes cause those events).
We use it to model the dynamic behavior of the system.
To understand the reaction of objects/classes to internal or external stimuli.
30
Basic components of a state chart diagram:
Initial state
We use a black filled circle represent the initial state of a System or a class.
Transition
We use a solid arrow to represent the transition or change of control from one state to another.
Thearrow is labelled with the event which causes the change in state.
State
Fork
We use a rounded solid rectangular bar to represent a Fork notation with incoming arrow from
theparent state and outgoing arrows towards the newly created states. We use the fork notation
to represent a state splitting into two or more concurrent states.
31
Self transition
We use a solid arrow pointing back to the state itself to represent a self transition. There might
be scenarios when the state of the object does not change upon the occurrence of an event. We
use self transitions to represent such cases.
Composite state
We use a rounded rectangle to represent a composite state also.We represent a state with internal
activities using a composite state.
Final state
We use a filled circle within a circle notation to represent the final state in a state machine
diagram.
32
Fig 4.8: State Diagram of Distress Prediction
A Block Diagram is a drawing illustration of a system whose major parts or components are represented
by blocks. These blocks are joined by lines to display the relationship between subsequent blocks.
Block in Block Diagram is the representation of several known properties such that when summed
together, they make up the central block diagram. The blocks portray a system as a collection of
components responsible for specific tasks in a particular setting.
Reference: it has all the parts which were developed using aggregation and association.
Standard Port: this is the point of interaction between a system block and the corresponding
Environment.
Flow Port: this is the point of interaction where a block can emerge from or to.
33
Fig 4.9 : Block Diagram of distress prediction.
UML Deployment diagram is used to define the hardware requirements for the particular
product to execute the software, basically it maps the software design requirement to the
physical system which executes the software design and visualize how software interact with
hardware to complete the test execution. To design the deployment diagram node, component,
artifact and interface notation are used.
34
Fig 4.10: Dependency diagram for distress prediction
35
5.SYSTEM IMPLEMENTATION
In the proposed system we have designed an ML model which measures the level of stress. The ML
model is designed based on Naïve Bayesian algorithm. It is one of the prominent classification
algorithms. Social media posts are taken as input to test and when the new post is given, the model
classifies stress victims and notifies them.
The main motto of this project is to detect the stress at early stage and notify the victims at right time.
5. Classify the data using wordcloud and algorithm selected. Now, give a new post
and classify whether the user is a stressful person or not.
6. Finally, the user can see the telegram messages in the channel when the stressful posts
are detected.
36
5.1 ALGORITHM DESCRIPTION:
The algorithm chosen for this project of distress prediction and message alerting system is the
ancient NAÏVE BAYESIAN CLASSIFICATION. It is based on probability concepts from mathematics.
o Naïve Bayes algorithm is a supervised learning algorithm, which is based on Bayes theorem and
used for solving classification problems.
o It is mainly used in text classification that includes a high-dimensional training dataset.
o Naïve Bayes Classifier is one of the simple and most effective Classification algorithms which help
in building the fast machine learning models that can make quick predictions.
o It is a probabilistic classifier, which means it predicts on the basis of the probability of an object.
o Some popular examples of Naïve Bayes Algorithm are spam filtration, Sentimental analysis, and
classifying articles.
Bayes' Theorem:
o Bayes' theorem is also known as Bayes' Rule or Bayes' law, which is used to determine the
probability of a hypothesis with prior knowledge. It depends on the conditional probability.
o The formula for Bayes' theorem is given as:
Where,
P(B|A) is Likelihood probability: Probability of the evidence given that the probability of a hypothesis.
37
Advantages of Naïve Bayes Classifier:
o Naïve Bayes is one of the fast and easy ML algorithms to predict a class of datasets.
o It can be used for Binary as well as Multi-class Classifications.
o It performs well in Multi-class predictions as compared to the other Algorithms.
o It is the most popular choice for text classification problems.
Steps to implement:
o Data Pre-processing step
o Fitting Naive Bayes to the Training set
o Predicting the test result
o Test accuracy of the result(Creation of Confusion matrix)
o Visualizing the test set result.
38
5.3 MODULE DESCRIPTION:
classify
Telegram_bot
Classify:
The module allows the program to access social media posts and converts it to database. As well as it
creates a model to train and test using new posts.
read_csv :
The posts from social media platforms are collected and gathered to a csv file. This file
consists of rows and columns that include each word and character.
clean:
This is used to clean the csv file. The main objective of this is to remove the unwanted
values, missing values and noisy data. There are few python packages that are used to collect
keywords that are necessary for identification of stress.
stem:
This function is used to remove the prefixes and suffixes from the root word. Once the dataset
is cleaned, the identification words are separated from the entire file. Later these words are stemmed
inorder to obtain only the root word.
39
The module includes other basic functions:
countVectorizer:
These functions are found in python inbuilt packages. This is used to plot the important keywords
in the form wordclouds. The distance between words and their placements are calculated.
Test():
This is the function of the module that analyzes the training data and tests the new posts from
user. Another supportive module called sklearn is used here.
Fit():
This function is used to transform the csv file data after cleaning to an array inorder to fit the
model
predict():
The model is trained using naïve bayes classification algorithm and this knowledge is used to
predict the test data and new data.
40
Telegram_bot:
The second module of our project is a python based module which is created using Pycharm IDE.
This module is divided into two parts.
Receive_data
Chatbot_data
recieve_data:
The main objective of this module is to receive the output from classification and check whether
the given post is stressful. The binary format is converted to python code for sending telegram messages.
Chatbot_data:
This python code contains the telegram url and the channel API of the telegram channel as well as
the thingspeak API in order to read data from it. This piece of code is imported as a package into receive_data.
1. ntlk
2. sklearn.naive_bayes
3. matplotlib
Let us see the detail description of each module and their sub modules.
41
1. NLTK:
Natural language processing (NLP) is a field that focuses on making natural human language usable
by computer programs. NLTK, or Natural Language Toolkit, is a Python package that you can use for
NLP. A lot of the data that you could be analyzing is unstructured data and contains human-readable text.
Before you can analyze that data programmatically, you first need to preprocess it. We use this to create
wordclouds in our project.
2. SkLearn:
Scikit-learn (Sklearn) is the most useful and robust library for machine learning in Python. It
provides a selection of efficient tools for machine learning and statistical modeling including classification,
regression, clustering and dimensionality reduction via a consistence interface in Python. This library,
which is largely written in Python, is built upon NumPy, SciPy and Matplotlib.
42
3.Matplotlib:
Matplotlib is an amazing visualization library in Python for 2D plots of arrays. Matplotlib is a multi-
platform data visualization library built on NumPy arrays and designed to work with the broader SciPy
stack. One of the greatest benefits of visualization is that it allows us visual access to huge amounts of data
in easily digestible visuals. Matplotlib consists of several plots like line, bar, scatter, histogram etc.
Fig:5.3 matplotlib
43
6. RESULTS AND DISCUSSIONS
The following images show the working and output of our project.
The above code snippet gives the implementation of reading the csv file using panda library. We also
check if there are any null values present in the dataset.
This code cleans the post by removing punctuations and unwanted affixes using Stemmer. A wordcloud
cloud is created using stopword package.
44
Fig 6.3 NLP Wordcloud and output classification
The above screenshot shows the output of the project. A wordcloud is created using
stressful words and when a new post is given, classification is performed.
Finally, if the post is stressful then an alert message is given to the user with the help of telegram.
45
7. TESTING ANALYSIS
Software testing is the process of evaluating and verifying that a software product or application does
what it is supposed to do. The benefits of testing include preventing bugs, reducing development costs
and improving performance.
There are many different types of software tests, each with specific objectives and strategies:
Unit Testing: The project was divided into various modules and each module was considered as a unit.
Sample codes were made use to test every unit.
Performance Testing: Various levels of workload was given to test the detection. That is different posts
were given as new words to test the working.
Testing Scenarios:
46
Fig 7.1 test with various posts
47
8. CONCLUSION
Stress management is the most challenging aspect in the present world. If the stress
is not managed or detected properly it will cause a great damage to the personal life. So, we
have to introduce a new mechanism for the stress management. For the purpose of stress
management in our project we have developed a mechanism. This mechanism was used to
predict the early stages of stress. An ML model is built using naïve bayes classification and
the stress is predicted on basis of social media posts. It predicts and alerts the user on
detecting stress. This system will be helpful for eliminating the present-day scenario of
neglecting the early stages of stress if cause huge damage. We are using telegram chatbot for
sending message to the users who are in stress. It will create a good platform to predict the
stress from posts and alert the user so that he or she can visit the nearest psychologist in order
to reduce risks.
• We predict the stress based on social media posts through machine learning model.
• This system assures the accurate prediction and notification system.
• It also reduces the risks of entering into deep stress and helps users by alerting them.
Diseases such as stress, anxiety, depression, and ADHD are commonly found in
the younger generation. This is all contributed to various factors such as lifestyle choices,
social and economic pressure, and low self-esteem. Workload, immense social and economic
pressure, and family responsibilities are other factors that impose increasing levels of stress on
individuals. Hence, detection and analysis of stress at early stages can reduce severe
consequences and risks that may occur in the future. In modern times, advancement in
technology has created a need for evolution in the medical sector. As a result, it is crucial to
predict and analyze various symptoms that cause stress so that it is easier to find their
treatment as soon as possible.
48
9. FUTURE SCOPE
In this project, implementation is done using the social media posts i.e. redhat posts. The
current project takes the posts and takes this dataset as input for machine learning model. After
training and testing it predicts if the person is in stress using natural language and alerts the user
using telegram bot. For the advancement of the current project, an automation can be added were
the algorithm works without database by directly reading posts. One can give their social media
access to the code so that model can run at backend. In order to do so, there is a need to increase
security.
Similarly, addition of AI can be done to the current project so that it can easily detect the
emotion and precautions can be directed to the user. After the prediction, a map can be introduced
along with alert message that shows the address of nearest psychologist. Futher extention can also
be made by introducing voice recognition system to detect stress on calls and videos. An app can
be made that reads chats and text and detect the stress level. Therefore algorithms used are very
basic and can also be modified keeping the time and space complexity in consideration.
Fig 9.0 Android App that reads texts and suggests measures
49
10. REFERENCES
50