پیش‌بینی پویای تقاضای خرده‌فروشی مبتنی بر رویکرد ترنسفورمر با تلفیق اثرات شبکه‌ای، تأخیرهای زمانی و معناشناسی محصول

نوع مقاله : مقاله پژوهشی

نویسنده

گروه مهندسی صنایع، دانشکده فنی و مهندسی، دانشگاه اردکان، اردکان، ایران

چکیده
پیش‌بینی دقیق تقاضا در خرده‌فروشی آنلاین یکی از چالش‌های اساسی در مدیریت زنجیره تأمین و برنامه‌ریزی موجودی محسوب می‌شود، زیرا الگوهای تقاضا معمولاً تحت تأثیر روابط پیچیده زمانی، تعاملات شبکه‌ای میان محصولات و ویژگی‌های معنایی اقلام قرار دارند. بسیاری از رویکردهای سنتی سری زمانی و حتی برخی مدل‌های یادگیری عمیق در مدل‌سازی هم‌زمان این وابستگی‌های پویا و غیرخطی با محدودیت‌هایی مواجه‌اند. در پاسخ به این چالش، پژوهش حاضر یک چارچوب پیش‌بینی نوین مبتنی بر معماری ترنسفورمر ارائه داده که قادر است وابستگی‌های زمانی با تأخیر، اثرات شبکه‌ای میان محصولات و اطلاعات معناشناختی کالاها را به‌صورت یکپارچه مدل‌سازی کند. این پژوهش از نوع تجربی- محاسباتی بوده و برای ارزیابی مدل پیشنهادی از مجموعه‌داده واقعی خرده‌فروشی آنلاین دو استفاده شده است. پس از انجام مراحل پیش‌پردازش داده‌ها و حذف رکوردهای ناقص، داده‌ها به مجموعه‌های آموزش و آزمون تقسیم شدند. سپس مدل پیشنهادی با بهره‌گیری از سازوکار توجه چندسری در چارچوب ترنسفورمر و با استفاده از بازنمایی‌های معنایی استخراج‌شده از توضیحات محصولات آموزش داده شد. بر اساس نتایج، مدل ترنسفورمر پیشنهادی با دستیابی به مقادیر میانگین قدرمطلق خطا معادل ۲٫۶۸ و ریشه میانگین مربعات خطا معادل ۳٫۸۵، عملکرد بهتری نسبت به مدل‌های خودهمبسته میانگین متحرک انباشته (با میانگین قدرمطلق خطا برابر ۴٫۳۷ و ریشه میانگین مربعات خطا برابر ۵٫۹۶) و الگوریتم تقویت گرادیانت (با میانگین قدرمطلق خطا برابر ۳٫۹۱ و ریشه میانگین مربعات خطا برابر ۵٫۱۲) ارائه می‌دهد. این بهبود نشان داد که چارچوب پیشنهادی قادر است الگوهای پیچیده تقاضا و روابط میان‌محصولی را به‌طور مؤثر شناسایی کند.

کلیدواژه‌ها

موضوعات

عنوان مقاله English

Dynamic Retail Demand Forecasting Using a Transformer-Based Approach Integrating Network Effects, Temporal Lags, and Product Semantics

نویسنده English

Fatemeh Zare Baghiabad
, Department of Industrial Engineering, Faculty of Engineering, Ardakan University, Ardakan. Iran
چکیده English

Accurate demand forecasting in online retail is a fundamental challenge in supply chain management, as demand patterns are typically influenced by complex temporal relationships, cross-product network interactions, and item-specific semantic features. To address this challenge, this study introduced a novel forecasting framework based on a Transformer architecture, capable of modeling long-lag temporal dependencies, cross-product network effects, and item semantic information. This empirical-computational research evaluated the proposed model using online retail II datasets. The proposed model was subsequently trained utilizing a multi-head attention mechanism within the Transformer framework, incorporating semantic representations extracted from product descriptions. The results demonstrated that the model achieved a Mean Absolute Error (MAE) of 2.68 and a Root Mean Square Error (RMSE) of 3.85, outperforming both the Autoregressive Integrated Moving Average model (MAE: 4.37, RMSE: 5.96) and the Gradient Boosting algorithm (MAE: 3.91, RMSE: 5.12). This improvement indicated that the framework effectively identifies complex demand patterns and cross-product relationships.
Introduction
Precise and adaptive demand forecasting is paramount in the digitally transformed retail landscape. Online platforms generate vast data, presenting opportunities and challenges. Demand is shaped by trends, seasonality, promotions, network externalities (influences between complementary/substitute products), and product characteristics. Traditional models like ARIMA capture linear temporal dependencies but often miss nonlinear relationships and external factors. While advanced machine learning models handle nonlinearity, they may not adequately integrate diverse data types (time series, network structures, textual semantics). This study proposed a unified deep learning framework, the Transformer, excelling at capturing long-range dependencies via its attention mechanism. By explicitly modeling temporal lags, product network effects, and semantic features, our approach aimed for a more comprehensive and accurate representation of demand generation in online retail, pushing forecasting boundaries.
Literature Review
Demand forecasting in online retail is vital for supply chain and inventory management. Traditional time-series models like ARIMA and Exponential Smoothing capture linear temporal dependencies but are limited by the increasing complexity of modern online retail environments, characterized by intricate temporal relationships, inter-product network effects, and rich semantic item characteristics (Tiwari, 2025; Chowdhury et al., 2025). Contemporary deep learning architectures, including RNNs (LSTMs, GRUs), model complex temporal patterns but may struggle with long-range dependencies or nuanced interactions (Cai et al., 2021).
The Transformer architecture, with its self-attention mechanism, excels at capturing long-range and context-dependent relationships, revolutionizing sequence modeling (Rahman et al., 2025). Its adoption in time-series forecasting, including retail demand prediction, is growing (Wang, 2025; Li, 2023). However, existing Transformer-based research often focuses primarily on historical sales data (temporal lags) in isolation. A significant gap remains in simultaneously modeling the multifaceted influences on demand, specifically the interplay of:

Network Effects: Product demand is interdependent; influenced by complements and substitutes (Caetano et al., 2025). Capturing these structural interdependencies is crucial for dynamic patterns, especially in large catalogs.
Temporal Lags: The impact of events or changes may not be immediate. Accurately modeling these varied time delays is vital for precise forecasting (Tarighat et al., 2025).
Product Semantics: Product characteristics and descriptions significantly influence consumer choice. Leveraging semantic information can uncover hidden relationships and improve accuracy (Rahikka & Mikkola, 2025).

While studies have explored these factors individually or in limited combinations (e.g., Cai et al., 2021; Wang, 2025), a comprehensive framework integrating temporal dependencies, network effects, and product semantics within a single Transformer architecture remains an active research area. This study bridged this gap by proposing a novel Transformer-based framework to jointly model these dimensions for a more accurate and holistic approach to dynamic retail demand forecasting.
Method
This study employed an empirical-computational approach using the Online Retail II dataset. Data preprocessing involved handling missing values, correcting errors, and removing irrelevant transactions. The dataset was split chronologically into an 80% training set and a 20% testing set.
Our core forecasting model was the Transformer architecture, utilizing its self-attention mechanism to weigh historical time steps for predicting future demand, thus capturing complex temporal patterns and long-range dependencies. Positional encodings were added to input embeddings for sequence information.
Our framework innovatively integrated three key information sources:

Temporal Lags: Explicitly accounts for lagged demand patterns. While attention captures temporal relationships, features representing past demand values at different lags can be incorporated.
Network Effects: Models product interdependencies through a product interaction graph (nodes=products, edges=relationships like co-purchase frequency). Graph-derived features (e.g., centrality) processed by techniques like Graph Convolutional Networks (GCNs) are integrated.
Product Semantics: Extracts rich semantic embeddings from product descriptions using NLP techniques (e.g., pre-trained models). These capture nuanced characteristics and are integrated alongside temporal and network features.

The model was trained end-to-end using Mean Squared Error (MSE) or Mean Absolute Error (MAE), optimized via an Adam optimizer. Hyperparameters were tuned for optimal performance. Final evaluation used MAE and RMSE on the test set.
Results
The empirical evaluation on the Online Retail II dataset showed the superiority of our proposed Transformer-based framework. On the test set, the model achieved an MAE of 2.68 and an RMSE of 3.85. This substantially outperformed baseline models: ARIMA yielded MAE 4.37, RMSE 5.96; XG-Boost achieved MAE 3.91, RMSE 5.12. These quantitative results highlighted the enhanced predictive accuracy of our integrated approach, attributed to its ability to capture the complex interplay of temporal, network, and semantic factors. Visualizations of predicted versus actual demand confirmed the model’s superior tracking of demand fluctuations. Analysis of attention weights also provided insights into influential historical periods and product relationships, offering a degree of interpretability.
Discussion
The findings underscored the advantages of a Transformer-based architecture for dynamic retail demand forecasting when augmented with explicit modeling of temporal lags, network effects, and product semantics. The accuracy improvements over ARIMA and XG-Boost highlighted the limitations of models neglecting the interconnected nature of retail demand. Our approach achieved a more comprehensive representation by jointly considering these factors. The attention mechanism effectively captured long-range temporal dependencies and contextual relationships. Explicit incorporation of network effects revealed the critical influence of product interdependencies, often overlooked in single-item forecasting. Leveraging product semantics allowed deeper understanding of demand drivers beyond historical sales. This integrated approach offered retailers enhanced capabilities for inventory management, demand planning, and strategic decision-making, potentially reducing costs and stockouts while improving customer satisfaction. Attention weight analysis offered valuable insights for model trust and adoption.
Conclusion
This research successfully developed and validated a novel Transformer-based framework for dynamic retail demand forecasting, integrating temporal lags, network effects, and product semantics. Empirical results on the Online Retail II dataset demonstrated the model’s superiority, achieving significantly lower error metrics (MAE: 2.68, RMSE: 3.85) compared to ARIMA (MAE: 4.37, RMSE: 5.96) and XG-Boost (MAE: 3.91, RMSE: 5.12). This work contributed a unified and highly accurate methodology for forecasting in complex retail environments, offering substantial practical implications for inventory management and strategic decision-making. Future research could incorporate additional external factors, explore advanced GNN architectures, and develop more sophisticated interpretability methods for real-world adoption.

کلیدواژه‌ها English

