TL;DR
This paper introduces a real-time system for detecting stress from social media posts using Big Data technologies like Apache Kafka and Spark. They leverage the "Dreaddit" dataset to train models, finding that Logistic Regression performs best for streaming data, achieving nearly 70% accuracy.
What Problem Does This Paper Address?
In our increasingly digital lives, social media has become a primary channel for expressing emotions and moods. This generates a massive amount of data, offering a unique opportunity to understand and potentially address public mental health issues like stress. However, automatically and accurately detecting stress from these vast, often unstructured, online posts presents a significant technical challenge. Existing methods often rely on physical biosignals, which are intrusive and impractical for widespread, real-time monitoring. This paper aims to bridge this gap by developing a scalable, real-time system to detect stress directly from social media text.
Methods
The researchers built a system with two main components: an offline processing system for model training and an online processing system for real-time detection.
- Offline System: This involved training various machine learning (ML) and deep learning (DL) models on the "Dreaddit" dataset.
- ML Models: They experimented with standard algorithms available in Spark MLlib, including Logistic Regression, Random Forest, Gradient-Boosted Trees, Decision Trees, and Support Vector Machines (SVM). Feature engineering included string indexing, Word2Vec embeddings, and vector assembly.
- DL Models: They also explored advanced natural language processing (NLP) models like BERT, RoBERTa, DistilBERT, XLNet, and Electra, using SparkNLP to integrate them with Spark.
- Online System: This system is designed for real-time stress detection.
- Data Ingestion: Apache Kafka is used to ingest streaming data from Reddit in real-time.
- Real-time Processing: Spark Structured Streaming handles the continuous flow of data, performing necessary preprocessing.
- Stress Detection: The best-performing model from the offline phase is then applied to the preprocessed streaming data to predict stress levels in real-time.
- Orchestration: Apache Airflow is employed to manage and schedule both the offline training and online processing workflows, ensuring automation and providing a visual interface for monitoring.
Datasets
The primary dataset used is "Dreaddit: A Reddit Dataset for Stress Analysis in Social Media." * It contains 187,444 posts from five different Reddit domains (abuse, anxiety, financial, PTSD, social). * A subset of 3,553 labeled posts was used for training and evaluation. * The dataset includes text with both stressful and non-stressful content, with various expressions of stress. * The paper also mentions a smaller, realistically annotated dataset of 100 samples for real-world performance evaluation.
Key Insights and Ideas
- Social Media as a Stress Indicator: The paper strongly validates the idea that social media posts can be a rich source for detecting stress, moving beyond solely relying on physical biosignals.
- Big Data Technologies are Crucial: The successful implementation of a real-time system highlights the necessity of Big Data tools like Kafka and Spark for handling the volume and velocity of social media data.
- Model Performance Varies Significantly: While deep learning models like XLNet showed high performance on the test set (over 80% accuracy), simpler models like Logistic Regression proved more effective and robust for the streaming data in the real-time scenario. This suggests a trade-off between complexity and real-time applicability.
- Data Imbalance Challenges: The paper notes that some deep learning models (like RoBERTa) struggled with data imbalance, failing to predict one of the classes effectively. This underscores the importance of balanced datasets or appropriate handling techniques.
- Airflow for Automation: The use of Apache Airflow demonstrates a practical approach to orchestrating complex data pipelines, crucial for maintaining a functional real-time system.
Key Results
- Offline Model Performance:
- Deep Learning: XLNet achieved the highest accuracy (80.65%) and F1-score (80.43%) on the test set. BERT, DistilBERT, and Electra also performed well (75-78% accuracy). RoBERTa performed poorly (around 53%).
- Machine Learning: SVM and Logistic Regression showed competitive results on the test set (around 66-70% accuracy).
- Real-time Streaming Performance:
- Logistic Regression emerged as the best-performing model for real-time stress detection, achieving an accuracy of 69.39% and an F1-score of 68.97%.
- Other ML models also performed reasonably well, with accuracy ranging from 62-66%.
- Deep learning models generally performed worse in the real-time scenario compared to ML models, possibly due to the limited size of the real-world annotated data.
Limitations and Future Work
- Limitations:
- The performance of deep learning models in the real-time scenario was lower than expected, potentially due to the limited size of the realistically annotated dataset used for evaluation.
- The paper notes that RoBERTa had issues predicting samples labeled as "non-stress" during training.
- Future Work:
- The authors aim to further optimize the performance of deep learning models within the Spark MLlib environment.
- They also plan to explore more advanced techniques for processing and analyzing large volumes of data in real-time.
Summary updated