Back to Projects

Music & Mental Health Analysis

PythonScikit-learnTensorFlowDatabricksSparkMLData Processing
Music & Mental Health Analysis

Executive Summary

This project explores the relationship between music listening habits and mental health indicators using machine learning techniques. By analyzing patterns in music preferences and their correlation with mental health metrics, we aim to understand how music consumption patterns might reflect or influence mental well-being. I analyzed a Mental Health Survey dataset to understand how music affects mental wellbeing. The analysis includes:

  • Examination of music listening habits across different demographics.
  • Correlation between music genres and mental health indicators.
  • Predictive modeling to identify at-risk individuals based on music preferences.
  • Evaluation of music's therapeutic effects on various mental health conditions.
  • Dataset

    The main dataset used in this project is `mxmh_survey_results.csv`, which contains survey responses from participants regarding:

  • Demographic information
  • Music listening habits (hours per day, preferred streaming services)
  • Genre preferences and frequency of listening to various genres
  • Self-reported mental health metrics (anxiety, depression, insomnia, OCD)
  • Perceived effects of music on mental health
  • Machine Learning Models

    The project explores several machine learning models to predict mental health risks based on music preferences:

  • Random Forest Classifier
  • Logistic Regression
  • Gradient Boosting Trees (GBT)
  • Model performance metrics are tracked using MLFlow, which contains details about different model configurations and their evaluation results.

    Quantitative Insights and Findings

    Based on the analysis of the Music & Mental Health Survey Results dataset, the following quantitative insights and findings were observed:

    • The dataset includes 736 participants with an average age of 25.5 years.
    • Mental health score distributions vary: Anxiety is slightly left-skewed, Depression is bimodal, while Insomnia and OCD are heavily right-skewed, indicating lower reported levels for most participants.
    • Participants listen to music for an average of 3.5 hours per day.
    • Rock, Pop, and Metal are the most favored music genres among respondents.
    • Approximately 75% of participants reported that music improves their mental health, with the most significant effects noted on anxiety, followed by depression, insomnia, and OCD.
    • Spotify is the dominant streaming service, but no significant correlation was found between the choice of streaming service and mental health severity.
    • A tendency towards lower mental health severity scores was observed in participants who prefer slower music tempos (60-90 BPM), with a slight increase noted for very fast tempos (>140 BPM). Overall correlation between BPM and mental health conditions was found to be weak.
    • Higher levels of anxiety, depression, insomnia, and OCD were reported by participants who are instrumentalists compared to non-instrumentalists.
    • A slight positive correlation (0.15) exists between daily music listening hours and scores for depression and insomnia, though the overall correlation strength is not high.
    • Predictive modeling identified Hours per day, Age, and BPM as the most important features for predicting individuals at risk of mental health issues, although the overall predictive power of the model was moderate (AUC of 0.566, F1 score of 0.727).
    • The analysis suggests a small correlation between music listening habits and mental health, highlighting the complex nature of this relationship and the need for further exploration with larger and more diverse datasets.

    Conclusion

    The analysis reveals several interesting patterns:

  • Certain genres show stronger correlations with specific mental health conditions
  • Music listening duration and diversity of genres impact perceived therapeutic effects
  • Active music engagement techniques show promise for improving mental health outcomes
  • Different demographic groups report varying effects of music on their mental wellbeing.