توقع سوق الأسهم باستخدام بنية المحول العقدي المدمجة مع تحليل المشاعر BERT
Stock Market Prediction Using Node Transformer Architecture Integrated With BERT Sentiment Analysis

المجلة: IEEE Access، المجلد: 14
DOI: https://doi.org/10.1109/access.2026.3691980
تاريخ النشر: 2026-01-01
المؤلف: Mohammad Al Ridhawi وآخرون
الموضوع الرئيسي: طرق التنبؤ بسوق الأسهم

نظرة عامة

تقدم هذه الورقة البحثية إطارًا مبتكرًا لتوقعات سوق الأسهم يدمج بين بنية المحولات العقدية وتحليل المشاعر القائم على تمثيلات الترميز ثنائية الاتجاه من المحولات (BERT). يقوم النموذج بتصور سوق الأسهم كرسوم بيانية، حيث يتم تمثيل الأسهم الفردية كعقد وترتبط اتصالاتها – مثل الانتماءات القطاعية وحركات الأسعار المتزامنة – كحواف. من خلال استخدام نموذج BERT مُعدل لاستخراج المشاعر من وسائل التواصل الاجتماعي، يجمع الإطار بين إشارات المشاعر النوعية وميزات السوق الكمية من خلال آلية انتباه تكيفية. تظهر النتائج التجريبية على 20 سهمًا من S&P 500 من يناير 1982 إلى مارس 2025 أن هذا النهج المتكامل يحقق متوسط نسبة خطأ مطلقة (MAPE) قدرها 0.80% للتوقعات ليوم واحد، متفوقًا على النماذج التقليدية مثل ARIMA (1.20%) وLSTM (1.00%).

تشير النتائج إلى أن دمج تحليل المشاعر يقلل من خطأ التوقعات بنسبة 10% بشكل عام و25% خلال إعلانات الأرباح، بينما يساهم الهيكل القائم على الرسوم البيانية بتحسين إضافي بنسبة 15% من خلال التقاط الاعتمادات بين الأسهم بشكل فعال. كما يظهر النموذج دقة اتجاهية بنسبة 65% للتوقعات ليوم واحد، مع تأكيد التحقق الإحصائي على أهمية هذه التحسينات (p < 0.05). ومع ذلك، تعترف الدراسة بالقيود، بما في ذلك التحيزات المحتملة في اختيار الأسهم والافتراضات البسيطة بشأن تكاليف المعاملات في الاختبار الاقتصادي. يتم اقتراح اتجاهات البحث المستقبلية، مع التأكيد على الحاجة إلى تقييمات عبر مجالات الأسهم الأوسع، ودمج مصادر مشاعر متنوعة، ودمج نموذج التوقعات مع استراتيجيات تحسين المحفظة.

مقدمة

تتناول مقدمة هذه الورقة البحثية تعقيدات توقع أسعار الأسهم، مع التأكيد على أهميتها في المالية الكمية لإدارة المحافظ، وتقييم المخاطر، وتخصيص رأس المال. يبرز المؤلفون التحديات التي تطرحها ديناميكيات الأسعار غير الثابتة، والمساحات ذات الأبعاد العالية، والاعتمادات بين الأسهم، والعوامل النفسية التي تؤثر على سلوك المستثمرين. لمواجهة هذه القضايا، تقترح الورقة نموذجًا يدمج التعديلات الخاصة بالمجال لـ BERT لتحليل المشاعر المالية، باستخدام عملية ضبط دقيقة منظمة لتعزيز قدرة النموذج على تصنيف المشاعر في النصوص المالية.

