Skip to content

This project is designed to help users assess their stress levels and provide personalized suggestions for managing stress. The chatbot collects user data such as age, gender, sleep quality, physical activity, and health metrics, and uses a RandomForestRegressor model to predict the user's stress level.

License

Notifications You must be signed in to change notification settings

Vikhram-S/Stress-Manager-Chatbot-Using-ML

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Mental Stress Manager Chatbot

This project is designed to help users assess their stress levels and provide personalized suggestions for managing stress. The chatbot collects user data such as age, gender, sleep quality, physical activity, and health metrics, and uses a RandomForestRegressor model to predict the user's stress level.

Features

  • Interactive chatbot powered by Streamlit.
  • Gathers information such as age, gender, occupation, health stats, and lifestyle habits.
  • Predicts stress level using a trained RandomForestRegressor model.
  • Provides tailored suggestions based on the predicted stress level (High, Medium, Low).
  • Includes an intuitive UI, suitable for non-technical users.

Model Performance

The model was trained on a public dataset from Kaggle, and performance was evaluated using the following metrics:

  • Root Mean Squared Error (RMSE): 0.1515
  • Mean Squared Error (MSE): 0.0229
  • Mean Absolute Error (MAE): 0.0427
  • R-squared (R²): 0.9927

Cross-validation was also performed using Stratified K-Fold:

  • Average RMSE: 0.2101
  • Average MAE: 0.0546
  • Average R-squared: 0.9859

Installation and Usage

  1. Install the required packages:
    pip install -r requirements.txt
    
    

Access the chatbot:

The chatbot will launch a local server, which you can access via your browser to interact with the bot.

How It Works

1. Data Collection: The chatbot collects data from the user interactively, such as:
Gender
Age
Occupation
Sleep Duration and Quality
Physical Activity Level
Health Metrics (BMI, Blood Pressure, Heart Rate, etc.)

3. Stress Prediction:
The collected data is fed into the trained RandomForest model, which predicts the user's stress level based on these inputs.

4. Suggestions: The chatbot provides personalized recommendations to help manage stress, depending on whether the predicted stress level is low, medium, or high.

Streamlit Interface

The chatbot uses the Streamlit library for a simple and effective web-based interface. The chatbot can be used to:

Start conversations Assess stress levels Provide stress management tips Dataset The dataset includes various factors that contribute to stress levels, such as age, gender, occupation, health statistics, and lifestyle habits. The data is one-hot encoded and split into training and test sets for the model.

Model Details

The RandomForestRegressor is used to predict the stress level based on the following features:

Age
Sleep Duration
Quality of Sleep
Physical Activity Level
Heart Rate
Blood Pressure
Occupation
BMI Category
Sleep Disorders

Libraries Used

  • Streamlit - Used for building the web-based chatbot interface.
  • scikit-learn - Used for training the RandomForestRegressor model.
  • Pandas - Used for data manipulation and analysis.
  • NumPy - Used for numerical operations.
  • Matplotlib - Used for plotting and data visualization.
  • Plotly - Used for creating interactive plots and visualizations.

License

This project is licensed under the MIT License.

About

This project is designed to help users assess their stress levels and provide personalized suggestions for managing stress. The chatbot collects user data such as age, gender, sleep quality, physical activity, and health metrics, and uses a RandomForestRegressor model to predict the user's stress level.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages