Mental Health Prediction App
A machine learning web app that predicts mental health risk levels (Low, Medium, High) from user inputs — built with Python, Streamlit, Random Forest and XGBoost for screening, awareness and education.
Overview
What it does
Takes age, stress level, sleep hours and anxiety score from slider inputs and predicts a Low, Medium or High mental health risk level when you click Predict.
Goals
Early identification of mental health risks, a simple interactive interface, and a demonstration of ML training and deployment on real data.
Dataset
10,000 rows × 14 columns covering demographics, work environment, treatment history, stress, sleep, activity, depression, anxiety, social support and productivity.
Preprocessing uses StandardScaler and label encoding for categorical data. The model is a RandomForestClassifier, with an option to switch to XGBoostClassifier. The README reports a baseline accuracy of about 59.6%, which it notes can be improved with more tuning or features.
Key Features
Three-level risk prediction
Classifies each input into a Low, Medium or High mental health risk level.
Slider-based input
Age (10–100), stress level (1–10), sleep hours (0–24) and anxiety score (1–10).
Instant result
The prediction is shown as soon as you click Predict.
Reproducible training
train_model.py trains the model and saves it as model.pkl for the Streamlit app to load.
Tech Stack
| Language | Python |
|---|---|
| Web app | Streamlit |
| ML | scikit-learn RandomForestClassifier (XGBoostClassifier optional), StandardScaler, label encoding |
| Data | mental_health_dataset.csv — 10,000 rows × 14 columns, target mental_health_risk |