Supply chain demand prediction method under emergency by fusing coarse and fine-grained text data

CN123014296APending Publication Date: 2026-10-30NANJING UNIV OF INFORMATION SCI & TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611139918.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-07-30
Publication Date
2026-10-30

AI Technical Summary

Technical Problem

[0004]然而,上述方法通常仅利用单一粒度的情感信息,或者将不同粒度的情感信息简单组合后参与预测,未能围绕统一时间周期对不同粒度的情感信息进行协同统计并与结构化业务数据形成一致的预测输入,导致社交媒体文本中的情感信息利用不充分,在突发事件下难以准确反映市场情绪变化对产品需求的影响,从而影响供应链需求预测的准确性

Benefits of technology

1.本发明通过获取目标产品对应的结构化业务数据以及社交媒体文本数据,并分别提取社交媒体文本中的粗粒度情感特征和细粒度情感特征,进一步依据文本发布时间对不同粒度的情感特征进行时间周期统计,使社交媒体文本中的整体情感信息与方面级情感信息能够分别形成对应时间周期的情感数据,有利于提高不同粒度情感信息的利用程度,为后续需求预测提供更加丰富的情感特征支撑。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123014296A_ABST
    Figure CN123014296A_ABST
Patent Text Reader

Abstract

The application discloses a supply chain demand prediction method fusing coarse and fine granularity text data under an emergency, and relates to the technical field of supply chain demand prediction.The application comprises the following steps: obtaining structured business data and social media text data corresponding to a target product, and respectively performing preprocessing to obtain structured feature data and text data; extracting coarse granularity sentiment features and fine granularity sentiment features of the corresponding text according to the text data, so as to obtain coarse granularity sentiment data and fine granularity sentiment data corresponding to a time period; fusing the coarse granularity sentiment data, the fine granularity sentiment data and the structured feature data corresponding to the time period to obtain prediction input data; performing standardization processing on the prediction input data, and inputting the prediction input data into a demand prediction model to obtain a demand prediction result.The application can improve the utilization degree of different granularity sentiment information, enhance the representation ability of the prediction input data to demand changes, and improve the accuracy and stability of supply chain demand prediction under an emergency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of supply chain demand forecasting technology, specifically a method for forecasting supply chain demand by integrating coarse and fine-grained text data under unforeseen events. Background Technology

[0002] Supply chain demand forecasting is a crucial foundational element of supply chain management, directly impacting decisions regarding inventory allocation, production planning, and logistics scheduling. Under normal market conditions, demand forecasting typically relies on structured business data such as historical sales volume, prices, promotional activities, and holidays, combined with regression analysis, time series analysis, or machine learning models. However, during unforeseen events such as public health emergencies, natural disasters, and social upheavals, consumer demand is easily influenced by external public opinion and market sentiment. Traditional demand forecasting methods that depend on structured business data struggle to reflect changes in market demand in a timely manner, leading to forecasts that deviate from actual demand.

[0003] With the widespread use of social media platforms, a large number of users post comments, discussions and opinions about products and events, providing rich textual information for demand forecasting. Existing technologies usually convert social media text into sentiment features to participate in demand forecasting. For example, they extract coarse-grained sentiment information that reflects the overall sentiment of the text, or extract fine-grained sentiment information for different aspects of the product, and input them as auxiliary features into the prediction model.

[0004] However, the above methods typically only utilize sentiment information at a single granularity, or simply combine sentiment information at different granularities for prediction. They fail to conduct collaborative statistics on sentiment information at different granularities around a unified time period and form consistent predictive input with structured business data. This results in insufficient utilization of sentiment information in social media texts, making it difficult to accurately reflect the impact of market sentiment changes on product demand under sudden events, thereby affecting the accuracy of supply chain demand forecasting.

[0005] To address this, the present invention proposes a supply chain demand forecasting method that integrates coarse and fine-grained text data under emergency events. Summary of the Invention

[0006] The purpose of this invention is to provide a supply chain demand forecasting method that integrates coarse and fine-grained text data under sudden events, so as to solve the problems mentioned in the background art.

[0007] According to a first aspect of the present invention, in order to achieve the above-mentioned objective, the present invention provides the following technical solution: a supply chain demand forecasting method that integrates coarse and fine-grained text data under sudden events, comprising the following steps: Obtain structured business data and social media text data corresponding to the target product within a preset time range; preprocess the structured business data to obtain structured feature data; and preprocess the social media text data to obtain text data. Based on the text data, extract the coarse-grained sentiment features and fine-grained sentiment features of the corresponding text. Based on the publication time of the text, statistically analyze the coarse-grained sentiment features and fine-grained sentiment features of the corresponding text within the same time period to obtain the coarse-grained sentiment data and fine-grained sentiment data for the corresponding time period. By fusing coarse-grained sentiment data, fine-grained sentiment data, and structured feature data of the corresponding time period, the predicted input data for the corresponding time period is obtained. The predicted input data is standardized, and the standardized predicted input data is input into a pre-built demand prediction model to obtain the demand prediction results for the corresponding time period. The forecast evaluation index is calculated based on the demand forecast results and the actual demand data for the corresponding time period.

[0008] Furthermore, structured business data and social media text data corresponding to the target product are obtained. The structured business data is preprocessed to obtain structured feature data, and the social media text data is preprocessed to obtain text data, as follows: Obtain structured business data corresponding to the target product within a preset time range, wherein the structured business data includes historical demand data corresponding to the target product and business data affecting changes in demand; The structured business data is organized according to a preset time period, missing data is filled in, and abnormal data is processed to obtain structured feature data for the corresponding time period. Acquire social media text data corresponding to the target product and record the posting time of each text; The social media text data is cleaned, segmented into Chinese words, and has stop word removal processes to obtain text data for sentiment analysis.

[0009] Furthermore, coarse-grained sentiment features of the corresponding text are extracted based on the text data, as follows: The text data is acquired and input into the text encoding model; The semantic representation data of the corresponding text is output based on the text encoding model; A sentiment score reflecting the overall sentiment tendency of the text is calculated based on the semantic representation data. The sentiment score, which reflects the overall sentiment tendency of the text, is used as the coarse-grained sentiment feature of the corresponding text.

[0010] Furthermore, fine-grained sentiment features of the corresponding text are extracted based on the text data, as follows: The text data is obtained, and the aspect entities involved in the text data are identified to obtain the aspect entity data of the corresponding text. Based on the entity data of each aspect, extract the text content corresponding to each entity; Based on the text content corresponding to each entity, the sentiment tendency of each entity is analyzed to obtain the sentiment score of each entity. Statistical processing is performed on the sentiment scores corresponding to various entities to obtain the fine-grained sentiment score of the corresponding text, and the fine-grained sentiment score is used as the fine-grained sentiment feature of the corresponding text.

[0011] Furthermore, based on the publication time of the text, the coarse-grained sentiment features and fine-grained sentiment features of the corresponding text within the same time period are statistically analyzed to obtain the coarse-grained sentiment data and fine-grained sentiment data for the corresponding time period, as follows: According to the time period, obtain the coarse-grained sentiment features and fine-grained sentiment features corresponding to each text within the same time period; Statistical processing is performed on the coarse-grained sentiment features of each text within the same time period to obtain coarse-grained sentiment data for the corresponding time period. Statistical processing is performed on the fine-grained sentiment features of each text within the same time period to obtain fine-grained sentiment data for the corresponding time period.

[0012] Furthermore, the coarse-grained sentiment data, fine-grained sentiment data, and structured feature data for the corresponding time period are fused together to obtain the prediction input data for the corresponding time period, as follows: Obtain structured feature data, coarse-grained sentiment data, and fine-grained sentiment data for the corresponding time period; The structured feature data, coarse-grained sentiment data, and fine-grained sentiment data are time-corresponding according to the corresponding time periods; The structured feature data, coarse-grained sentiment data, and fine-grained sentiment data corresponding to the time are combined according to a preset feature order to obtain fused data, which is then used as the prediction input data for the corresponding time period.

[0013] Furthermore, the predicted input data is standardized, and the standardized predicted input data is input into a pre-built demand prediction model to obtain the demand prediction results for the corresponding time period, as follows: Obtain the prediction input data, and then standardize the obtained prediction input data to obtain standardized prediction input data. Standardized forecast input data is fed into a pre-built demand forecasting model; The demand forecasting model outputs the demand forecast results for the target product for the corresponding time period.

[0014] Furthermore, the demand forecasting model is any one of the following: Gaussian process regression model, elastic network model, Bayesian ridge regression model, and ridge regression model.

[0015] Furthermore, based on the demand forecast results and the actual demand data for the corresponding time period, forecast evaluation indicators are calculated as follows: Obtain the actual demand data for the time period corresponding to the demand forecast results; Based on actual demand data, the mean absolute percentage error calculation result is used as the prediction evaluation index. The predictive performance of the demand forecasting model is evaluated based on the aforementioned predictive evaluation indicators.

[0016] According to a second aspect of the present invention, the present invention provides a supply chain demand forecasting system that integrates coarse and fine-grained text data under emergencies, for implementing the supply chain demand forecasting method that integrates coarse and fine-grained text data under emergencies described in the first aspect, comprising: The data acquisition module is used to acquire structured business data and social media text data corresponding to the target product, preprocess the structured business data to obtain structured feature data, and preprocess the social media text data to obtain text data. The feature extraction module is used to extract coarse-grained sentiment features and fine-grained sentiment features of the corresponding text based on the text data, and to statistically analyze the coarse-grained sentiment features and fine-grained sentiment features of the corresponding text within the same time period based on the publication time of the text, so as to obtain coarse-grained sentiment data and fine-grained sentiment data for the corresponding time period. The data fusion module is used to fuse coarse-grained sentiment data and fine-grained sentiment data of the corresponding time period with the structured feature data of the corresponding time period to obtain the prediction input data of the corresponding time period. The prediction result output module is used to standardize the prediction input data and input the standardized prediction input data into a pre-built demand prediction model to obtain the demand prediction result for the corresponding time period. The evaluation module is used to calculate the predictive evaluation index based on the demand forecast results and the actual demand data for the corresponding time period.

[0017] The present invention has at least the following beneficial effects: 1. This invention acquires structured business data and social media text data corresponding to the target product, and extracts coarse-grained and fine-grained sentiment features from the social media texts respectively. Furthermore, it performs time-period statistics on sentiment features of different granularities based on the text publication time, so that the overall sentiment information and aspect-level sentiment information in the social media texts can form sentiment data corresponding to the time period, which is conducive to improving the utilization of sentiment information of different granularities and providing richer sentiment feature support for subsequent demand prediction.

[0018] 2. Based on a unified time period, this invention integrates coarse-grained sentiment data, fine-grained sentiment data, and structured feature data to construct predictive input data for the corresponding time period. This enables data from different sources to form a collaborative representation under a unified time dimension, which is beneficial for fully reflecting the correlation between changes in market sentiment and changes in business data during emergencies, improving the ability of predictive input data to represent changes in demand, and thus enhancing the reliability of supply chain demand forecasting.

[0019] 3. This invention standardizes the input data and then inputs it into a pre-built demand forecasting model for demand forecasting. This allows data from different sources to participate in model calculations in a unified data format, which helps reduce the impact of scale differences between different data features on the forecasting process, improves the adaptability of the demand forecasting model to fused data, and thus improves the stability of supply chain demand forecasting results.

