Skip to content

zzLeonn/stressprediction

Repository files navigation

Stress Prediction Using Machine Learning
Welcome to the Stress Prediction project! This repository contains the code and documentation for a machine learning prototype designed to predict stress levels based on sleep health and lifestyle factors. The project was developed as part of my Bachelor's in Computer Science and demonstrates various stages of data preprocessing, model training, and evaluation.

Project Overview
This project aims to build a predictive model that estimates an individual's stress level using data collected from sleep patterns, lifestyle habits, and other health-related metrics. The primary goals include:

Preprocessing and cleaning the dataset to handle missing values and inconsistencies.
Encoding categorical variables and standardizing features for optimal model performance.
Training and evaluating multiple machine learning algorithms, including Logistic Regression, Naive Bayes, and K-Nearest Neighbors (KNN).
Visualizing data distributions and model performance using Matplotlib and Plotly.
Providing an interactive user input feature for real-time stress level prediction using the trained KNN model.
Key Features
Data Preprocessing: Handling missing values, label encoding, feature standardization, and dataset splitting.
Model Training: Implementing and evaluating Logistic Regression, Naive Bayes, and KNN classifiers.
Performance Evaluation: Using confusion matrices, classification reports, and accuracy scores to compare model performance.
Data Visualization: Generating histograms and bar charts to visualize data distributions and model accuracy.
User Interaction: Enabling user input for real-time stress level prediction based on the KNN model.
Technologies Used
Python: Programming language used for data analysis and model development.
Pandas: Library for data manipulation and analysis.
NumPy: Library for numerical computing.
Matplotlib: Library for creating static visualizations.
Plotly: Library for creating interactive visualizations.
Scikit-Learn: Machine learning library for model training and evaluation.
Getting Started
Clone the repository:

bash
Copy code
git clone https://github.com/yourusername/stress-prediction.git
Navigate to the project directory:

bash
Copy code
cd stress-prediction
Install the required dependencies:

Copy code
pip install -r requirements.txt
Run the main script to see the model training and evaluation:

Copy code
python stress_prediction.py
Usage
You can use the provided script to preprocess the data, train the models, and visualize the results. Additionally, the user input function allows for real-time prediction of stress levels based on user-provided data.

Contributing
Contributions are welcome! Please feel free to submit a pull request or open an issue if you have any suggestions or improvements.

License
This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments
Special thanks to the academic resources and practical advice that informed and improved this project. This work is part of my Bachelor's in Computer Science at the University of Sunderland.

About

Stress Prediction Using Machine Learning

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages