A comparative study and implementation of Hybrid Neural Architectures for stock market trend prediction. This project proposes a novel RoBERTa + GRU hybrid model that analyzes Twitter sentiment to forecast stock price movements, achieving state-of-the-art performance compared to baseline BERT models.
Research Highlight: The proposed Hybrid GRU model achieved a classification accuracy of 60.8%, outperforming standard BERT (56.1%) and RoBERTa (57.3%) baselines on the test dataset.
- Hybrid Architecture: Combines RoBERTa (for contextual embedding) with a Bi-Directional GRU (for sequential modeling) to capture long-range dependencies in financial text.
- Large-Scale Analysis: Trained on a dataset of 300,000+ tweets (2015–2020) covering major tech stocks (Apple, Google, Microsoft, Tesla).
- Robust Preprocessing: Implements custom regex pipelines to handle noisy social media text (removing tickers, URLs, and bot spam).
- Comprehensive Evaluation: Benchmarked against 4 different architectures:
- BERT Base
- RoBERTa Base
- Modified RoBERTa (Custom Classification Head)
- Hybrid RoBERTa-GRU (Winner)
- Language: Python 3.8+
- Deep Learning: PyTorch
- NLP: Hugging Face Transformers, NLTK
- Data Processing: Pandas, NumPy, Scikit-learn
- Data Source: Kaggle Tweet Dataset & Yahoo Finance API (
yfinance)
The models were evaluated on the held-out test set using Accuracy, Precision, Recall, and F1-Score. The Hybrid RoBERTa-GRU demonstrated superior performance across all metrics, indicating better handling of sequential context in financial tweets.
| Model | Accuracy | Precision | Recall | F1 Score |
|---|---|---|---|---|
| Hybrid RoBERTa-GRU (Proposed) | 0.608 | 0.596 | 0.589 | 0.595 |
| Modified RoBERTa | 0.585 | 0.569 | 0.573 | 0.577 |
| RoBERTa Base | 0.573 | 0.567 | 0.576 | 0.566 |
| BERT Base | 0.561 | 0.568 | 0.555 | 0.547 |
├── stock_classifier_tweet.py # Main model training & evaluation loop (PyTorch)
├── tweet_data_preprocessing.py # Text cleaning, tokenization, and dataset splitting
├── news_data_collection.py # Scripts for fetching financial news/data
├── Msc_Project_2792443s.pdf # Full Research Thesis Report
└── README.md # Documentation