[0020] 4. This invention combines demand forecasting results with actual demand data to calculate forecasting evaluation indicators, thereby evaluating the forecasting performance of the demand forecasting model. This facilitates quantitative analysis of demand forecasting results, provides a reference for optimizing the demand forecasting model and improving supply chain demand forecasting solutions, and enhances the practicality of supply chain demand forecasting methods.

[0021] Of course, any product implementing this invention does not necessarily need to achieve all of the advantages described above at the same time. Attached Figure Description

[0022] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, for those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0023] Figure 1 This is a schematic diagram of the overall process of the method described in this invention; Figure 2 This is a schematic diagram illustrating the changes in coarse and fine granularity of emotion scores in an embodiment of the present invention; Figure 3This is a comparison chart of the predicted values ​​and actual values ​​of each model under different feature combinations in the embodiments of the present invention. Detailed Implementation

[0024] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0025] Example 1: Please see Figure 1 This invention provides a technical solution: a supply chain demand forecasting method that integrates coarse and fine-grained text data under emergencies, comprising the following steps: S1. Obtain structured business data and social media text data corresponding to the target product. Preprocess the structured business data to obtain structured feature data, and preprocess the social media text data to obtain text data, as follows: S11. Obtain structured business data within a preset time range corresponding to the target product, wherein the structured business data includes historical demand data corresponding to the target product and business data affecting changes in demand; Suppose there are N time periods, and each time period n, n=1,2,…,N corresponds to a structured record. Let the target product demand in the nth period be denoted as… Other characteristic variables that affect demand are denoted as vectors. ,in The total number of structured features; S12. Organize the structured business data according to a preset time period, fill in missing data, process abnormal data, and obtain structured feature data for the corresponding time period. The feature vector of each time period n With target value Corresponding combinations form a sample set. Linear interpolation is used to fill in missing values, and outliers are detected and replaced to obtain preprocessed structured feature vectors. S13. Obtain social media text data corresponding to the target product, and record the posting time of each text; We obtained a total of original blog posts related to the target product from social media platforms through web scraping. Each blog post record includes the publication time. and blog content; S14. Perform character cleaning, Chinese word segmentation, and stop word removal on the social media text data to obtain text data for sentiment analysis; For social media text data, each post undergoes character cleaning, Chinese word segmentation, and stop word removal operations in sequence, with the vocabulary set as follows: The vocabulary size is After preprocessing, each blog post is converted into a word sequence for subsequent sentiment feature extraction; S2. Extract coarse-grained and fine-grained sentiment features of the corresponding text based on the text data. Then, based on the publication time of the text, statistically analyze the coarse-grained and fine-grained sentiment features of the corresponding text within the same time period to obtain the coarse-grained and fine-grained sentiment data for the corresponding time period, as follows: S21. Extract coarse-grained sentiment features from the corresponding text: Obtain the text data and input the text data into the text encoding model: For the technical solution in this embodiment, the text encoding model adopts the Sentence-BERT model, which converts each blog post into a high-dimensional vector representation (semantic representation data). The document-level embedding vector is obtained through mean pooling, and a coarse-grained sentiment score is calculated through the sentiment classification layer. For documents Its document-level embedding vector The calculation formula is: in, For a fixed length sequence, For the first Vector representation of each tag; coarse-grained sentiment score The calculation formula is: in, For the weight vector, For bias terms, It is a hyperbolic tangent function, ensuring , The closer to 1, the more positive the emotion; the closer to -1, the more negative the emotion; and the closer to 0, the neutral. S22. Extract fine-grained sentiment features from the corresponding text, as follows: The text data is acquired, and the aspect entities involved in the text data are identified to obtain the aspect entity data of the corresponding text: For documents Suppose that it contains a set of aspect entities. ,in For document The total number of terms in the Chinese context, for each term in the Chinese context Extract the context window centered on its position and calculate the context embedding vector. (i.e., aspect entity data), aspect-level sentiment scores are calculated through the sentiment classification layer: Aggregated Documents The sentiment scores of all aspects of the words are used to obtain fine-grained sentiment scores: in, Document The fine-grained sentiment score is obtained by averaging the sentiment scores of all aspects of words within the document; S23. Statistical analysis is performed on the coarse-grained and fine-grained sentiment features of the corresponding text within the same time period to obtain the coarse-grained and fine-grained sentiment data for the corresponding time period, as follows: According to the time period, obtain the coarse-grained sentiment features and fine-grained sentiment features corresponding to each text within the same time period; Based on the coarse-grained sentiment features of each text within the same time period, coarse-grained sentiment statistics are calculated to obtain coarse-grained sentiment data for the corresponding time period. Based on the fine-grained sentiment features of each text within the same time period, fine-grained sentiment statistics are calculated to obtain fine-grained sentiment data for the corresponding time period. S3. The coarse-grained sentiment data, fine-grained sentiment data, and structured feature data for the corresponding time period are fused together to obtain the prediction input data for the corresponding time period, as follows: By fusing coarse-grained sentiment data, fine-grained sentiment data, and structured feature data for the corresponding time period, the predicted input data for the corresponding time period is obtained: Let there be a total of The blog post calculates the average coarse-grained sentiment score (coarse-grained sentiment data) for this period. The mean of the fine-grained sentiment score (fine-grained sentiment data) is: The coarse-grained sentiment data and fine-grained sentiment data mentioned above are combined with the preprocessed structured feature vector from step S12. The features are concatenated to obtain the comprehensive feature vector (predicted input data) for each time period n: Where Q is the total dimension of text features and P is the dimension of structured features; S4. Standardize the predicted input data and input the standardized predicted input data into a pre-built demand prediction model to obtain the demand prediction results for the corresponding time period, as follows: S41. Standardize all features using the z-score standardization method. For each feature dimension d (d=1,2,…,D), calculate its mean. and standard deviation : Then, a standardization transformation is performed on each sample to obtain the standardized comprehensive feature vector: In the formula, Indicates the first The first time period The standardized values ​​of the features are represented by the index D, where the index D represents the total dimension of the composite feature vector. S42. Input standardized forecast input data into a pre-built demand forecasting model, which outputs the forecast demand value for the target product for the corresponding time period. Based on the forecast demand value, generate the demand forecast result for the corresponding time period, as follows: Let the standardized composite feature vector of the nth sample be... The corresponding actual demand is Construct a demand forecasting model and learn the mapping function. This makes the predicted value As close as possible to the true value Regarding the technical solution of this embodiment, the demand forecasting model includes, but is not limited to, the following four types: First, Gaussian process regression model Assume the objective function Prior to a Gaussian process: Kernel function using a combination of radial basis function (RBF) and white noise kernel: in For signal variance, For length scale, The variance of white noise. The hyperparameters are automatically optimized during training by maximizing the log-marginal likelihood, which is the Kronecker delta function. Second, the elastic network model Its prediction function is The parameters are solved by minimizing the following objective function: in, For the intercept term, for 3D feature weight vector Transpose it. Let L1 norm be the weight vector. The square of the L2 norm, Here is the regularization strength parameter. For mixed parameters, the L1 norm produces sparse solutions, and the L2 norm's squared stability coefficient is estimated. Third, Bayesian Ridge Regression Model Assuming the target variable follows a Gaussian distribution, a zero-mean Gaussian prior is introduced into the weight vector: in For noise variance, For accuracy hyperparameters; Hyperparameters are estimated by maximizing the marginal likelihood function, given a new input. The predicted distribution is: In the formula, The demand prediction results corresponding to the new input sample. This is the transpose of the posterior mean of the weight vector. The variance of the predicted values ​​corresponding to the new input sample; Fourth, Ridge Regression Model Based on standard linear regression, an L2 regularization term is introduced, and the objective function is: in To standardize the comprehensive feature vector, For regularization parameters, Let L be the square of the L2 norm of the weight vector. This optimization problem has a closed-form solution. S5. Calculate the forecast evaluation indicators based on the demand forecast results and the actual demand data for the corresponding time period, as follows: The Mean Absolute Percentage Error (MAPE) is used as the evaluation metric, and the calculation formula is as follows: in For the first Demand predictions for each test sample For the first The actual demand value for each test sample To determine the sample size for the test set, multiple sets of comparative experiments were conducted to verify the effectiveness of coarse-grained and fine-grained sentiment features in predicting supply chain demand.

[0026] The technical solution of this embodiment will be further explained below with reference to specific examples: Step 1: Data Acquisition: In this embodiment, the data used is the automotive products of a certain car manufacturer as the research object; First, collect structured data related to traditional supply chain demand forecasting: To acquire structured data, supply chain demand forecasting indicators related to the target product were collected. The selection of indicators was based on the integration of existing literature, and specific features included: market share of automobile products (%), total retail sales of consumer goods (100 million yuan), public charging facilities (10,000 units), average monthly closing price of Brent crude oil (USD / barrel), CPI (current month), manufacturing PMI, Baidu index of automobile products, Baidu index of car companies, and installed capacity of power batteries (GWh). Suppose there are 25 months, and each month n (n=1,2,...,25) corresponds to one record. Let the sales volume of dolphins in month n be denoted as... As the prediction target, other feature variables affecting sales are denoted as a vector. ,in For the total number of features, =1,2,..., This is used to index specific feature dimensions. The sources of the above data are shown in Table 1. Table 1. Sources of Structured Data Then, acquire social media text data related to the target supply chain products within a specific time period; For acquiring social media text data, Weibo platform data was selected as the data source. A web crawler program written in Python was used for data collection. Assuming the occurrence of the "September 29th recall incident of a certain car company" as the data segmentation benchmark, the main focus was on crawling blog posts containing the term "car product" from September 2023 to September 2025. During the crawling process, to ensure that the crawled comments were highly relevant to the event, keywords were added to expand the data based on the specific content of the event, including "car company recall," "car company battery failure," and "car company safety hazard," to improve the coverage of the text data. Ultimately, a total of 32,259 original blog posts were obtained. Each blog post record retained only two fields: the publication time (denoted as...). The data (including the blog post content) and blog post content (denoted as content) are all written to an Excel file and saved, with each row corresponding to one blog post. Step 2: Data Preprocessing Preprocess the structured and unstructured text data obtained in step one; First, the structured data is preprocessed by organizing the structured data collected in step one into a matrix form. The specific steps are as follows: (1) Data processing: The feature vector of each month n (Structured data features) and target value (Monthly sales volume of automobile products) corresponding combinations form a sample set. ; (2) Missing value handling: Check whether there are missing values ​​for each feature. If there are missing values, use linear interpolation to fill them in. That is, use the values ​​of adjacent time points to calculate the missing values. If the first and last time points are missing, fill them with the nearest non-missing values ​​forward or backward. (3) Outlier handling: For each feature Calculate its mean and standard deviation If a certain sample value satisfy If it is an outlier, it is considered an outlier and replaced with the median of that feature; (4) Target variable processing: Prediction target (Monthly sales) retains the original unit (vehicles) without any transformation to directly interpret the prediction results. Ultimately, each month n corresponds to one... ,common One sample is used for subsequent fusion with text features; Then, the social media text data was preprocessed, and all the crawled blog posts were stored in a single document, with each post occupying one line. Each post was denoted as... ,in For each blog post, the total number of posts is [number]. Perform the following operations in sequence: (1) Character cleaning: Remove non-Chinese characters and special symbols, including emoticons, HTML tags, URL links, non-Chinese parts of punctuation marks, etc., and keep only Chinese characters and common punctuation marks used to separate sentences (period, comma, question mark, exclamation mark, semicolon); (2) Word segmentation: The continuous text is divided into independent word sequences using the Chinese word segmentation tool jieba; (3) Stop word removal: Stop words, i.e., high-frequency words that have no practical significance for text analysis, are deleted. A general Chinese stop word list is used, and words not in the stop word list are retained. After the above preprocessing, each blog post becomes a word sequence. Let the vocabulary list be... The vocabulary size is ; Step 3: Coarse-grained emotion extraction Coarse-grained sentiment features refer to features that measure the overall sentiment tendency of a text at a macro level, i.e., document-level sentiment scores. These scores reflect whether a blog post is generally positive, negative, or neutral. They can quickly capture the macro-level sentiment trend of the public towards a specific event or product. In the context of sudden events, dramatic fluctuations in public sentiment often precede changes in actual demand. Therefore, extracting coarse-grained sentiment features can help companies perceive the overall trend of market sentiment at a macro level, promptly capture changes in public opinion, and provide high-level decision-making references for subsequent demand forecasting. The specific extraction process is as follows: For the text data preprocessed in step two, coarse-grained text analysis is performed to extract coarse-grained sentiment features: Treat each blog post after preprocessing in step two as an independent document, and denote the document set as follows: ,in For each document Perform the following processing: The Sentence-BERT model is used to convert documents into high-dimensional vector representations. Perform word segmentation, add special tags [CLS] and [SEP], and truncate or pad to a fixed length. The standardized input sequence is obtained. , convert the sequence Inputting the Sentence-BERT model, the hidden state matrix is ​​obtained by using a multi-layer Transformer encoder to obtain the context-related vector representation of each label. ,in For the hidden layer dimension; Then the hidden state matrix Perform mean pooling to calculate the average of all labeled vectors, resulting in the document-level embedding vector. : (1) In formula (1) Indicates the first position in the sequence Vector representation of each tag; Finally, the documents are calculated using the sentiment classification layer. The sentiment score is calculated, and the sentiment classification layer consists of a fully connected neural network and activation functions. (2) In formula (2) For the weight vector, For bias terms, Using a hyperbolic tangent function to ensure the sentiment score , The closer to 1, the more positive the emotion; the closer to -1, the more negative the emotion; and the closer to 0, the neutral. Step 4: Fine-grained emotion extraction; Unlike coarse-grained sentiment features, fine-grained sentiment features measure the emotional tendencies of specific objects in a text at a micro level, i.e., aspect-level sentiment scores. They focus on the emotional attitudes embodied in specific objects mentioned in the text (such as product performance, market performance, safety and quality, after-sales service, brand reputation, and supply chain), revealing the refined emotional responses of the public to specific elements. In the context of sudden events, the public often exhibits differentiated emotional responses to different dimensions of a product. Coarse-grained sentiment features alone are insufficient to capture these micro-signals; therefore, it is necessary to extract fine-grained sentiment features to more accurately pinpoint the specific sources of market sentiment and provide more refined data support for supply chain demand forecasting. The specific extraction process is as follows: An aspect-level sentiment analysis method based on a large language model is used for documents. Suppose that it contains a set of aspect entities. ,in Indicates the first Each aspect of the term, For document The total number of terms related to aspects, for terms related to aspects For each occurrence in the text, extract the left and right sides from its position as the center. The words form a string of length. Context window, computational aspects Context embedding vector As the average of all word embeddings within that context window, the aspect ratio is calculated using the sentiment classification layer. Emotional score: (3) In formula (3) and To share parameters and ensure scores ; Aggregated Documents The sentiment scores of all aspects of the words are used to obtain fine-grained sentiment scores: (4) Equation (4) Document Fine-grained sentiment score, For document The total number of terms related to Chinese, For the first The formula calculates the sentiment score for each aspect of the word by averaging the sentiment scores of all aspect words within the document, resulting in a fine-grained sentiment score.

[0027] from Figure 2Looking at the trends in coarse and fine-grained sentiment scores, the coarse-grained sentiment score generally exhibits fluctuating characteristics. It showed a significant decline and remained at a low level before and after a car recall event in September 2024, and then gradually rebounded over time, reaching a relatively high level in the later period. The fine-grained sentiment score also showed significant fluctuations. The score was at a low level during and after the recall event in September 2024. Although there were periodic fluctuations thereafter, the overall trend was one of recovery. Both showed short-term adjustments in sentiment tendency near the recall event, reflecting the phased impact of the sudden event on the sentiment evaluation dimension. Moreover, the sentiment score gradually returned to normal and showed a new fluctuation pattern over time. Step 5: Feature fusion and standardization; First, the text features of each blog post are aggregated by month, based on the publication time of each blog post. Determine the month to which it belongs For the first Month, assuming there are a total of For each blog post, the average coarse-grained sentiment score for that month is calculated as follows: The mean of the fine-grained sentiment score is ; Combine the aforementioned monthly text features with the structured feature vectors processed in step two. By piecing them together, we can obtain each month. Comprehensive feature vector ,in For structured feature dimensions, Total dimension of text features; Due to the comprehensive feature vector Each feature has different dimensions and orders of magnitude. To avoid adverse effects on model training, the z-score normalization method is used to normalize all features. Suppose there are N=25 samples in total, and the comprehensive feature vector of each sample is... ,in ; For each feature dimension Calculate its mean (Formula (5)) and standard deviation (Formula (6)): (5) (6) Then, each sample is standardized, as shown in formula (7): (7) The standardized feature vector is denoted as: In the formula, For the first The first time period The original numerical values ​​of the dimensional features. These are the standardized values. For the first The standardized comprehensive feature vector corresponding to each time period Indicates the vector to which 3D real space; Step Six: Supply Chain Demand Approach Let the first The comprehensive feature vector of each sample is The corresponding actual demand is The goal of the model is to learn the mapping function. This makes the predicted value As close as possible to the true value The selected prediction models include, but are not limited to, the following types: First, Gaussian process regression model It is a nonparametric probabilistic model based on a Bayesian framework. It does not make specific assumptions about the functional form, but rather captures the nonlinear relationships between data by assuming that the objective function follows a Gaussian process prior. For the input... Gaussian process regression not only provides the predicted mean It also provides prediction variance as a confidence measure, which is particularly suitable for small sample and nonlinear regression problems; The model assumes the objective function Prior to a Gaussian process: (8) The mean function in its formula (8) Typically set to 0, kernel function This method employs a combination of radial basis functions (RBF) and white noise kernels. Based on the settings in the code, the following kernel function is used: (9) In its formula (9) For signal variance, For length scale, The variance of white noise. For the Kronecker delta function, during training, these hyperparameters are automatically optimized by maximizing the log-marginal likelihood, and five random restarts are set to avoid getting trapped in local optima, given the training set. Test points The predicted distribution is: (10) In its formula (10) The predicted mean is... Setting `normalize_y=True` during training indicates that the target value is internally centered. Second, the elastic network model Feature selection is achieved by compressing unimportant feature coefficients to zero using L1 regularization, and coefficient shrinkage is achieved by handling the correlation between features using L2 regularization. This method is particularly suitable for scenarios with a large number of features and group correlations. Its prediction function is: (11) In its formula (11) For the feature weight vector, This is the intercept term. The model solves for the parameters by minimizing the following objective function: (12) In its formula (12) This is the regularization strength parameter, with a value of 0.1; For the mixed parameters, this method uses a value of 0.5, and the L1 norm is... To produce sparse solutions, the square of the L2 norm The stability coefficient is estimated using the coordinate descent method, with a maximum number of iterations of 1000 and a convergence tolerance of [value missing]. ; Third, Bayesian Ridge Regression Model It introduces a prior distribution for the weight coefficients from a probabilistic perspective and solves for the posterior distribution through Bayesian inference, enabling automatic estimation of regularization parameters and exhibiting better robustness in small sample scenarios. The model assumes that the target variable follows a Gaussian distribution and introduces a zero-mean Gaussian prior to the weight vector. (13) (14) In its formula (13) For noise variance, This is the accuracy hyperparameter, which is the reciprocal of the noise variance. Hyperparameter and It itself follows the Gamma prior, and its shape and scale parameters are both set to , indicating no prior information, the hyperparameters are estimated by maximizing the marginal likelihood function, as shown in formula (15): (15) Given new input The predicted distribution is: (16) In its formula (16) The posterior mean is... To predict variance, this method uses default initial values ​​for hyperparameters, a maximum number of iterations of 300, and a convergence tolerance of [value missing]. ; Fourth, Ridge Regression Model It is a classic method that introduces an L2 regularization term on top of linear regression. It limits the model complexity by penalizing the sum of squares of the weight vectors, effectively alleviating the overfitting problem caused by multicollinearity among features. Its prediction function is the same as that of the elastic network, but its objective function only contains an L2 regularization term. (17) in This is the regularization parameter, and in this method, it is set to 0.1. The optimization problem has a closed-form solution: (18) The Cholesky decomposition method is used to directly calculate the closed-form solution. Intercept term. It is not subject to regularization penalties and is automatically calculated based on the mean of the training samples; Step 7: Predictive Performance Evaluation and Comparative Analysis The prediction model trained in step six is ​​used to predict the test set. The test set is divided chronologically, using data from September 2023 to September 2025 (25 months total), with the first 20 months used as the training set and the last 5 months as the test set. The model input is the standardized comprehensive feature vector. The output is the predicted sales volume. The actual sales volume is The evaluation uses the Mean Absolute Percentage Error (MAPE), which is calculated using the following formula: (19) In its formula (19) The test set sample size is 5 in this method. MAPE measures prediction bias as a percentage; a smaller value indicates more accurate prediction. To verify the effectiveness of the proposed coarse-grained and fine-grained text features, three sets of comparative experiments were designed: First, single-granularity text feature evaluation. This group of experiments compared three feature input schemes: 1. using only basic structured features; 2. adding coarse-grained sentiment features to the structured data; 3. adding fine-grained sentiment features to the structured data. The prediction results of each scheme under the four models are shown in Table 2.