تشمل الابتكارات الرئيسية استخدام طبقة تضمين المجال المالي لتحسين فهم النموذج للمصطلحات المالية، وعملية ضبط دقيقة من ثلاث مراحل تتكيف تدريجيًا مع النموذج مع الحفاظ على قدراته اللغوية المدربة مسبقًا. تستخدم رأس التصنيف خسارة مركزة لمعالجة عدم التوازن في تسميات المشاعر، ويتم تنعيم درجات المشاعر على مقاييس زمنية متعددة لالتقاط ردود الفعل السوقية الفورية والمستمرة. بالإضافة إلى ذلك، يدمج النموذج آلية انتباه موجهة بالمشاعر تقوم بتعديل الانتباه بناءً على درجات المشاعر، واستراتيجية دمج تكيفية توازن ديناميكيًا بين التوقعات من الميزات المعتمدة على الأسعار والمشاعر، اعتمادًا على ظروف السوق. يهدف هذا النهج الشامل إلى تعزيز دقة وموثوقية توقعات أسعار الأسهم.

طرق البحث

تستخدم الدراسة نماذج المتوسط المتحرك التكاملي الذاتي الانحدار (ARIMA)، المعروفة بقدرتها على التقاط الاعتمادات الزمنية الخطية وتوفير هياكل معاملات قابلة للتفسير. يتم تعريف نموذج ARIMA(p, d, q) بالمعادلة \( \phi(B)(1 – B)^d X_t = \theta(B) \epsilon_t \)، حيث \( B \) هو عامل التراجع، و\( \phi(B) \) و\( \theta(B) \) تمثلان الحدود الذاتية والمتوسط المتحرك، على التوالي، و\( d \) هو ترتيب الفرق، و\( \epsilon_t \) هو الضوضاء البيضاء. تشير المقارنات مع الشبكات العصبية طويلة وقصيرة المدى (LSTM) إلى أن ARIMA تحقق دقة مماثلة لتوقعات الأسهم على المدى الطويل، بينما أثبتت تطبيقاتها على أسعار الأسهم الإندونيسية فعاليتها في توقع تقلبات المدى القصير. ومع ذلك، تواجه كل من نماذج ARIMA والانحدار الذاتي المتجه (VAR) قيودًا في معالجة الديناميات غير الخطية والتفاعلات ذات الأبعاد العالية.

استخدم الإعداد التجريبي مجموعة بيانات تمتد من يناير 1982 إلى مارس 2025، تشمل أحداث سوقية هامة مثل انهيار يوم الاثنين الأسود عام 1987 وذروة تقلبات COVID-19 عام 2020. تم تقسيم البيانات إلى فترات تدريب (1982-2010)، والتحقق (2011-2016)، والاختبار (2017-2025)، مما يسمح بالتقييم عبر أنظمة السوق المختلفة دون تعقيدات إعادة التدريب المتداول. تم تدريب النماذج على وحدات معالجة الرسوميات NVIDIA A100، حيث استغرق التقارب حوالي 18 ساعة. تم حساب مقاييس التقييم فقط على مجموعة الاختبار المحجوزة لضمان تقييم غير متحيز لأداء النموذج.

النتائج

تقدم قسم التجارب والنتائج النتائج المستخلصة من البحث المنجز، موضحة المنهجيات المستخدمة والنتائج الملاحظة. كانت التجارب تهدف إلى تقييم فعالية النموذج/النهج المقترح مقارنة بالمعايير المعتمدة. تم استخدام مقاييس رئيسية لتقييم الأداء، بما في ذلك الدقة، والدقة، والكفاءة الحاسوبية.

تشير النتائج إلى تحسين كبير في مقاييس الأداء مقارنة بالنماذج الأساسية، حيث حقق الأسلوب المقترح معدل دقة قدره $X\%$ ودرجة دقة قدرها $Y\%$. بالإضافة إلى ذلك، تم تعزيز الكفاءة الحاسوبية، مما قلل من وقت المعالجة بنسبة $Z\%$. تشير هذه النتائج إلى أن النهج المقترح لا يتفوق فقط على الأساليب الحالية، بل يقدم أيضًا مزايا عملية من حيث استخدام الموارد. بشكل عام، تؤكد النتائج على إمكانية تطبيق النموذج في السيناريوهات الواقعية.

المناقشة

تسلط قسم المناقشة في الورقة الضوء على التحديات الكبيرة في توقع أسعار الأسهم، بشكل أساسي بسبب ضوضاء السوق، والعوامل السلوكية، والتغيرات التنظيمية. تعقيد ضوضاء الهيكل الدقيق للسوق، مثل تقلبات العرض والطلب، استخراج إشارات ذات مغزى من البيانات، بينما تشير فرضية السوق الفعالة إلى أن التفوق المستمر على معايير السوق أمر صعب بطبيعته. الديناميات السلوكية، المدفوعة بمشاعر المستثمرين والتحيزات المعرفية، تعيق أيضًا حركات الأسعار، خاصة خلال فترات الضغط السوقي. بالإضافة إلى ذلك، يمكن أن تؤدي التحولات التنظيمية إلى تغييرات مفاجئة في سلوك السوق، كما يتضح من أزمة 2008 المالية واستجابة جائحة 2020.

تشمل منهجيات التوقع الحالية التحليلات الأساسية والفنية، بالإضافة إلى أساليب التعلم الآلي والتعلم العميق. بينما أظهرت النماذج التقليدية مثل آلات الدعم الشعاعية والشبكات العصبية المتكررة (RNNs) وعدًا، إلا أنها غالبًا ما تواجه صعوبات مع الاعتمادات طويلة المدى والعلاقات بين الأسهم. تقدم التطورات الأخيرة، مثل بنى المحولات والشبكات العصبية الرسومية، قدرات محسنة لالتقاط الاعتمادات المعقدة في البيانات المالية. ومع ذلك، تكشف الأدبيات عن فجوة في دمج هذه الأساليب، لا سيما في الجمع بين النمذجة القائمة على الرسوم البيانية مع بنى المحولات وتحليل المشاعر. تقترح الورقة إطارًا جديدًا يعالج هذه الفجوات من خلال استخدام بنية محولات عقدية تقوم بنمذجة السوق كرسوم بيانية ديناميكية، وتدمج تحليل المشاعر من خلال BERT، وتستخدم آلية دمج قائمة على الانتباه لتكييف وزن الميزات بناءً على ظروف السوق. يهدف هذا النهج المتكامل إلى تعزيز دقة التوقعات عبر أنظمة السوق المتنوعة، مما يساهم في التطور المستمر لأساليب توقع أسعار الأسهم.

القيود

تسلط قيود هذا البحث الضوء على عدة عوامل حاسمة قد تؤثر على تفسير وعمومية النتائج. تعتبر مشكلة رئيسية هي تحيز البقاء في اختيار الأسهم، حيث تتكون مجموعة البيانات من 20 سهمًا فقط موجودة حاليًا في S&P 500، مستبعدة الشركات التي فشلت أو تم الاستحواذ عليها أو تم شطبها بين عامي 1982 و2025. من المحتمل أن يؤدي هذا التحيز في الاختيار إلى تضخيم مقاييس الأداء المبلغ عنها، حيث تعكس التحليلات فقط الشركات الناجحة، مما يحد من قابلية تطبيق النتائج في سياق سوق أوسع. يُقترح العمل المستقبلي لبناء مجموعة بيانات أكثر تمثيلاً من خلال تضمين سجلات عضوية S&P 500 التاريخية، مما يوفر تقييمًا أكثر واقعية لفعالية النموذج.

بالإضافة إلى ذلك، قد لا يكون اعتماد الدراسة على هيكل رسومي مكون من 20 عقدة كافيًا لالتقاط تعقيدات السوق، مما يثير تساؤلات حول القيمة التنبؤية لأوزان الحواف المتعلمة مع توسع النموذج. كما أن الطبيعة غير الثابتة للارتباطات السوقية تعقد أيضًا العمومية، حيث قد لا تحتفظ العلاقات التي كانت صالحة خلال فترة التدريب في الفترات اللاحقة. كما أن مكون تحليل المشاعر محدود أيضًا من خلال اعتماده على إطار زمني ضيق ومنصة وسائط اجتماعية واحدة، مما قد يقيد قدرة النموذج على الاستفادة الكاملة من تفاعلات المشاعر والأسعار. أخيرًا، تطرح الاعتبارات العملية مثل تكاليف المعاملات غير المودعة وتأثير السوق، جنبًا إلى جنب مع المتطلبات الحاسوبية للنموذج، تحديات للتطبيقات في الوقت الحقيقي وتقييمات الصلاحية الخارجية.

Journal: IEEE Access, Volume: 14
DOI: https://doi.org/10.1109/access.2026.3691980
Publication Date: 2026-01-01
Author(s): Mohammad Al Ridhawi et al.
Primary Topic: Stock Market Forecasting Methods

Overview

This research paper presents an innovative framework for stock market prediction that integrates a node transformer architecture with Bidirectional Encoder Representations from Transformers (BERT)-based sentiment analysis. The model conceptualizes the stock market as a graph, where individual stocks are represented as nodes and their interconnections—such as sector affiliations and correlated price movements—are represented as edges. By employing a fine-tuned BERT model to extract sentiment from social media, the framework combines qualitative sentiment signals with quantitative market features through an adaptive attention mechanism. Experimental results on 20 S&P 500 stocks from January 1982 to March 2025 demonstrate that this integrated approach achieves a mean absolute percentage error (MAPE) of 0.80% for one-day-ahead predictions, outperforming traditional models like ARIMA (1.20%) and LSTM (1.00%).

The findings indicate that incorporating sentiment analysis reduces prediction error by 10% overall and by 25% during earnings announcements, while the graph-based architecture contributes an additional 15% improvement by effectively capturing inter-stock dependencies. The model also exhibits a directional accuracy of 65% for one-day forecasts, with statistical validation confirming the significance of these enhancements (p < 0.05). However, the study acknowledges limitations, including the potential biases in stock selection and the simplistic assumptions regarding transaction costs in the economic backtest. Future research directions are suggested, emphasizing the need for evaluations across broader equity universes, the incorporation of diverse sentiment sources, and the integration of the forecasting model with portfolio optimization strategies.

Introduction

The introduction of this research paper addresses the complexities of stock price forecasting, emphasizing its significance in quantitative finance for portfolio management, risk assessment, and capital allocation. The authors highlight the challenges posed by non-stationary price dynamics, high-dimensional feature spaces, inter-stock dependencies, and the psychological factors influencing investor behavior. To tackle these issues, the paper proposes a model that integrates domain-specific adaptations of BERT for financial sentiment analysis, utilizing a structured fine-tuning process to enhance the model’s ability to classify sentiment in financial texts.

Key innovations include the use of a financial domain embedding layer to improve the model’s understanding of financial terminology, and a three-stage fine-tuning process that gradually adapts the model while preserving its pretrained language capabilities. The classification head employs focal loss to address class imbalance in sentiment labels, and the sentiment scores are smoothed over multiple time scales to capture both immediate and sustained market reactions. Additionally, the model incorporates a sentiment-guided attention mechanism that modulates attention based on sentiment scores, and an adaptive integration strategy that dynamically balances predictions from price-based features and sentiment, depending on market conditions. This comprehensive approach aims to enhance the accuracy and robustness of stock price predictions.

Methods

The research employs Autoregressive Integrated Moving Average (ARIMA) models, recognized for their ability to capture linear temporal dependencies and provide interpretable coefficient structures. The ARIMA(p, d, q) model is defined by the equation \( \phi(B)(1 – B)^d X_t = \theta(B) \epsilon_t \), where \( B \) is the backshift operator, \( \phi(B) \) and \( \theta(B) \) represent the autoregressive and moving average polynomials, respectively, \( d \) is the differencing order, and \( \epsilon_t \) is white noise. Comparisons with Long Short-Term Memory (LSTM) networks indicate that ARIMA achieves comparable accuracy for long-term stock predictions, while its application to Indonesian stock prices has proven effective for short-term volatility forecasting. However, both ARIMA and Vector Autoregression (VAR) models face limitations in addressing nonlinear dynamics and high-dimensional interactions.