Retail demand
network effects
temporal lags
product semantics
transformer architecture
1. حسینی، س. م.، و مازندرانی‌زاده، ح. (۱۴۰۴). بررسی تابع تقاضا معکوس و شبکه عصبی مصنوعی در پیش‌بینی قیمت محصولات زراعی (مطالعه موردی: شبکه آبیاری دشت قزوین). نشریه علوم و مهندسی آبیاری، ۴۸ (۲)، ۳۷-۴۹. https://doi.org/10.22055/jise.2024.45614.2109
2. شاملو، ز.، و ناظم، ف. (۱۴۰۲). بررسی تأثیر هوش مصنوعی بر توسعه سیستم‌های پیش‌بینی تقاضا برای کسب‌وکارهای خرده‌فروشی. نشریه تکنولوژی در کارآفرینی و مدیریت استراتژیک، 2(1)، 5- 12. https://doi.org/10.61838/kman.jtesm.2.1.2
3. مسیبی اتاق‌سرا، ا.، آراسته، ع.، و جوادیان، ن. (۱۴۰۳). پیش‌بینی روزانه تقاضای کالای فاسدپذیر با استفاده از یادگیری عمیق (مطالعه موردی: ماست سون شرکت فرآورده‌های لبنی کاله آمل). نشریه تصمیم‌گیری و تحقیق در عملیات، ۹ (۴۴)، ۸۳۳–۸۶۵. https://doi.org/10.22105/dmor.2024.467818.1859
4. ویسی، ا. (1405). بهینه‌سازی یکپارچه موجودی قطعات یدکی با استفاده از پیش‌بینی تقاضا مبتنی بر یادگیری ماشین با در نظر گرفتن موجودی اطمینان و تأمین با دو زمان تحویل. نشریه مهندسی سیستم و بهره‌وری، ۶ (۳)، ۲۲۵–۲۶۲. https://doi.org/10.22034/sep.2026.2074035.1409
5.    Caetano, R., Oliveira, J. M., & Ramos, P. (2025). Transformer-based models for probabilistic time series forecasting with explanatory variables. Preprints. https://doi.org/10.20944/preprints202502.0009.v1
6.    Cai, W., Song, Y., & Wei, Z. (2021). Multimodal data guided spatial feature fusion and grouping strategy for e-commerce commodity demand forecasting. Mobile Information Systems, 2021(1), 5568208. https://doi.org/10.1155/2021/5568208
7.    Chowdhury, A. R., Paul, R., & Rozony, F. Z. (2025). A systematic review of demand forecasting models for retail e-commerce enhancing accuracy in inventory and delivery planning. International Journal of Scientific Interdisciplinary Research, 6(1), 1–27. https://doi.org/10.63125/mbbfw637
8.    Li, Q. (2023). Achieving sales forecasting with higher accuracy and efficiency: A new model based on modified Transformer. Journal of Theoretical and Applied Electronic Commerce Research, 18(4), 1990–2006. https://doi.org/10.3390/jtaer18040100
9.    M. A., R., Rodrigues, G. N., Mir, N. H., Bhuiyan, S. M., Mridha, M. F., Islam, R., & Watanobe, Y. (2025). A hybrid temporal convolutional network and Transformer model for accurate and scalable [Title incomplete in source provided]. IEEE Open Journal of the Computer Society, 6, 380–391. https://doi.org/10.1109/OJCS.2025.3538579
10.     Rahikka, J., & Mikkola, P. (2025). Modern time series methods for demand forecasting in retail. University of Helsinki. https://helda.helsinki.fi/server/api/core/bitstreams/0f5658a0-0cb9-40b9-ab1e-b32e5f365d89/content
11.     Rai, S. K. (2025). Data-driven retail: The engineering behind personalized customer experiences. Journal of Computer Science and Technology Studies, 7(10), 571–581. https://doi.org/10.32996/jcsts
12.     Saarinen, L., & Huttunen, P. (2025). Revisiting the value of data sharing in retail supply chain demand planning. International Journal of Operations & Production Management, 45(11), 1910–1936. https://doi.org/10.1108/IJOPM-07-2024-0560
13.     Tarighat, N., Cohen, M. C., Clark, J. J., Member, L. S., Jorge, R., & Caetano, T. (2025). Domain adaptation for retail demand prediction. IEEE Access, 13, 146267–146294. https://doi.org/10.1109/ACCESS.2025.3600468
14.     Tiwari, R. (2025). Harnessing AI and predictive analytics for enhanced demand forecasting in retail supply chains. Supply Chain and Retail Management, 8(1), 41–52.
15.     Tripathi, S., Trigunait, R., & Chandra, D. (2025). A behavioral and environmental framework for sustainable retail forecasting and decision-making. Circular Economy and Sustainability, 1–29. https://doi.org/10.1007/s43615-025-00705-1
16.     Wang, J., Zhang, O., Qi, Y., Tang, H., Jiang, Y., & Khurelbaatar, Z. (2026). Masked Transformer with mixed features for retail demand forecasting to optimize IoT-driven supply chain management. IEEE Internet of Things Journal, 13(7), 12644–12654. https://doi.org/10.1109/JIOT.2026.3656390
17.     Wang, Y. (2025). Causal-aware multimodal Transformer for supply chain demand forecasting: Integrating text, time series, and satellite imagery. IEEE Access, 13, 176813–176829. https://doi.org/10.1109/ACCESS.2025.3619552