[0028] Table 2 Comparison of Single-Granularity Text Feature Prediction Performance Experimental results show that adding coarse-grained and fine-grained sentiment features to the basic structured features significantly improves the prediction accuracy of all models, with the improvement being particularly pronounced in months with sudden events. Gaussian process regression shows the most significant improvement—with the addition of coarse-grained features, the MAPE decreases from 8.63% to 4.50%, a reduction of 47.9%; with the addition of fine-grained features, the MAPE decreases to 5.22%. Among the single-granularity feature schemes, coarse-grained features achieve better overall prediction performance at the single feature dimension, obtaining the lowest MAPE values ​​for both Elastic Network and Bayesian Ridge Regression. Random Forest shows R² close to 0 or negative in all schemes, indicating severe overfitting in the small sample scenarios of this dataset, making it unsuitable for this task. Second, multi-granularity feature combination evaluation. Coarse-grained and fine-grained sentiment features were simultaneously added to the basic structured features, and the predictive performance of the combination scheme was evaluated. The results are shown in Table 3.

[0029] Table 3 Comparison of Prediction Performance of Multi-Granularity Feature Combination Under small sample conditions (25 months), adding both coarse and fine-grained sentiment features did not further improve the prediction accuracy of the models compared to the single-granularity approach. This may be because: firstly, there is some information overlap between coarse and fine-grained sentiment scores, introducing redundant information; secondly, relative to the limited sample size, increasing the feature dimension may lead to a decrease in the model's generalization ability. This finding suggests that in small-sample prediction scenarios for sudden events, the most representative granularity feature should be selected based on the sample size, rather than blindly pursuing an increase in the number of features. Third, model selection and comparative analysis Fourth, such as Figure 3 As shown, combining the results of Experiment 1 and Experiment 2, coarse-grained sentiment features achieved the best overall prediction effect as a single feature and were determined to be the optimal feature scheme for this task.

[0030] Using basic structured features plus coarse-grained sentiment scores as a unified input, the predictive performance of each model was compared: the Elastic Network achieved the lowest MAPE (4.46%), followed closely by Gaussian Process Regression (GPR) at 4.50%. As a Bayesian nonparametric model, GPR naturally provides prediction variance as a confidence measure, offering quantitative information on prediction uncertainty for supply chain managers. Considering both prediction accuracy and decision-making practicality, GPR is recommended as the preferred model for this task.

[0031] In summary, this embodiment verifies the effectiveness of the supply chain demand forecasting method that integrates coarse and fine-grained sentiment data under emergencies proposed in this invention. Coarse-grained sentiment features extracted from social media text can significantly improve the accuracy of demand forecasting under emergencies. Compared to the baseline scheme using only structured data, the scheme combining Gaussian process regression with coarse-grained sentiment features reduces the MAPE from 8.63% to 4.50%, and the prediction error is reduced by 47.9%, providing reliable technical support for supply chain demand forecasting under emergencies.

[0032] Example 2: This embodiment provides a supply chain demand forecasting system that integrates coarse and fine-grained text data under emergencies, used to implement the supply chain demand forecasting method that integrates coarse and fine-grained text data under emergencies described in Embodiment 1, including: The data acquisition module is used to acquire structured business data and social media text data corresponding to the target product, preprocess the structured business data to obtain structured feature data, and preprocess the social media text data to obtain text data. The feature extraction module is used to extract coarse-grained sentiment features and fine-grained sentiment features of the corresponding text based on the text data, and to statistically analyze the coarse-grained sentiment features and fine-grained sentiment features of the corresponding text within the same time period based on the publication time of the text, so as to obtain coarse-grained sentiment data and fine-grained sentiment data for the corresponding time period. The data fusion module is used to fuse coarse-grained sentiment data and fine-grained sentiment data of the corresponding time period with the structured feature data of the corresponding time period to obtain the prediction input data of the corresponding time period. The prediction result output module is used to standardize the prediction input data and input the standardized prediction input data into a pre-built demand prediction model to obtain the demand prediction result for the corresponding time period. The evaluation module is used to calculate the predictive evaluation index based on the demand forecast results and the actual demand data for the corresponding time period.

[0033] Example 3: The present invention provides a terminal device, including a memory, a processor, and a computer program stored in the memory and capable of running on the processor. The memory stores the computer program capable of running on the processor. When the processor loads and executes the computer program, it employs the supply chain demand forecasting method for fusing coarse and fine-grained text data under sudden events as described in Embodiment 1.

[0034] It should be noted that the terminal device can be a computer device such as a desktop computer, a laptop computer, or a cloud server, and the terminal device includes, but is not limited to, a processor and a memory. For example, the terminal device may also include input / output devices, network access devices, and buses.

[0035] Furthermore, the processor can be a central processing unit (CPU). Of course, depending on the actual use, other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), off-the-shelf programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. can also be used. The general-purpose processor can be a microprocessor or any conventional processor, etc., and this application does not limit it in this regard.

[0036] Example 4: The present invention provides a storage medium containing computer-executable instructions, which, when executed by a computer processor, are used to perform the supply chain demand forecasting method for fusing coarse and fine-grained text data under sudden events as described in Embodiment 1.

[0037] The computer program can be stored in a computer-readable medium. The computer program includes computer program code, which can be in the form of source code, object code, executable file, or certain middleware. The computer-readable medium includes any entity or device capable of carrying computer program code, recording media, USB flash drive, portable hard drive, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signals, telecommunication signals, and software distribution media, etc. It should be noted that the computer-readable medium includes, but is not limited to, the above-mentioned components.

[0038] In the description of this specification, the references to terms such as "an embodiment," "example," "specific example," etc., indicate that a specific feature, structure, material, or characteristic described in connection with that embodiment or example is included in at least one embodiment or example of this application. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples.

[0039] The foregoing has shown and described the basic principles, main features, and advantages of this application. Those skilled in the art should understand that this application is not limited to the above embodiments. The embodiments and descriptions in the specification are merely illustrative of the principles of this application. Various changes and modifications can be made to this application without departing from the spirit and scope thereof, and all such changes and modifications fall within the scope of the claims of this application.

Claims

1. A supply chain demand forecasting method integrating coarse and fine-grained text data under emergency events, characterized in that... Includes the following steps: Obtain structured business data and social media text data corresponding to the target product within a preset time range; preprocess the structured business data to obtain structured feature data; and preprocess the social media text data to obtain text data. Based on the text data, extract the coarse-grained sentiment features and fine-grained sentiment features of the corresponding text. Based on the publication time of the text, statistically analyze the coarse-grained sentiment features and fine-grained sentiment features of the corresponding text within the same time period to obtain the coarse-grained sentiment data and fine-grained sentiment data for the corresponding time period. By fusing coarse-grained sentiment data, fine-grained sentiment data, and structured feature data of the corresponding time period, the predicted input data for the corresponding time period is obtained. The predicted input data is standardized, and the standardized predicted input data is input into a pre-built demand prediction model to obtain the demand prediction results for the corresponding time period. The forecast evaluation index is calculated based on the demand forecast results and the actual demand data for the corresponding time period.

2. The supply chain demand forecasting method for unforeseen events that integrates coarse and fine-grained text data as described in claim 1, characterized in that: Obtain structured business data and social media text data corresponding to the target product. Preprocess the structured business data to obtain structured feature data, and preprocess the social media text data to obtain text data, as detailed below: Obtain structured business data corresponding to the target product within a preset time range, wherein the structured business data includes historical demand data corresponding to the target product and business data affecting changes in demand; The structured business data is organized according to a preset time period, missing data is filled in, and abnormal data is replaced to obtain structured feature data for the corresponding time period. Acquire social media text data corresponding to the target product and record the posting time of each text; The social media text data is cleaned, segmented into Chinese words, and has stop word removal processes to obtain text data for sentiment analysis.

3. The supply chain demand forecasting method for unforeseen events that integrates coarse and fine-grained text data as described in claim 1, characterized in that: Based on the text data, coarse-grained sentiment features of the corresponding text are extracted as follows: The text data is acquired and input into the text encoding model; The semantic representation data of the corresponding text is output based on the text encoding model; A sentiment score reflecting the overall sentiment tendency of the text is calculated based on the semantic representation data. The sentiment score, which reflects the overall sentiment tendency of the text, is used as the coarse-grained sentiment feature of the corresponding text.

4. The supply chain demand forecasting method for unforeseen events that integrates coarse and fine-grained text data as described in claim 3, characterized in that: Based on the text data, fine-grained sentiment features of the corresponding text are extracted as follows: The text data is obtained, and the aspect entities involved in the text data are identified to obtain the aspect entity data of the corresponding text. Based on the entity data of each aspect, extract the text content corresponding to each entity; Based on the text content corresponding to each entity, the sentiment tendency of each entity is analyzed to obtain the sentiment score of each entity. Statistical processing is performed on the sentiment scores corresponding to various entities to obtain the fine-grained sentiment score of the corresponding text, and the fine-grained sentiment score is used as the fine-grained sentiment feature of the corresponding text.

5. The supply chain demand forecasting method for unforeseen events that integrates coarse and fine-grained text data as described in claim 4, characterized in that: Based on the publication time of the text, the coarse-grained sentiment features and fine-grained sentiment features of the corresponding text within the same time period are statistically analyzed to obtain the coarse-grained sentiment data and fine-grained sentiment data for the corresponding time period, as follows: According to the time period, obtain the coarse-grained sentiment features and fine-grained sentiment features corresponding to each text within the same time period; Statistical processing is performed on the coarse-grained sentiment features of each text within the same time period to obtain coarse-grained sentiment data for the corresponding time period. Statistical processing is performed on the fine-grained sentiment features of each text within the same time period to obtain fine-grained sentiment data for the corresponding time period.

6. The supply chain demand forecasting method for unforeseen events that integrates coarse and fine-grained text data according to claim 1, characterized in that: The coarse-grained sentiment data, fine-grained sentiment data, and structured feature data for the corresponding time period are fused together to obtain the prediction input data for the corresponding time period, as follows: Obtain structured feature data, coarse-grained sentiment data, and fine-grained sentiment data for the corresponding time period; The structured feature data, coarse-grained sentiment data, and fine-grained sentiment data are time-corresponding according to the corresponding time periods; The structured feature data, coarse-grained sentiment data, and fine-grained sentiment data corresponding to the time are combined according to a preset feature order to obtain fused data, which is then used as the prediction input data for the corresponding time period.

7. The supply chain demand forecasting method for unforeseen events that integrates coarse and fine-grained text data as described in claim 1, characterized in that: The predicted input data is standardized, and the standardized predicted input data is then input into a pre-built demand forecasting model to obtain the demand forecasting results for the corresponding time period, as follows: Obtain the prediction input data, and then standardize the obtained prediction input data to obtain standardized prediction input data. Standardized forecast input data is fed into a pre-built demand forecasting model; The demand forecasting model outputs the demand forecast results for the target product for the corresponding time period.

8. The supply chain demand forecasting method for unforeseen events that integrates coarse and fine-grained text data as described in claim 7, characterized in that: The demand forecasting model can be any one of the following: Gaussian process regression model, elastic network model, Bayesian ridge regression model, and ridge regression model.

9. The supply chain demand forecasting method for unforeseen events that integrates coarse and fine-grained text data as described in claim 7, characterized in that: Based on the demand forecast results and the actual demand data for the corresponding time period, the forecast evaluation indicators are calculated as follows: Obtain the actual demand data for the time period corresponding to the demand forecast results; Based on actual demand data, the mean absolute percentage error calculation result is used as the prediction evaluation index. The predictive performance of the demand forecasting model is evaluated based on the aforementioned predictive evaluation indicators.

10. A supply chain demand forecasting system integrating coarse and fine-grained text data under emergencies, used to implement the supply chain demand forecasting method integrating coarse and fine-grained text data under emergencies as described in any one of claims 1 to 9, characterized in that, include: The data acquisition module is used to acquire structured business data and social media text data corresponding to the target product, preprocess the structured business data to obtain structured feature data, and preprocess the social media text data to obtain text data. The feature extraction module is used to extract coarse-grained sentiment features and fine-grained sentiment features of the corresponding text based on the text data, and to statistically analyze the coarse-grained sentiment features and fine-grained sentiment features of the corresponding text within the same time period based on the publication time of the text, so as to obtain coarse-grained sentiment data and fine-grained sentiment data for the corresponding time period. The data fusion module is used to fuse coarse-grained sentiment data and fine-grained sentiment data of the corresponding time period with the structured feature data of the corresponding time period to obtain the prediction input data of the corresponding time period. The prediction result output module is used to standardize the prediction input data and input the standardized prediction input data into a pre-built demand prediction model to obtain the demand prediction result for the corresponding time period. The evaluation module is used to calculate the predictive evaluation index based on the demand forecast results and the actual demand data for the corresponding time period.