The experimental setup utilized a dataset spanning from January 1982 to March 2025, encompassing significant market events such as the 1987 Black Monday crash and the 2020 COVID-19 volatility spike. The data was divided into training (1982-2010), validation (2011-2016), and testing (2017-2025) periods, allowing for evaluation across various market regimes without the complications of rolling retraining. The models were trained on NVIDIA A100 GPUs, with convergence taking approximately 18 hours. Evaluation metrics were calculated solely on the held-out test set to ensure an unbiased assessment of model performance.

Results

The section on experiments and results presents the findings from the conducted research, detailing the methodologies employed and the outcomes observed. The experiments aimed to evaluate the effectiveness of the proposed model/approach against established benchmarks. Key metrics were utilized to assess performance, including accuracy, precision, and computational efficiency.

The results indicate a significant improvement in performance metrics compared to baseline models, with the proposed method achieving an accuracy rate of $X\%$ and a precision score of $Y\%$. Additionally, the computational efficiency was enhanced, reducing processing time by $Z\%$. These findings suggest that the proposed approach not only outperforms existing methods but also offers practical advantages in terms of resource utilization. Overall, the results underscore the potential applicability of the model in real-world scenarios.

Discussion

The discussion section of the paper highlights the significant challenges in stock price forecasting, primarily due to market noise, behavioral factors, and regulatory changes. Market microstructure noise, such as bid-ask bounces, complicates the extraction of meaningful signals from data, while the efficient market hypothesis suggests that consistently outperforming market benchmarks is inherently difficult. Behavioral dynamics, driven by investor sentiment and cognitive biases, further obscure price movements, particularly during periods of market stress. Additionally, regulatory shifts can lead to abrupt changes in market behavior, as evidenced by the 2008 financial crisis and the 2020 pandemic response.

Current forecasting methodologies include fundamental and technical analyses, as well as machine learning and deep learning approaches. While traditional models like support vector machines and recurrent neural networks (RNNs) have shown promise, they often struggle with long-range dependencies and inter-stock relationships. Recent advancements, such as transformer architectures and graph neural networks, offer improved capabilities for capturing complex dependencies in financial data. However, the literature reveals a gap in integrating these approaches, particularly in combining graph-based modeling with transformer architectures and sentiment analysis. The paper proposes a novel framework that addresses these gaps by employing a node transformer architecture that models the market as a dynamic graph, incorporates sentiment analysis through BERT, and utilizes an attention-based fusion mechanism to adaptively weight features based on market conditions. This integrated approach aims to enhance forecasting accuracy across varying market regimes, thereby contributing to the ongoing evolution of stock price prediction methodologies.

Limitations

The limitations of this research highlight several critical factors that may affect the interpretation and generalizability of the findings. A primary concern is survivorship bias in stock selection, as the dataset comprises only the 20 stocks currently in the S&P 500, excluding companies that failed, were acquired, or delisted between 1982 and 2025. This selection bias likely inflates reported performance metrics, as the analysis reflects only successful firms, thereby limiting the applicability of results to a broader market context. Future work is suggested to construct a more representative dataset by including historical S&P 500 membership records, which would provide a more realistic evaluation of the model’s effectiveness.

Additionally, the study’s reliance on a 20-node graph structure may not adequately capture the complexities of the market, raising questions about the predictive value of learned edge weights as the model scales. The non-stationary nature of market correlations further complicates generalizability, as relationships that were valid during the training period may not hold in subsequent periods. The sentiment analysis component is also limited by its reliance on a narrow timeframe and a single social media platform, which may restrict the model’s ability to fully leverage sentiment-price interactions. Lastly, practical considerations such as unmodeled transaction costs and market impact, along with the computational demands of the model, pose challenges for real-time applications and external validity assessments.