Stress Detection Project using Machine Learning
Stress, tension, and misery are undermining the psychological well-being of individuals. Each individual has a justification behind having an unpleasant life. Individuals frequently discuss their thoughts via web-based entertainment stages like on Instagram as posts and stories, and on Reddit through requesting ideas about their life on subreddits. In the beyond couple of years, many substance makers have approached to make content to assist individuals with their psychological wellness. Numerous associations can utilize pressure discovery to find which virtual entertainment clients are focused on to rapidly help them. So, to figure out how to utilize AI to recognize weight via virtual entertainment posts, this article is for you. In this article, I will take you through the undertaking of pressure recognition with AI utilizing Python.
Stress discovery is a difficult undertaking, as there are so many words that can be utilized by individuals on their posts that can show regardless of whether an individual is having mental pressure. While searching for datasets that I can use to prepare an AI model for pressure recognition, I found a dataset on Kaggle with 116 segments. We just have to involve the text and mark section for this undertaking.
The dataset I’m utilizing for this errand contains information presented on subreddits related on emotional wellness. This dataset contains different emotional well-being issues shared by individuals about their life. Luckily, this dataset is named as 0 and 1, where 0 shows no pressure and 1 demonstrates pressure. So, in the part underneath, I will take you through the undertaking of pressure discovery in online entertainment posts utilizing Python.
Presently how about we start the undertaking of pressure recognition with AI. I will begin this assignment by bringing in the essential Python libraries and the dataset that we want for this errand:
You can download the dataset from here.
Let’s look at the description of our data.
Let’s check if our data set contains null values or not.
So, this dataset does not have any null values. Now we will prepare the text column of this dataset to clean the text column with stopwords, links, special symbols and language errors:
Presently we should view the most utilized words by individuals sharing about their life issues via online entertainment by picturing a word cloud of the text column:
The label column in this dataset contains labels as 0 and 1. 0 means no stress, and 1 means stress. I will use Stress and No stress labels instead of 1 and 0. So let’s prepare this column accordingly and select the text and label columns for the process of training a machine learning model:
Now we will split the dataset into training and test sets:
As this task is based on 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.
Now let’s test the performance of our model on some random sentences based on mental health:
So, as you can see, we have got good results from our machine learning model. This is how you can train a stress detection model to detect stress from social media posts. This machine learning model can be improved by feeding it with more data.
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.