Professional Documents
Culture Documents
Me Internship Certificate(s)
Me Internship Certificate(s)
Me Internship Certificate(s)
on
MACHINE LEARNING
BACHELOR OF TECHNOLOGY
In
COMPUTER SCIENCE & ENGINEERING
Submitted By
V Sathish - 21695A0533
2022 - 23
2009-2013
BONAFIDE CERTIFICATE
This is to certify that the internship work entitled “Stress Detection” is a bonafide work
Carried out by
V Sathish _ 21695A0533
Submitted in partial fulfillment of the requirements for the award of degree Bachelor of
2023.
Examiner - I Examiner - II
ACKNOWLEDGEMENT
We sincerely thank the MANAGEMENT of Madanapalle Institute of
Technology & Science for providing excellent infrastructure and lab facilities that helped
We sincerely thank Dr. C. Yuvaraj, M.E., Ph.D., Principal, for guiding and
We express our gratitude to Dr. R. Kalpana, Ph.D., Professor and Head of the
Department of CSE for her continuous support in making necessary arrangements for the
Ph.D., Professor, Department of CSE for her tremendous support for the successful
completion of Project.
M.E., Assistant Professor, Department of CSE, for his guidance and encouragement
Department and our friends and our parents for their help and cooperation during our
project work.
DECLARATION
We hereby declare that the results embodied in this internship
Ananthapuramu.
Date :
Place :
Internship Associate:
ABSTRACT
Machine Learning is one of the emerging fields of Artificial Intelligence and it has many
applications. It is a tool that uses data and Artificial Intelligence in its areas of application. The
main idea behind the development of machine learning algorithms is to create a model that
understands and analyzes the given data and helps in prediction. Machine learning methods can be
applied to various domains.
With the increase in growth of technology, stress and anxiety in an individual are also increasing.
Stress is invisible and it’s like a slow poison. Stress, tension, and anxiety are the features that could
compromise the psychological wellness of individuals. These factors could lead an individual to
take their own lives. Therefore, it is important for any person to manage stress, to live a healthy and
a balanced life. Many organizations including our government are trying to find the people under
stress and get them treated. This can be achieved if there is a machine that can detect stress by
understanding texts from posts. The main objective of this project is to create a stress detection
machine. The rise of social media is changing people’s life. Now-a-days, with the growing
popularity of social media, people are sharing their activities, moods and interactions through the
social media posts. If we know whether the person is under stress or not, then we can treat them
accordingly. Because, there might be some words that can trigger some sort of anxiety in the people
under stress. The main objective of this project is to identify such people through their posts or
blogs. The machine reads the posts and detects whether the person is under stress or not.
In the internship I have done on Machine Learning, I did a project on Stress detection. The goal of
the project was to create a model to input text from the user and return whether the person is under
stress or not. In order to analyze the human language, recognition is not enough so we use natural
language processing. For example, if we write “I’m happy” in the input box, since the state you are
expressing indicates that you are not under stress then the model should return ‘No stress’. And if
the input given is “I need some help”, then the output should be ‘Stress’.
CONTENTS
PAGE
S.NO. TOPIC
NO.
1 INTRODUCTION 1-6
1.1 About Machine Learning 2,3
1.2 Importance and Applications of
4
Machine Learning
1.3 Language used 5
1.4 Need for the Model 6
5 CONCLUSION 22
6 BIBLIOGRAPHY 22
7 REFERENCES 23
CHAPTER 1 INTRODUCTION
1
1.1 ABOUT MACHINE LEARNING
Machine learning is a sub-domain of computer science. It uses data and
artificial intelligence in its area of applications. It is considered as the
topnotch pass to the most interesting and growing careers in the current
world. It is used to make predictions and gain insights. This can be
achieved by providing the data to train the model. The learning can be
mainly classified into two types, they are I) Supervised Learning
II) Unsupervised Learning
With the growing economy, the world is changing and the internet has
become the data generation machine. Machine learning helps the data
analysts to organize and handle this data. It helps in analysing the data and
provides valuable insights. Machine learning allows the software’s to
become more accurate.
It is known to everyone that large companies are describing the Machine
Learning as “The future”. It has many applications in various domains.
Few of them are listed below.
1) Image Recognition
2) Automatic language Translation
3) Medical Diagnosis
4) Stock market Trading
5) Online Fraud Detection
6) Virtual Personal Assistant
7) Email Spam and Malware Filtering
8) Self-driving cars
9) Recommendation Systems (Movie recommendation, Music
Recommendation)
10) Image recognition
4
1.3 LANGUAGE USED:
Python programming language that includes:
1) Basic Syntax including variables.
2) Conditionals, Control Flow(if-else-elif) and Iterations
3) Classes, Objects, Functions, Parameters, and Arguments. (Don’t try
to forgot learn about usage of self-parameter, init and super
functions)
4) Built-In Data Structures like List, Tuples, Dictionaries, Sets
5) List Comprehensions and Generators
6) Basic Algorithms like Searching, Sorting, Dynamic Programming 7)
Basic Data Structures like Arrays, Linked List.
8) File Handling.
9) Basic modules like math, os, sys, urllib, csv.
10) Handling SQL operations with Python using SQLAlchemy or
SQLite3.
11) Numerical Operations with NumPy
12) Data Handling with Pandas
13) Data Visualization with Matplotlib.
14) Basic knowledge of Tkinter (gives you an idea about how graphs are
displayed in Matplotlib and will further help in creating
environments for training RL Agents)
5
1.4 NEED FOR THE MODEL:
Why Stress detection is needed?
7
2.1 PLATFORM USED:
Windows 11 Home Single Language
Version: 21H2
2.2 HARDWARE USED:
Processor: AMD Ryzen 7 5700U with Radeon Graphics 1.80 GHz
System type: 64-bit operating system, x64-based processor
3.1 OVERVIEW
Stress detection is a challenging task, as there are so many
words that can be used by people on their posts that can
show whether a person is having psychological stress or
not. While looking for datasets that I can use to train a
machine learning model for stress detection, I found a
dataset on Kaggle with 116 columns. We only need to use
the text and label column for this task.
11
PROCEDURE :
Import the necessary Python libraries and the dataset that
we need for this task.
The text column of this dataset to clean the text column with
stopwords, links, special symbols and language errors. Most
used words by the people sharing about their life problems
on social media by visualizing a word cloud of the text
column.
Label column in this dataset contains labels as 0 and 1. 0
means no stress, and 1 means stress.
Use Stress and No stress labels instead of 1 and 0. Prepare
the column accordingly and select the text and label
columns for the process of training a machine learning
model.
Split the dataset into training and test sets.
The problem of binary classification, I will be using the
Bernoulli Naive Bayes algorithm, which is one of the best
algorithms for binary classification problems.
The performance of our model on some random sentences
based on mental health.
12
3.3 SOURCE CODE
import pandas as pd import
numpy as np data =
pd.read_csv("stress.csv")
print(data.head())
print(data.isnull().sum())
import nltk import re
nltk.download('stopwords')
stemmer = nltk.SnowballStemmer("english") from
nltk.corpus import stopwords
import string
stopword=set(stopwords.words('english'))
x = np.array(data["text"])
y = np.array(data["label"])
cv = CountVectorizer() X
= cv.fit_transform(x)
xtrain, xtest, ytrain, ytest = train_test_split(X,
y,test_size=0.33,random_state=42) from sklearn.naive_bayes
import BernoulliNB model = BernoulliNB() model.fit(xtrain,
ytrain) user = input("Enter a Text: ")
14
data = cv.transform([user]).toarray() output = model.predict(data)
print(output)
15
16
17
18
19
20
2
1
5 : CONCLUSION :
So this is how you can train a machine learning model to detect
stress from social media posts. People often share their feelings
on social media platforms. Many organizations can use stress
detection to find which social media users are stressed to help
them quickly. I hope you liked this article on stress detection with
machine learning using Python. Feel free to ask your valuable
questions in the comments section below.
6 : BIBLIOGRAPHY :
o DATA.GOV
o geeksforgeeks.org/python-decision-tree-regression-
usingsklearn/#:~:text=Decision%20tree%20regression
%20observes%20features,set%20of%20numbers%20o r
%20values.
o Kaggle.com
22
7.REFERENCES:
o Thecleverprogrammer.com/2021/08/04/ Stress
Detection -with-machine-learning/
o raw.githubusercontent.com/amankharwal/
Websitedata/master/ Stress Detection.csv
23