Inspiration

Student mental health is often overlooked until it becomes a serious problem, and with rising social media usage among students, we wanted to explore whether everyday digital habits — screen time, sleep patterns, study hours — could actually signal something meaningful about wellbeing. We wanted to build something that goes beyond a notebook experiment and turns real data into a usable, live tool.

What it does

The Student Mental Health Predictor takes a student's daily habits — screen time, sleep hours, study hours, physical activity, stress level, and social media usage patterns — and predicts a mental health score from 0 to 10. It provides instant, data-driven feedback through a simple, interactive web interface.

How we built it

We started with a dataset on student social media and mental health impact, then built a full ML pipeline: data cleaning, feature encoding, and scaling in Python with Pandas and Scikit-learn. We trained and compared three models — Linear Regression, and Random Forest (default and tuned) — and selected the Random Forest (default) model based on the best R² score (0.876) and generalization balance. The model was served through a FastAPI backend with strict Pydantic input validation, connected to an HTML/CSS/JavaScript frontend, and deployed fully on Render (both API and UI).

Challenges we ran into

Choosing the right model wasn't just about picking the highest accuracy — the tuned Random Forest had a high training R² but generalized worse than the default one, so we had to understand and prioritize real-world performance over surface-level metrics. Handling categorical fields like country and platform also required careful preprocessing to avoid overfitting to rare categories, which we solved by grouping less common countries into an "Other" bucket. Connecting the trained model correctly to a live API and validating all inputs on both frontend and backend also took careful debugging.

Accomplishments that we're proud of

We're proud of building a complete, real-world ML pipeline from raw data to a fully deployed, working product — not just a model sitting in a Jupyter notebook. Achieving a strong R² score of 0.876 while keeping the model generalizable, and successfully deploying both the backend and frontend live on Render, felt like a real milestone.

What we learned

We learned how to properly compare multiple models using metrics beyond just accuracy, how to validate API inputs rigorously with Pydantic, and how to connect a trained ML model to a real, interactive frontend. We also learned the full process of deploying a full-stack ML application, and the importance of adding a clear disclaimer since predictions like these should never replace professional mental health advice.

What's next for Mental Health Predictor

Next, we'd like to expand the dataset for better generalization across more countries and demographics, add explainability (e.g. SHAP values) so users understand why they got a certain score, build a simple trend tracker for users to log habits over time, and eventually explore integrating light, evidence-based wellness suggestions alongside the score — while keeping the clear educational disclaimer intact.

Built With

Share this project:

Updates

Submission history