Stock Trend Prediction Based on Twitter Sentiment Analysis Using Optimized Machine Learning Models
摘要
In addressing the growing need for accurate stock market trend forecasting, this study investigates the predictive power of Twitter-derived sentiment using a hybrid deep learning and machine learning framework. We employ FinBERT, a domain-specific language model, to perform sentiment analysis on financial tweets, which is then processed through a Long Short-Term Memory (LSTM) network optimized via Optuna to capture temporal sentiment trends. These sentiment features are integrated with historical stock data to train and evaluate three classification models: Logistic Regression, Random Forest, and XGBoost. Unlike traditional models that rely solely on price indicators, our approach incorporates real-time investor sentiment as a leading signal for market movement. Experimental results show that the Random Forest model outperforms others, achieving 417 true positives and 529 true negatives, with XGBoost performing comparably and Logistic Regression showing limitations in positive trend detection. This study demonstrates that combining financial sentiment with optimized machine learning models significantly enhances the accuracy and reliability of short-term stock trend prediction.