Food and beverage network sales trend prediction model construction system and method based on multi-source data fusion and deep learning
By using multi-source data fusion and deep learning methods, and employing the LSTM-Transformer algorithm, a predictive model for online sales trends of food and beverages is constructed. This solves the problems of single data fusion dimension and insufficient model prediction accuracy in existing technologies, and achieves high-precision prediction of online sales trends of food and beverages.
Patent Information
- Application Number
- CN202511021641.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-24
- Publication Date
- 2025-12-23
- Estimated Expiration
- 2045-07-24
AI Technical Summary
Existing technologies for predicting online sales trends in the food and beverage industry rely on a single dimension of multi-source data fusion, fail to achieve cross-domain feature association, lack deep learning architecture in prediction models, and struggle to handle nonlinear mapping relationships, resulting in insufficient prediction accuracy.
We adopted a method based on multi-source data fusion and deep learning, and obtained relevant data on online sales of food and beverages through web crawlers and API interfaces. We combined data cleaning, feature extraction and deep learning model construction, and used an improved LSTM-Transformer algorithm to perform nonlinear mapping modeling, integrating temporal features and global dependency analysis.
It achieves high-precision prediction of online sales trends for food and beverages, solves the problems of single data fusion dimension and lack of deep learning architecture in prediction model, and improves the stability and accuracy of prediction model.
Smart Images

Figure CN120655340B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of food and beverage, in particular to a food and beverage network sales trend prediction model construction system and method based on multi-source data fusion and deep learning. BACKGROUND
[0002] In the food and beverage industry, with the popularization of Internet technology, network sales has become an important sales channel. The market environment is complex and changeable, and the network sales trend of food and beverage is affected by many factors, such as the rapid replacement of consumer preferences, seasonal factors, sudden social events, and various marketing activities. Accurate prediction of sales trends can help enterprises plan production, accurately allocate marketing resources, and gain an advantage in fierce market competition.
[0003] In the related technical field, there have been many researches and practices on sales trend prediction. For example, Chinese patent CN202310005840.6 discloses a method and device for predicting the network sales trend of agricultural products, a medium, and equipment. The method includes: crawling product information of a preset agricultural product in an Internet sales platform; extracting feature keywords of the preset agricultural product from the product information, forming a characteristic label according to the feature keywords, and labeling the preset agricultural product sold in the Internet sales platform using the characteristic label; determining the sales proportion of the preset agricultural product corresponding to each type of characteristic label; obtaining the comment information of the preset agricultural product corresponding to each type of characteristic label, and determining the positive and negative nature of the comment information corresponding to the characteristic label; determining whether there is a sales proportion greater than a preset proportion value in the sales proportion corresponding to each type of characteristic label; if there is, the characteristic label corresponding to the sales proportion greater than the preset proportion value is determined as the overall representative label of the preset agricultural product to determine the overall sales trend of the preset agricultural product. The present application realizes the prediction of the sales trend of agricultural products. For another example, Chinese patent CN202411278350.4 discloses a product precision sales analysis system and method based on big data. The system and method obtain product sales related data from multiple data sources through a data acquisition module, including sales volume, sales amount, and market feedback data. The data storage module stores the collected product sales data in a structured manner. The data processing module uses big data processing technology to clean, integrate, and analyze the stored sales data. The prediction analysis module uses a prediction model to predict product sales trends and market demand based on historical data and existing data trends. The visualization display module displays the analysis results in the form of intuitive charts and reports to users, helping them understand market dynamics and product performance, efficiently and accurately analyze product sales data, improve enterprise market insight and decision-making ability, optimize product promotion and sales strategies, and thus improve sales performance and market competitiveness.
[0004] Although the above technical solutions have their design advantages, the technical solutions still have the following technical defects: firstly, the multi-source data fusion dimension is single, and cross-domain feature association is not achieved. Chinese patent CN202310005840.6 only relies on product self-label and comment data, does not include external variables such as meteorological information (such as the influence of temperature on cold drink sales) and industry policy, and the feature extraction stays at the keyword statistics level, which cannot capture cross-related features such as "price elasticity-weather fluctuation"; Chinese patent CN202411278350.4 mentions multi-source data collection, but does not explicitly mention the processing logic of unstructured data (such as social media sentiment text), and lacks a cooperative modeling mechanism for time series features (such as sales cycle) and global features (such as public opinion heat). Secondly, the prediction model lacks deep learning architecture innovation, and it is difficult to handle nonlinear mapping relationships. Chinese patent CN202310005840.6 realizes trend prediction through "label proportion threshold judgment", which is essentially a rule-based statistical method and cannot capture complex nonlinear relationships between sales and influencing factors; Chinese patent CN202411278350.4 mentions "prediction model", but does not disclose the specific algorithm architecture, and traditional time series models (such as ARIMA) are difficult to handle long-distance dependencies (such as seasonal periodicity) and sudden factors (such as promotion activities) at the same time, and do not introduce an attention mechanism to realize cross-feature weight allocation, resulting in insufficient prediction accuracy in complex scenarios. In view of this, we propose a food and beverage network sales trend prediction model construction system and method based on multi-source data fusion and deep learning. SUMMARY
[0005] The purpose of the present application is to provide a food and beverage network sales trend prediction model construction system and method based on multi-source data fusion and deep learning, to solve the problem of single multi-source data fusion dimension and lack of cross-domain feature association in the background art, and the problem of lack of deep learning architecture innovation in the prediction model, which is difficult to handle nonlinear mapping relationships.
[0006] To solve the above technical problems, one of the purposes of the present application is to provide a food and beverage network sales trend prediction model construction system based on multi-source data fusion and deep learning, comprising:
[0007] A data acquisition unit is used to acquire multi-source data related to food and beverage network sales, based on network crawler technology and API interface calling technology, to acquire data from network sales platforms, social media platforms, industry information websites, and meteorological information databases;
[0008] The data processing unit is used for pre-processing and feature extraction of multi-source data collected by the data collection unit, removes repeated and incorrect data through a data cleaning algorithm, denoises by using a median filter algorithm, completes data normalization and missing value filling by combining a minimum-maximum normalization method and a random forest algorithm, and extracts multi-dimensional prediction features by using a feature engineering technology;
[0009] The model construction unit is used for constructing a deep learning prediction model, adopts an improved LSTM-Transformer fusion algorithm, realizes nonlinear mapping modeling of a food and beverage sales trend by integrating time series feature modeling and global dependency analysis technology;
[0010] The model training and verification unit is used for training and verifying the deep learning model, trains the deep learning model based on a historical data set, adjusts model parameters by using an Adam optimization algorithm, sets learning rate, iteration number and batch size hyperparameters for model optimization, and calculates accuracy, mean square error and mean absolute error of a validation data set independent of the training data to evaluate the prediction performance of the model;
[0011] The prediction output unit is used for outputting a food and beverage network sales trend prediction result, receives real-time data processed by the data processing unit, inputs the trained deep learning model for prediction, and displays the prediction result in the form of multi-dimensional charts by using Echarts visualization technology.
[0012] As a further improvement of the technical solution, the data collection unit includes a network sales platform data collection module, a social media data collection module, an industry information data collection module and a meteorological information data collection module, wherein:
[0013] The network sales platform data collection module obtains sales order information, user purchase behavior data and product price change logs from an e-commerce platform database through a RESTful API interface;
[0014] The social media data collection module uses a Scrapy framework to build a web crawler, collects user evaluation text, topic labels and interaction data on food and beverages from public API interfaces of multiple e-commerce platforms;
[0015] The industry information data collection module accesses industry report websites through a timing task, parses HTML pages to obtain policy files, new product release announcements and market analysis white papers;
[0016] The meteorological information data collection module obtains real-time temperature, precipitation probability and humidity data based on an OpenWeatherMap API interface, and the time granularity is hourly.
[0017] As a further improvement to this technical solution, the data processing unit includes a data cleaning module, a data denoising module, and a data standardization module, wherein:
[0018] The data cleaning module generates unique identifiers for the collected sales order data using the MD5 hash algorithm, identifies and deletes duplicate records based on the order ID and timestamp, and uses the 3σ principle to detect price outliers, marking data as erroneous when price fluctuations exceed the historical mean ± 3 times the standard deviation.
[0019] The data denoising module is used to apply a median filtering algorithm with a window size of 5 to the sales time series data, calculate the median within the sliding window to replace outliers; and to use the TF-IDF algorithm to identify and remove spam comments whose keyword frequency exceeds the threshold for user review text.
[0020] The data standardization module is used to process numerical features using a minimum-maximum normalization method, and the calculation formula is as follows: ;in, These are the original eigenvalues. and These are the minimum and maximum values of the feature in the training dataset, respectively; These are the normalized feature values; and one-hot encoding is used for the classification features.
[0021] As a further improvement to this technical solution, the data processing unit also includes a feature engineering module. The feature engineering module uses feature engineering techniques to extract multi-dimensional predictive features, including the following steps:
[0022] S240.1, Time Dimension Feature Extraction: A time parsing algorithm is used to extract weekday ordinal features, holiday features, and seasonal classification features based on the sales timestamp; specifically including:
[0023] Weekday Ordinal Feature: Extract the weekday ordinal number corresponding to the date and map Monday to Sunday to values from 1 to 7 (e.g., Monday = 1, Sunday = 7).
[0024] Holiday characteristics: By comparing with the statutory holiday schedule issued by the State Council, a binary feature is generated to determine whether it is a holiday (yes = 1, no = 0).
[0025] Seasonal classification characteristics: Divided into four seasons according to months (March-May = Spring = 1, June-August = Summer = 2, September-November = Autumn = 3, December-February = Winter = 4).
[0026] S240.2, Text Sentiment Feature Extraction: Using natural language processing techniques, sentiment features are generated based on user review texts; specifically including:
[0027] Perform word segmentation on the text and remove stop words;
[0028] The BERT pre-trained model was used to calculate the sentiment polarity score, and the score was mapped to the [-1,1] interval (-1 is strong negative, 1 is strong positive).
[0029] Emotional levels are categorized into three levels: negative, neutral, and positive, based on preset thresholds.
[0030] S240.3, Cross-correlation Feature Extraction: Using data association analysis methods, price elasticity features and weather impact features are generated based on multi-source data; specifically including:
[0031] Price elasticity characteristic: Based on the cyclical changes in price and sales volume, calculate the ratio of the rate of change in price to the rate of change in sales volume. The formula is:
[0032] ;
[0033] Weather impact characteristics: Through linear regression analysis, a functional relationship between historical temperature data and sales volume on corresponding dates is established, generating a temperature-sales elasticity coefficient;
[0034] S240.4 Feature Selection and Dimensionality Reduction: A random forest algorithm is used to select key features based on feature importance.
[0035] Calculate the importance scores of the time dimension features, text sentiment features, and cross-correlation features extracted from S240.1-S240.3;
[0036] Sort the features in descending order of their scores and sum them up. Retain the feature subset with a cumulative importance of 80%-90% and remove features with low contribution.
[0037] As a further improvement to this technical solution, the model building unit uses an improved LSTM-Transformer fusion algorithm to model the nonlinear mapping of food and beverage sales trends, including the following steps:
[0038] S300.1, Bidirectional Encoding of Temporal Features:
[0039] The temporal features extracted in step S240.1 (such as the time series of weekday ordinal features and seasonal classification features) are encoded using a bidirectional long short-term memory (Bi-LSTM) network, specifically including:
[0040] Input processing: Arrange the time features by time step. ;in, This is a holistic representation of time-series feature data. For batch size, The historical time step (e.g., 14 days). For time-related features (e.g., 128 dimensions). It is the set of real numbers;
[0041] Network configuration: The number of hidden units in the unidirectional LSTM is set to 256, and the feature dimension after concatenation of bidirectional outputs is 512. The calculation formula is as follows:
[0042] ;
[0043] ;
[0044] ;
[0045] in, express Always in a forward-facing, hidden state; This indicates that the forward LSTM computes the function; express Temporal input characteristics at any given time; express The hidden state of the forward LSTM at each time step; express The hidden state of the LSTM after time step; This indicates the function computed by the backward LSTM; express The hidden state of the LSTM after time step; This represents the temporal coding features of the final output of the bidirectional LSTM; Indicates a splicing operation; This describes the feature dimensions.
[0046] S300.2, Global Feature Multi-Head Attention Modeling:
[0047] Cross-feature association analysis is performed on the global features (such as sentiment level and price elasticity) extracted in steps S240.2-S240.3, specifically including:
[0048] Dimensional alignment: Global features are mapped to 512 dimensions through a linear transformation, forming... ;in, The number of global features (e.g., 10); Input as global features;
[0049] Multi-head Query, Key, Value Generation: Perform multi-head projection to generate query vector, key vector, and value vector;
[0050] No. The projection formula for each of the 8 heads is:
[0051] ;
[0052] ;
[0053] ;
[0054] in, Indicates the first The query vector of the head; Indicates the first The Query projection matrix of the head; Indicates the first The key vector of each head; Indicates the first Key projection matrix of the head; Indicates the first A vector of values for each head; Indicates the first Value projection matrix of each head;
[0055] Self-attention weight calculation and feature aggregation: Calculating the first... The self-attention weights of each size are aggregated into a value vector;
[0056] ;
[0057] ;
[0058] in, Indicates the first Among them, the first The first feature and the second The association weights of each feature; Represents the normalization function; Indicates the first In the query vector of the first head, the first Feature vectors of each sample; Indicates the first In the Key vector of the first head, the first... Transpose of the feature vectors of each sample; This represents the scaling factor. 64 is the dimension of a single attention head (corresponding to the dimension of the preorder projection matrix). Scaling avoids excessively large inner product values that could cause the Softmax gradient to vanish, resulting in a more reasonable weight distribution. Indicates the first Features after aggregation of individual units; Indicates the first Attention weight matrix for size; Indicates the first The value vector of each head;
[0059] Multi-head result concatenation and layer normalization: The attention results from 8 heads are concatenated and then subjected to linear transformation and layer normalization to output globally correlated features. ,
[0060] ;
[0061] in, Presentation layer normalization operation; This represents the output of concatenating eight attention heads, used to fuse multi-dimensional related information; This represents the output projection matrix, used to map the concatenated features to a specified dimension.
[0062] S300.3, Two-Dimensional Feature Fusion and Prediction:
[0063] The temporally encoded features are fused with globally correlated features and mapped to the prediction space.
[0064] Feature fusion: Generate 1024-dimensional fused features by concatenating channels. After aligning the time steps, the dimension is ;in, This represents the final generated fusion feature; A function representing a concatenation operation; This represents the temporal features obtained through bidirectional LSTM encoding; This represents the global association features obtained through Transformer encoding; Indicates batch size; Indicates the time step; Indicates the number of global features; Indicates taking and The larger value in the value is used to align time steps; This represents the channel dimension of the fused features, because and Each has 512 dimensions, and when combined, they form... dimension;
[0065] Predicted output: Mapped to a sales trend prediction dimension (e.g., sales volume for the next 7 days) via a fully connected layer. The calculation formula is as follows:
[0066] ;
[0067] in, This represents the predicted value output by the model; Indicates a fully connected layer; Indicates fusion characteristics; This represents the weight matrix of the fully connected layer; This represents the bias term of the fully connected layer; This indicates the dimensional form of the predicted value. It refers to the batch size. It predicts the step size;
[0068] S300.4, Model Training and Optimization:
[0069] To improve prediction accuracy, an adaptive training strategy is adopted, which includes:
[0070] Define an impairment function, using mean squared error to measure the difference between predicted and true values. Quantify the model's prediction error by calculating the mean squared difference between predicted and true values. The formula is:
[0071] ;
[0072] in, For batch size, To predict the step size, It is the first The first sample The predicted value of the step, For the corresponding true value;
[0073] Optimized configuration: The Adam algorithm was selected to optimize model parameters, with an initial learning rate of 0.001. To balance the convergence speed in the early stages of model training with its stability in later stages, the learning rate was increased by [percentage missing] every 10 training epochs. It undergoes exponential decay, where The initial learning rate allows the model to quickly approximate a better solution in the early stages, and the parameters are finely adjusted in the later stages.
[0074] The batch size is set to 64, meaning 64 samples are input simultaneously to update the model during each training iteration; the maximum number of iterations is set to 100 to control the training duration. When dividing the dataset, 30% of the data is used as a validation set to monitor the model training process; if the MSE of the validation set increases for three consecutive iterations, it indicates that the model may be overfitting, triggering an early stopping mechanism to terminate training, avoid invalid iterations, and improve training efficiency.
[0075] As a further improvement to this technical solution, the model training and verification unit includes a training parameter configuration module, a parameter iteration adjustment module, and a training process monitoring module, wherein:
[0076] The training parameter configuration module is used to set the hyperparameters of the Adam optimization algorithm, wherein the initial learning rate is selected from the range of 0.0001 to 0.001, the number of iterations is set to 50 to 200, and the batch size is selected from 32 to 128.
[0077] The parameter iteration adjustment module is based on historical datasets and updates model parameters round by round through the Adam optimization algorithm, covering core parameters such as fully connected layer weights, bias terms and LSTM hidden layer states, and uses gradient descent mechanism to achieve parameter optimization.
[0078] The training process monitoring module is used to calculate the mean squared error and loss function value of the training set in real time during training iterations, and to plot the loss curve. When the loss decreases by less than 0.001 to 0.01 for 3 to 5 consecutive rounds, the learning rate decay is triggered, and the decay coefficient is 0.1 times the initial learning rate.
[0079] As a further improvement to this technical solution, the model training and verification unit further includes a verification set partitioning module, a performance evaluation calculation module, and a model performance determination module, wherein:
[0080] The validation set partitioning module splits out independent validation datasets from the historical dataset at a ratio of 20% to 30%, ensuring that the validation set and the training set are consistent in terms of data distribution characteristics (such as seasonal sales trends and promotional activity frequency).
[0081] The performance evaluation calculation module uses the validation dataset to calculate the model prediction performance, including accuracy (suitable for sales range classification scenarios), mean squared error, and mean absolute error. The model accuracy is quantified by the difference between the predicted value and the true value.
[0082] The model performance evaluation module calculates the mean squared error, mean absolute error, and accuracy (accuracy evaluation is required if applicable) based on the prediction results of the validation set. When using mean squared error, mean absolute error, and accuracy for evaluation, if the mean squared error is less than 0.05-0.2, the mean absolute error is less than 0.03-0.15, and the accuracy (if applicable) is greater than 70%-90%, the model prediction performance is deemed satisfactory; otherwise, the model parameter readjustment or structural optimization process is triggered.
[0083] As a further improvement to this technical solution, the prediction output unit includes a real-time data adaptation module, a model inference execution module, and an Echarts visualization rendering module, wherein:
[0084] The real-time data adaptation module is used to receive real-time data from the data processing unit and automatically verify the consistency of data dimensions (such as sales volume, price, and promotional labels) with time (day / week / month).
[0085] The model inference execution module is used to input the verified data into the trained deep learning prediction model and output the sales trend prediction (including sales volume and category ratio) for the next 1-30 days.
[0086] The Echarts visualization rendering module generates visual charts using Echarts, including at least a line chart comparing historical and predicted sales and a pie chart showing the sales percentage of each product category, intuitively displaying the prediction results.
[0087] As a further improvement to this technical solution, the Echarts visualization rendering module includes a basic chart generation submodule, an exception alert submodule, and an interactive response submodule, wherein:
[0088] The basic chart generation submodule uses Echarts to generate line charts comparing historical and predicted sales and pie charts showing the sales percentage of product categories.
[0089] The anomaly warning submodule is based on a preset fluctuation threshold (such as sales increase ≥ 50% or sales decrease ≤ 30%), and uses red markers to mark predicted anomaly points in the line graph.
[0090] The interactive response submodule is used to respond to category click operations and separately display the historical and predicted trend subgraphs of the selected category (such as beverages).
[0091] The second objective of this invention is to provide a method for constructing a food and beverage online sales trend prediction model based on multi-source data fusion and deep learning. The system for constructing such a model, based on any of the aforementioned methods, includes the following steps:
[0092] S100: Collects multi-source data related to online sales of food and beverages, and obtains data from online sales platforms, social media, industry information websites and meteorological information databases based on web crawling technology and API interface calls.
[0093] S200 preprocesses and extracts features from the multi-source data collected by S100. Through data cleaning, denoising, and normalization, feature engineering techniques are used to extract multi-dimensional predictive features (such as time dimension, text sentiment, and cross-correlation).
[0094] S300: Construct a deep learning prediction model and adopt an improved LSTM-Transformer fusion algorithm. It uses bidirectional LSTM to encode temporal features and Transformer to model global features, and fuses the two-dimensional features and maps them to the sales trend prediction space.
[0095] S400: Train a deep learning prediction model based on historical datasets, using the Adam optimization algorithm, learning rate, batch size and number of training rounds as hyperparameters, and use the validation set to evaluate accuracy, mean squared error and mean absolute error, and iteratively optimize the parameters of the deep learning prediction model.
[0096] The S500 inputs the processed data into the trained deep learning prediction model to generate future sales trend prediction results, which are then displayed in multi-dimensional charts using visualization technology.
[0097] Compared with the prior art, the beneficial effects of the present invention are as follows:
[0098] 1. This invention integrates multi-source data such as online sales platform data, social media sentiment text, meteorological information, and industry news, and combines feature engineering technology to extract time dimension features, text sentiment features, and cross-correlation features such as price elasticity-weather impact, comprehensively covering the influencing factors of food and beverage sales, and solving the problem of single data dimension in traditional solutions;
[0099] 2. This invention employs an improved LSTM-Transformer fusion algorithm, which captures the temporal dependence of sales data through bidirectional LSTM and utilizes the multi-head attention mechanism of Transformer to model global feature associations, thereby realizing a nonlinear mapping of sales trends and breaking through the limitations of traditional statistical models or simple time series models.
[0100] 3. This invention uses the Adam optimization algorithm to dynamically adjust parameters, exponentially decay the learning rate, and implement an early stopping mechanism to avoid model overfitting. Combined with multi-index evaluation on the validation set, it improves the predictive stability of the model in complex scenarios.
[0101] 4. This invention removes abnormal data and unifies feature scales through preprocessing operations such as data cleaning, median filtering for noise reduction, and min-max normalization, providing high-quality input for deep learning models and solving the problems of high noise and inconsistent dimensions in multi-source data. Attached Figure Description
[0102] Figure 1 This is a system framework diagram of the present invention;
[0103] Figure 2 This is a schematic diagram of the method steps of the present invention;
[0104] The meanings of the labels in the diagram are as follows:
[0105] 100. Data Acquisition Unit; 110. Online Sales Platform Data Acquisition Module; 120. Social Media Data Acquisition Module; 130. Industry Information Data Acquisition Module; 140. Meteorological Information Data Acquisition Module;
[0106] 200. Data Processing Unit; 210. Data Cleaning Module; 220. Data Denoising Module; 230. Data Standardization Module; 240. Feature Engineering Module;
[0107] 300. Model building unit;
[0108] 400. Model Training and Validation Unit; 410. Training Parameter Configuration Module; 420. Parameter Iteration Adjustment Module; 430. Training Process Monitoring Module; 440. Validation Set Partition Module; 450. Performance Evaluation Calculation Module; 460. Model Performance Determination Module;
[0109] 500. Prediction Output Unit; 510. Real-time Data Adaptation Module; 520. Model Inference Execution Module; 530. Echarts Visualization Rendering Module; 531. Basic Chart Generation Submodule; 532. Anomaly Alert Submodule; 533. Interactive Response Submodule. Detailed Implementation
[0110] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the scope of protection of the present invention. Example 1
[0111] like Figure 1 As shown, this embodiment provides a system for constructing a food and beverage online sales trend prediction model based on multi-source data fusion and deep learning, including:
[0112] The data acquisition unit 100 is used to collect multi-source data related to online sales of food and beverages. Based on web crawling technology and API interface calling technology, it obtains data from online sales platforms, social media platforms, industry information websites and meteorological information databases.
[0113] In this step, the data acquisition unit 100 includes a network sales platform data acquisition module 110, a social media data acquisition module 120, an industry information data acquisition module 130, and a meteorological information data acquisition module 140, wherein:
[0114] The online sales platform data acquisition module 110 obtains sales order information, user purchase behavior data and product price change logs from the e-commerce platform database through the RESTful API interface.
[0115] As a further explanation of this embodiment, the online sales platform data collection module 110 in this embodiment is connected to mainstream e-commerce platforms (such as Taobao and JD.com). After authentication through the API key provided by the platform, it calls the order / get interface to obtain order data for the past 12 months, including fields such as order number, product SKU, purchase quantity, and transaction price; it collects user browsing, adding to cart, and favorites behavior data through the user / behavior interface; at the same time, for unstructured price change logs, regular expressions are used to extract the price change time, the price difference before and after, and the promotion type (such as discount for purchases over a certain amount, discount for purchases over a certain amount).
[0116] The social media data collection module 120 uses the Scrapy framework to build a web crawler to collect user reviews, hashtags, and interaction data on food and beverages from the public API interfaces of multiple e-commerce platforms.
[0117] As a further illustration of this embodiment, the social media data collection module 120 in this embodiment is developed based on the Scrapy framework using a distributed crawler. A User-Agent pool is set up to simulate different browser environments, avoiding interception by the platform's anti-crawling mechanism. For example, when collecting data from the Douyin platform, the module extracts user comment content, likes, posting time, and associated product topic tags by parsing the JSON data returned by the / api / v1 / comment / list interface. Simultaneously, the collected text data undergoes preliminary cleaning, removing emojis, HTML tags, and duplicate content, and is stored in a MongoDB database using UTF-8 encoding.
[0118] The industry information data collection module 130 accesses industry report websites through scheduled tasks, parses HTML pages to obtain policy documents, new product release announcements and market analysis white papers;
[0119] As a further explanation of this embodiment, the industry information data acquisition module 130 in this embodiment uses Python's BeautifulSoup library to parse the page structure of industry websites (such as the official website of the China Food Industry Association), and uses XPath expressions to locate the title, release date, and body content of policy documents. For example, for new product release announcements, it extracts key information such as product name, launch date, and target consumer group. Simultaneously, for market research reports in PDF format, it uses the PyMuPDF library to extract text content and locates key data paragraphs through keyword matching (such as "sales volume" and "growth rate").
[0120] The meteorological information data acquisition module 140 is based on the OpenWeatherMap API interface and acquires real-time temperature, precipitation probability and humidity data in batches according to regional codes, with a time granularity of hourly.
[0121] As a further explanation of this embodiment, the meteorological information data acquisition module 140 divides the acquisition range according to provincial administrative regions, calls the / data / 2.5 / forecast interface of OpenWeatherMap, passes in latitude and longitude coordinates and API key, and obtains hourly meteorological data for the next 7 days. For example, when acquiring data from Guangzhou City, Guangdong Province, the returned fields include temperature (°C), precipitation probability (%), wind speed (m / s), etc. Simultaneously, the acquired meteorological data undergoes spatiotemporal alignment processing, and an index is established according to the region-time dimension to facilitate subsequent correlation analysis with sales data.
[0122] It should be added that, in order to address the issues of legality, stability, and privacy compliance in data acquisition, this embodiment optimizes the data collection process, as follows:
[0123] A rotating pool containing User-Agents for over 50 mainstream browsers is built using the Scrapy framework, with the identifier randomly switching every 3 requests. A dynamic request interval is set: initially 1.5 seconds, and if the platform's 429 rate limiting code is triggered, an exponential backoff strategy is adopted (the first retry interval is 2 seconds, and the interval for each subsequent retry is doubled based on the previous one). A third-party CAPTCHA recognition interface (such as GeeTest 3.0) is integrated, and a high-anonymity proxy IP is switched if timeout occurs (the proxy pool covers 100+ nodes).
[0124] For APIs such as OpenWeatherMap, a "retry + degradation" strategy is adopted: retry 3 times (with a 2-second interval), and if it fails, cached data within 4 hours is used; API keys are encrypted and stored through a cloud key management system and dynamically decrypted when called;
[0125] Social media comment text is anonymized using regular expressions and differential privacy processing: phone numbers are masked (e.g., 138****1234), and addresses are obscured (province / city retained); numerical values such as likes are added... The Laplace noise level is 0.6, which meets the requirements of GDPR and the Personal Information Protection Act.
[0126] The data processing unit 200 is used to preprocess and extract features from the multi-source data collected by the data acquisition unit 100. It removes duplicate and erroneous data through data cleaning algorithms, uses median filtering algorithm to remove noise, combines min-max normalization method and random forest algorithm to complete data normalization and missing value filling, and uses feature engineering technology to extract multi-dimensional predictive features.
[0127] Furthermore, in this embodiment, the data processing unit 200 receives JSON format data output by the data acquisition unit 100. This data integrates three business dimensions: the sales order dimension includes order ID (unique identifier), timestamp (time-series association), price (transaction amount), and sales volume (quantity indicator); the user evaluation dimension includes text content (original user feedback) and evaluation time (timestamp format, supporting cross-dimensional time association); and the meteorological data dimension includes area code (regional location), temperature (numerical), and humidity (numerical), with the time granularity uniformly set to the hour level (ensuring consistency in time dimension analysis).
[0128] Meanwhile, in this embodiment, the data processing unit 200 operates in a Python 3.8 or higher environment, relying on four core libraries: Pandas, Scikit-learn, Transformers, and NumPy, which work together: Pandas is responsible for data cleaning, JSON parsing, and tabular operations; Scikit-learn completes feature engineering; Transformers rely on the BERT model to parse user evaluation text; and NumPy accelerates numerical calculations, forming a functionally layered processing system.
[0129] Furthermore, for batch data processing scenarios (such as processing 1000 orders and associated user reviews or weather data in a single run), a multi-threaded parallel cleaning mechanism is adopted: first, the batch data is logically divided into sub-tasks (e.g., by data volume or time interval), and then the cleaning processes of the sub-tasks, such as format validation, field normalization, and cross-data type association validation, are executed simultaneously by multiple threads, making full use of CPU multi-core resources; finally, the results of each thread are aggregated to generate a unified cleaned dataset. This strategy shortens the processing time of a single batch of data for I / O-intensive or divisible cleaning processes, ensuring the real-time processing capability of large-scale data.
[0130] In this step, the data processing unit 200 includes a data cleaning module 210, a data denoising module 220, and a data standardization module 230, wherein:
[0131] The data cleaning module 210 generates unique identifiers for the collected sales order data using the MD5 hash algorithm, identifies and deletes duplicate records based on the order ID and timestamp, and uses the 3σ principle to detect price outliers, marking them as erroneous data when price fluctuations exceed the historical mean ± 3 times the standard deviation.
[0132] As a further explanation of this step, the data cleaning module 210 in this embodiment generates a unique identifier for each sales order using the MD5 hash algorithm. The specific process is as follows: The order data is hashed using the `md5.hexdigest()` method of the hashlib library. The generated hash value is stored in a Redis database. A scheduled task compares and deletes order records corresponding to duplicate hash values every morning. Price outlier detection uses the 3σ principle, with the price data of the past 30 days as the calculation period. When the current price fluctuation exceeds the historical mean ± 3 times the standard deviation, it is marked as erroneous data—where the historical mean... This is the arithmetic mean and standard deviation of prices over the past 30 days. The sample standard deviation of prices for this period is calculated using the following formula: ;in, For the first The price is exorbitant. To calculate the number of days in the cycle, and =30 days;
[0133] The data denoising module 220 is used to apply a median filtering algorithm with a window size of 5 to the sales time series data, calculate the median within the sliding window to replace outliers; and to use the TF-IDF algorithm to identify and remove spam comments whose keyword frequency exceeds the threshold for user review text.
[0134] As a further explanation of this step, the data denoising module 220 in this embodiment applies a median filtering algorithm with a window size of 5 to the sales time series. The core formula is: ;in, This represents the original sales value at time t; This indicates the th element after median filtering. Real-time sales value; represents; represents; represents; represents; represents;
[0135] The data standardization module 230 is used to process numerical features using a minimum-maximum normalization method, and the calculation formula is as follows: ;in, These are the original eigenvalues. and These are the minimum and maximum values of the feature in the training dataset, respectively; These are the normalized feature values; and one-hot encoding is used for the classification features.
[0136] As a further explanation of this step, the classification features (such as seasons) in this embodiment are processed using one-hot encoding, which is implemented by sklearn.preprocessing.OneHotEncoder. For example, the seasonal feature "summer" (value 2) is encoded as a 4-dimensional vector [0,1,0,0].
[0137] In this step, the data processing unit 200 further includes a feature engineering module 240, which uses feature engineering techniques to extract multi-dimensional predictive features, including the following steps:
[0138] S240.1, Time Dimension Feature Extraction: A time parsing algorithm is used to extract weekday ordinal features, holiday features, and seasonal classification features based on the sales timestamp; specifically including:
[0139] Weekday Ordinal Feature: Extract the weekday ordinal number corresponding to the date and map Monday to Sunday to values from 1 to 7 (e.g., Monday = 1, Sunday = 7).
[0140] Holiday characteristics: By comparing with the statutory holiday schedule issued by the State Council, a binary feature is generated to determine whether it is a holiday (yes = 1, no = 0).
[0141] Seasonal classification characteristics: Divided into four seasons according to months (March-May = Spring = 1, June-August = Summer = 2, September-November = Autumn = 3, December-February = Winter = 4).
[0142] S240.2, Text Sentiment Feature Extraction: Using natural language processing techniques, sentiment features are generated based on user review texts; specifically including:
[0143] Perform word segmentation on the text and remove stop words;
[0144] The BERT pre-trained model was used to calculate the sentiment polarity score, and the score was mapped to the [-1,1] interval (-1 is strong negative, 1 is strong positive).
[0145] Emotional levels are categorized into three levels: negative, neutral, and positive, based on preset thresholds.
[0146] It should be noted that the BERT pre-trained model used in this embodiment is the bert-base-chinese pre-trained model, which was fine-tuned on 80,000 food and beverage e-commerce reviews and 30,000 domain-specific social media posts (labeled "positive / negative / neutral"): batch size 64, learning rate 5×10⁻ 5 Train for 3 epochs; optimize the threshold using F1 scores on the validation set, setting "negative (probability > 0.7), positive (probability > 0.7), neutral (otherwise)", and label mixed sentiment as "-".
[0147] S240.3, Cross-correlation Feature Extraction: Using data association analysis methods, price elasticity features and weather impact features are generated based on multi-source data; specifically including:
[0148] Price elasticity characteristic: Based on the cyclical changes in price and sales volume, calculate the ratio of the rate of change in price to the rate of change in sales volume. The formula is:
[0149] ;
[0150] Weather Impact Characteristics: Through linear regression analysis, a functional relationship between historical temperature data and corresponding sales volume on specific dates is established, generating a temperature-sales elasticity coefficient; the formula is: ;in, The temperature-sales elasticity coefficient. For error terms, The input is the historical 7-day daily average temperature; This is the intercept term of the regression model;
[0151] It should be added that the cross-feature validation in this embodiment is based on a multiple linear regression model constructed from 18 months of hourly data:
[0152] ,in This represents the sales change rate.
[0153] Screened using 50% cross-validation The significant features are: a 30-day rolling window is used to monitor the stability of the coefficients; if the coefficient change of adjacent windows is >15%, the training data is re-divided.
[0154] S240.4 Feature Selection and Dimensionality Reduction: A random forest algorithm is used to select key features based on feature importance.
[0155] Calculate the importance scores of the time dimension features, text sentiment features, and cross-correlation features extracted from S240.1-S240.3;
[0156] Sort the features in descending order of their scores and sum them up. Retain the feature subset with a cumulative importance of 80%-90% and remove features with low contribution.
[0157] As a further explanation of this step, this embodiment uses the Random Forest algorithm to select key features based on feature importance. This method calculates the contribution of each feature to the model prediction based on the Gini impurity reduction principle. Specific steps include:
[0158] First, the importance scores of time-dimensional features, textual sentiment features, and cross-correlation features are calculated. This process is based on the Gini impurity reduction principle, and the core formula is:
[0159] ;
[0160] in, This represents the number of decision trees in the random forest (set to 100). For the first The number of samples processed by each decision tree This represents the total number of training samples; The Gini impurity of the node before splitting (by...) calculate, The number of categories of the target variable in a regression task ), The number of child nodes. and The first The number of samples and Gini impurity of each child node are calculated. This calculation quantifies the contribution of each feature to reducing sales prediction error by integrating the splitting gain of multiple decision trees.
[0161] Then, the calculated feature importance scores are sorted in descending order and summed. The formula for calculating cumulative importance is:
[0162] ;
[0163] in, For the sorted number The score of each feature, The number of features currently being filtered. The total number of characteristics;
[0164] Next, the selection process stops when the cumulative importance reaches 80%-90%, retaining the corresponding feature subset and removing features with low contribution. For example, if there are 20 features in total, and the cumulative importance of the top 12 features reaches 85%, then these 12 features (such as season, temperature, and sentiment level) are retained, while redundant features such as "order delivery method" are removed. This threshold range is based on practices in the food retail industry, balancing model complexity and prediction accuracy.
[0165] Finally, the feature subset obtained through the above screening can retain key information such as time series, text sentiment and cross-correlation, while reducing data dimensionality, providing efficient input for subsequent deep learning model training.
[0166] The model building unit 300 is used to build a deep learning prediction model. It adopts an improved LSTM-Transformer fusion algorithm and integrates temporal feature modeling and global dependency analysis techniques to achieve nonlinear mapping modeling of food and beverage sales trends.
[0167] In this step, the model building unit 300 uses an improved LSTM-Transformer fusion algorithm to model the nonlinear mapping of food and beverage sales trends, including the following steps:
[0168] S300.1, Bidirectional Encoding of Temporal Features:
[0169] The temporal features extracted in step S240.1 (such as the time series of weekday ordinal features and seasonal classification features) are encoded using a bidirectional long short-term memory (Bi-LSTM) network, specifically including:
[0170] Input processing: Arrange the time features by time step. ;in, This is a holistic representation of time-series feature data. For batch size, The historical time step (e.g., 14 days). For time-related features (e.g., 128 dimensions). It is the set of real numbers;
[0171] Network configuration: The number of hidden units in the unidirectional LSTM is set to 256, and the feature dimension after concatenation of bidirectional outputs is 512. The calculation formula is as follows:
[0172] ;
[0173] ;
[0174] ;
[0175] in, express Always in a forward-facing, hidden state; This indicates that the forward LSTM computes the function; express Temporal input characteristics at any given time; express The hidden state of the forward LSTM at each time step; express The hidden state of the LSTM after time step; This indicates the function computed by the backward LSTM; express The hidden state of the LSTM after time step; This represents the temporal coding features of the final output of the bidirectional LSTM; Indicates a splicing operation; This describes the feature dimensions.
[0176] As a further explanation of this step, this embodiment adds a bidirectional structure to the classic LSTM to capture bidirectional timing dependencies. The specific improvements are as follows:
[0177] The original LSTM only includes forward computation. This embodiment adds a backward LSTM, and the formula is as follows:
[0178] ;
[0179] ;
[0180] The feature dimension is doubled (256-512) after bidirectional output concatenation, which is used to enhance the expressive power of temporal features;
[0181] in, , Set the batch size (to 64). The historical time step is 14 days. The time feature dimension (128 dimensions, including weekday ordinal number, seasonality, etc.); Forward hidden state With backward hidden state Each dimension has 256 dimensions, which, when concatenated, result in 512 dimensions. The final output dimension is... ;
[0182] S300.2, Global Feature Multi-Head Attention Modeling:
[0183] Cross-feature association analysis is performed on the global features (such as sentiment level and price elasticity) extracted in steps S240.2-S240.3, specifically including:
[0184] Dimensional alignment: Global features are mapped to 512 dimensions through a linear transformation, forming... ;in, The number of global features (e.g., 10); Input as global features;
[0185] Multi-head Query, Key, Value Generation: Perform multi-head projection to generate query vector, key vector, and value vector;
[0186] No. The projection formula for each of the 8 heads is:
[0187] ;
[0188] ;
[0189] ;
[0190] in, Indicates the first The query vector of the head; Indicates the first The Query projection matrix of the head; Indicates the first The key vector of each head; Indicates the first Key projection matrix of the head; Indicates the first A vector of values for each head; Indicates the first Value projection matrix of each head;
[0191] Self-attention weight calculation and feature aggregation: Calculating the first... The self-attention weights of each size are aggregated into a value vector;
[0192] ;
[0193] ;
[0194] in, Indicates the first Among them, the first The first feature and the second The association weights of each feature; Represents the normalization function; Indicates the first In the query vector of the first head, the first Feature vectors of each sample; Indicates the first In the Key vector of the first head, the first... Transpose of the feature vectors of each sample; This represents the scaling factor. 64 is the dimension of a single attention head (corresponding to the dimension of the preorder projection matrix). Scaling avoids excessively large inner product values that could cause the Softmax gradient to vanish, resulting in a more reasonable weight distribution. Indicates the first The features after aggregation of heads; representing the first... Attention weight matrix for size; Indicates the first The value vector of each head;
[0195] Multi-head result concatenation and layer normalization: The attention results from 8 heads are concatenated and then subjected to linear transformation and layer normalization to output globally correlated features. ,
[0196] ;
[0197] in, Presentation layer normalization operation; This represents the output of concatenating eight attention heads, used to fuse multi-dimensional related information; This represents the output projection matrix, used to map the concatenated features to a specified dimension.
[0198] As a further explanation of this step, the following adjustments are made to this embodiment for the food and beverage sales scenario:
[0199] The original model typically has 8-16 attention heads; this embodiment uses 8 heads to accommodate 10 global features. );
[0200] The individual attention head dimension is set to 64 (originally 64 or 128), with a total dimension of 512 (8×64), aligned with the LSTM output dimension;
[0201] And regarding the first The projection formula for 8 heads in total is: This embodiment specifies the dimensions of the projection matrix: ,make sure .
[0202] S300.3, Two-Dimensional Feature Fusion and Prediction:
[0203] The temporally encoded features are fused with globally correlated features and mapped to the prediction space.
[0204] Feature fusion: Generate 1024-dimensional fused features by concatenating channels. After aligning the time steps, the dimension is ;in, This represents the final generated fusion feature; A function representing a concatenation operation; This represents the temporal features obtained through bidirectional LSTM encoding; This represents the global association features obtained through Transformer encoding; Indicates batch size; Indicates the time step; Indicates the number of global features; Indicates taking and The larger value in the value is used to align time steps; This represents the channel dimension of the fused features, because and Each has 512 dimensions, and when combined, they form... dimension;
[0205] Predicted output: Mapped to a sales trend prediction dimension (e.g., sales volume for the next 7 days) via a fully connected layer. The calculation formula is as follows:
[0206] ;
[0207] in, This represents the predicted value output by the model; Indicates a fully connected layer; Indicates fusion characteristics; This represents the weight matrix of the fully connected layer; This represents the bias term of the fully connected layer; This indicates the dimensional form of the predicted value. It refers to the batch size. It is the prediction step size; this design collaboratively models temporal features (such as historical sales cycles) and global features (such as weather-sales correlation) to improve prediction capabilities in complex scenarios.
[0208] S300.4, Model Training and Optimization:
[0209] To improve prediction accuracy, an adaptive training strategy is adopted, which includes:
[0210] Define an impairment function, using mean squared error to measure the difference between predicted and true values. Quantify the model's prediction error by calculating the mean squared difference between predicted and true values. The formula is:
[0211] ;
[0212] in, For batch size, To predict the step size, It is the first The first sample The predicted value of the step, For the corresponding true value;
[0213] Optimized configuration: The Adam algorithm was selected to optimize model parameters, with an initial learning rate of 0.001. To balance the convergence speed in the early stages of model training with its stability in later stages, the learning rate was increased by [percentage missing] every 10 training epochs. It undergoes exponential decay, where The initial learning rate allows the model to quickly approximate a better solution in the early stages, and the parameters are finely adjusted in the later stages.
[0214] The batch size is set to 64, meaning 64 samples are input simultaneously to update the model during each training iteration; the maximum number of iterations is 100 to control training duration. When dividing the dataset, 30% is used as a validation set to monitor the model training process. If the MSE (Mean Sequence Equation) of the validation set increases for three consecutive iterations, it indicates potential overfitting, triggering an early stopping mechanism to terminate training, avoiding ineffective iterations and improving training efficiency. This strategy, by dynamically adjusting the learning rate and preventing overfitting, ensures stable convergence of the model under the non-stationary characteristics of food and beverage sales data.
[0215] As a further explanation of this step, the calculation of the loss function in this embodiment depends on the strict alignment between the model's predicted output and the true label, specifically including:
[0216] Predicted value : Generated by forward propagation of the model, with dimension . (like =64 samples =7-day forecast step), corresponding to "future sales forecast for each sample within the batch" (e.g., sales of 64 stores in the next 7 days).
[0217] True value : Obtained through annotation of historical sales data, constructed using the sliding window method—with a length of Historical features (such as 14-day sales data) are used as input samples, and then... The actual sales volume for the day is used as a label (e.g., for the next 7 days), ensuring consistency with the model output dimension. Exact match.
[0218] As a further explanation of this step, the batch size in this embodiment... (Set to 64) to balance computational efficiency and gradient stability:
[0219] If B is too small (e.g., 16), the gradient fluctuation will be large and the training time will increase.
[0220] If B is too large (e.g., 256), excessive memory usage and decreased gradient representativeness will occur. A value of 64 is suitable for the sample size of "multi-region, multi-SKU" in food and beverage sales forecasting (daily sales data for a single brand can reach tens of thousands of records, and a batch size of 64 can cover typical combination training).
[0221] Meanwhile, the prediction step size in this embodiment (Set to 7 days) Directly corresponds to business characteristics:
[0222] Sales volume fluctuates cyclically during the week (such as weekend peaks), and promotional activities and supply chain replenishment are usually planned on a weekly basis. 7-day forecasts can support actual business decisions.
[0223] Furthermore, the single iteration (Epoch) of model training in this embodiment includes the following process:
[0224] Forward propagation: This involves taking batch inputs (such as a 14-day historical feature matrix, dimensions...) The data is fed into the model to generate predicted values. );
[0225] Tag extraction: Extract the "actual sales volume for the next 7 days" corresponding to the batch input from the training dataset to form tags. ;
[0226] Loss calculation: Substitute into the mean square error formula:
[0227] ;
[0228] in the formula Normalizing "number of samples × time step" decouples the loss value from batch size and prediction step size, ensuring that the loss is comparable across different training stages.
[0229] Parameter updates: The optimizer (such as Adam) adjusts the model parameters, including the learning rate, based on the gradient. When =0.001, the parameter is set according to... renew( For model parameters, (This is the loss gradient).
[0230] It should be added that, to ensure the accuracy of the loss function calculation and the stability of the model training process, this embodiment requires the following constraints to avoid the risks of data anomalies and gradient runaway:
[0231] Dimensional consistency check: passed before training Logical judgments are used to force the consistency between the model output dimension and the label dimension, avoiding calculation anomalies caused by data preprocessing errors (such as predicting 7 days but passing in 14-day labels);
[0232] Gradient stability guarantee: mean-based processing of the loss function (dividing by) This naturally avoids the risk of gradient explosion when the number of samples or time steps is too large, making the training process more stable (e.g., =64, When the gradient is 7, the gradient size is only related to the error of a single prediction point.
[0233] The model training and validation unit 400 is used to train and validate a deep learning model. It trains the deep learning model based on a historical dataset, adjusts the model parameters through the Adam optimization algorithm, and sets hyperparameters such as learning rate, number of iterations, and batch size for model optimization. It uses a validation dataset independent of the training data to calculate the accuracy, mean squared error, and mean absolute error to evaluate the model's prediction performance.
[0234] In this step, the model training and verification unit 400 includes a training parameter configuration module 410, a parameter iteration adjustment module 420, and a training process monitoring module 430, wherein:
[0235] The training parameter configuration module 410 is used to set the hyperparameters of the Adam optimization algorithm, wherein the initial learning rate is selected from the range of 0.0001 to 0.001, the number of iterations is set to 50 to 200, and the batch size is selected from 32 to 128.
[0236] As a further explanation of this step, the core formula of the Adam optimization algorithm in this embodiment is:
[0237] , is the first-order momentum decay coefficient;
[0238] , ,for ;
[0239] It is used for deviation correction and to eliminate the influence of initial values;
[0240] ;in, For learning rate, ;
[0241] This embodiment uses the default parameters of the algorithm ( , , (Unmodified), only the following hyperparameters are subject to range constraints:
[0242] Initial learning rate : Adapt the feature scale of food and beverage sales data (such as 128-dimensional time features + 512-dimensional fusion features) to avoid gradient oscillation caused by an excessively large learning rate and convergence stagnation caused by an excessively small learning rate;
[0243] Number of iterations It covers the entire cycle of the model, from rapid convergence to fine-tuning, balancing training efficiency and accuracy;
[0244] Batch size 32 is the minimum batch size for "memory friendly" (ensuring gradient stability), and 128 is the maximum batch size for regular use (avoiding memory overflow), which is suitable for sample sizes of "multiple regions and multiple SKUs" (a single batch can cover training combinations of 64 stores × 2 types of SKUs).
[0245] Furthermore, to ensure training stability, this embodiment refines the hyperparameter and validation design:
[0246] Hyperparameter selection: The initial learning rate [0.0001, 0.001] is determined by grid search; the learning rate decays to 1 / 10 of the current value every 10 epochs (balancing efficiency and convergence); the batch size is set to 64 and the iterations are 100, optimized based on 8G GPU memory and 120 million model parameters.
[0247] Validation set construction: Stratified sampling was used (10 months of training, 2 months of validation). Distribution consistency was verified using the Kolmogorov-Smirnov test: the maximum absolute difference between the empirical distributions of the core features was <0.1 (satisfying the requirement). If the statistical critical value is 0.05, then the distribution is determined to be aligned.
[0248] The parameter iteration adjustment module 420 updates the model parameters round by round based on the historical dataset and through the Adam optimization algorithm, covering core parameters such as the weights of the fully connected layer, the bias term and the state of the LSTM hidden layer, and uses the gradient descent mechanism to achieve parameter optimization.
[0249] The training process monitoring module 430 is used to calculate the mean square error and loss function value of the training set in real time during training iterations, and to plot the loss curve; when the loss decreases by less than 0.001 to 0.01 for 3 to 5 consecutive rounds, the learning rate decay is triggered, and the decay coefficient is 0.1 times the initial learning rate.
[0250] As a further explanation of this step, in this embodiment, the training process monitoring module 430 achieves dynamic control of the training process through loss calculation and learning rate decay: training set mean square error reuse formula The loss is calculated in real time, and a curve is plotted with the iteration number on the horizontal axis and the loss value on the vertical axis to help determine the model's convergence status; when the loss decreases for 3-5 consecutive iterations... ( When the learning rate is adjusted according to the convergence speed, it is judged as "loss stagnation" and triggers a step-wise learning rate decay. ), to adapt to fine-tuning needs (such as the learning rate decaying from 0.001 to 0.0001).
[0251] In this step, the model training and validation unit 400 further includes a validation set partitioning module 440, a performance evaluation calculation module 450, and a model performance determination module 460, wherein:
[0252] The validation set partitioning module 440 splits the historical dataset into an independent validation dataset at a ratio of 20% to 30%, ensuring that the validation set and the training set are consistent in terms of data distribution characteristics such as seasonal sales trends and the frequency of promotional activities.
[0253] As a further explanation of this step, in this embodiment, the validation set partitioning module 440 adopts a time-stratified sampling strategy to divide the historical dataset into a training set (first 80% of the time window) and a validation set (last 20% of the time window) according to the time series. This ensures that the two sets are consistent in terms of seasonal sales trends, promotional activity frequency, and other time series characteristics, avoiding evaluation distortion caused by "future data information leakage". At the same time, the KS test verifies that there is no significant difference in sales distribution, promotion frequency, and seasonal proportion between the training set and the validation set, ensuring that the validation results are representative of the model's generalization ability.
[0254] The performance evaluation calculation module 450 uses the validation dataset to calculate the model prediction performance, including accuracy (suitable for sales range classification scenarios), mean squared error, and mean absolute error. The model accuracy is quantified by the difference between the predicted value and the true value.
[0255] As a further explanation of this step, in this embodiment, the performance evaluation calculation module 450 selects appropriate indicators for different prediction scenarios, specifically including:
[0256] In continuous sales forecasting scenarios, the mean squared error is quantified using the mean squared error, and the formula is:
[0257] ,in The number of samples in the validation set;
[0258] Furthermore, the mean absolute error is incorporated to compensate for the sensitivity of MSE to outliers. The formula is as follows:
[0259] ;
[0260] In the sales range classification scenario, an accuracy metric is introduced, with the formula as follows:
[0261] It is used to measure the model's accuracy in judging "low / medium / high sales range" and to achieve multi-dimensional quantification of predictive performance.
[0262] The model performance evaluation module 460 calculates the mean squared error, mean absolute error, and accuracy (accuracy evaluation is required if applicable) based on the prediction results of the validation set. When using mean squared error, mean absolute error, and accuracy for evaluation, if the mean squared error is less than 0.05-0.2, the mean absolute error is less than 0.03-0.15, and the accuracy (if applicable) is greater than 70%-90%, the model prediction performance is deemed to meet the standard; otherwise, the model parameter readjustment or structural optimization process is triggered.
[0263] As a further explanation of this step, this embodiment targets the continuous sales forecasting scenario. Referring to the magnitude characteristics of daily sales (500–5000 cups) per store for food and beverages, a mean squared error (MSE) threshold of [0.05, 0.2] is set (corresponding to a prediction error within 4.5% of the true value, such as...). The error is approximately 450 units when the true mean is 1000. The mean absolute error (MAE) thresholds are set at [0.03, 0.15] to supplement the MSE's tolerance for outliers. For sales range classification scenarios, accuracy thresholds are set at [70%, 90%] based on the business's requirements for the accuracy of "range judgment" (70% is the minimum standard better than random guessing, and 90% represents high-quality model performance). If the validation set metrics meet the thresholds, the model is saved and deployed. If not, parameter readjustment (such as adjusting the learning rate or number of iterations) or model structure optimization (such as modifying the number of LSTM layers or Transformer heads) is triggered, and the training process is restarted to achieve performance iteration and upgrades.
[0264] The prediction output unit 500 is used to output the prediction results of online sales trends of food and beverages. It receives real-time data processed by the data processing unit 200, inputs it into the trained deep learning model for prediction, and displays the prediction results in the form of multi-dimensional charts using Echarts visualization technology.
[0265] In this step, the prediction output unit 500 includes a real-time data adaptation module 510, a model inference execution module 520, and an Echarts visualization rendering module 530, wherein:
[0266] The real-time data adaptation module 510 is used to receive real-time data from the data processing unit 200 and automatically verify the consistency of data dimensions (such as sales volume, price, promotional labels) with time (day / week / month).
[0267] As a further explanation of this step, after receiving the real-time data stream from the data processing unit 200, the real-time data adaptation module 510 in this embodiment performs a three-level process of dimension verification, time alignment, and preprocessing reuse:
[0268] Dimension verification: Verify the time step of real-time data through logical judgment. Such as the 14-day historical window during model training) and feature dimensions ( (e.g., 128-dimensional fusion features) to ensure consistency with the input dimensions during the model training phase;
[0269] Time alignment: Parse data timestamps and verify that the time granularity (day / week / month) matches the time features during model training to avoid prediction bias caused by differences in time scale;
[0270] Preprocessing reuse: The feature engineering process of data processing unit 200 is invoked to perform standardization and encoding on real-time data consistent with the training set.
[0271] Numerical feature standardization: reusing the mean of the training set and standard deviation Its conversion is achieved through the formula To ensure consistent feature distribution; among which, These are the standardized numerical features; These are the original numerical features;
[0272] Category feature encoding: Reuse the encoding mapping of the training set (such as promotional identifier "yes-1, no-0") to ensure the consistency of feature semantics.
[0273] The model inference execution module 520 is used to input the verified data into the trained deep learning prediction model and output the sales trend prediction (including sales volume and category ratio) for the next 1-30 days.
[0274] As a further explanation of this step, the model inference execution module 520 in this embodiment realizes the mapping from real-time data to sales trend prediction through the following process:
[0275] First, the real-time data is reshaped into a single-sample time-series tensor (with dimensions of 1) adapted to the model training phase. ),in For historical time steps, such as 14 days, For example, with feature dimensions such as 128 dimensions, ensure the consistency of time dependencies;
[0276] Then, the trained deep learning model is invoked, with an output dimension of... The prediction tensor ( To predict step sizes such as 1–30 days, (This represents the number of food and beverage categories; the "+1" dimension corresponds to the total global sales volume).
[0277] Finally, the output tensor is analyzed, and the global total sales forecast in the last dimension is directly extracted and expressed using the formula. Calculate the proportion of each category and complete the multi-dimensional prediction output of "total sales + category structure".
[0278] The Echarts visualization rendering module 530 generates visualization charts using Echarts, including at least a line chart comparing historical and predicted sales and a pie chart showing the sales percentage of product categories, to intuitively display the prediction results.
[0279] In this step, the Echarts visualization rendering module 530 includes a basic chart generation submodule 531, an anomaly alert submodule 532, and an interactive response submodule 533, wherein:
[0280] The basic chart generation submodule 531 generates a line chart comparing historical and predicted sales and a pie chart showing the sales percentage of product categories using Echarts.
[0281] As a further explanation of this step, for the line chart comparing historical and predicted sales, firstly, connect the predicted data output by the model (such as sales in the next 1–30 days) with the historical real data (such as sales in the past 14 days) along the time axis to construct a continuous time series (ensuring a seamless connection between the last day of the historical data and the first day of the prediction); through Echarts configuration, render the historical data with solid lines (such as gray) and distinguish the predicted data with dashed lines (such as blue) to achieve a visual comparison of sales trends;
[0282] Furthermore, for the pie chart showing the sales share of each product category, based on the predicted sales volume for each category output by the model, the formula is: Calculate the category percentage, among which For the first Forecasted sales volume for each product category This represents the total number of food and beverage categories. A pie chart layout is used to avoid crowding in the center. The label format is set to "Category Name: Percentage %". The predicted sales volume and percentage details of each category are displayed in a tooltip box through mouse hover interaction.
[0283] Furthermore, the basic chart generation submodule 531 in this embodiment also supports time range synchronization: when the line chart adjusts the time range interactively, the pie chart automatically updates the category ratio of the corresponding time period to ensure data consistency; through adaptive rendering strategies (such as screen size adaptation) and large dataset sampling optimization (such as enabling mean sampling), the visualization performance under different data scales and display terminals is guaranteed.
[0284] In addition, for real-time data verification, this embodiment sets up the following fault-tolerant process:
[0285] When a missing dimension is detected (such as null values in meteorological data) or a timestamp is out of order:
[0286] For consecutive missing ≤3 time points, linear interpolation (fitting 4 valid points before and after) is used; for missing >3 points, the historical average of the same day and time period over the past 3 years is used.
[0287] If the verification failure rate is greater than 15%, the system will push an email alert containing failed samples and error codes, automatically pause inference and switch to the "historical model" (last week's snapshot) output until the data source is restored.
[0288] The anomaly warning submodule 532 is based on a preset fluctuation threshold (such as sales increase ≥ 50% or sales decrease ≤ 30%), and uses red markers to mark predicted anomaly points in the line graph.
[0289] As a further explanation of this step, the abnormal alert in this embodiment is based on a dynamically set threshold according to historical fluctuation statistics: First, the daily month-on-month increase in the training set is calculated:
[0290]
[0291] , For the day's sales, The standard deviation of the growth rate is calculated based on the previous day's sales. Then, the abnormal threshold was set as follows: (The threshold is adjusted according to business characteristics); For prediction points that meet the threshold, they are highlighted by flashing red markers and a prompt box is configured to display the abnormal amplitude (such as "sales growth +52%)" to help quickly identify abnormal fluctuations.
[0292] The interactive response submodule 533 is used to respond to category click operations and separately display the historical and predicted trend subgraphs of the selected category (such as beverages).
[0293] As a further explanation of this step, the interactive response submodule 533 in this embodiment relies on visual interactive events to achieve data linkage: it listens for category click events on the pie chart and obtains the identifier of the selected category (such as "beverage"); it extracts the prediction sequence of the corresponding category (such as the first) from the model output tensor. By combining dimensional data with historical data and reusing line chart configuration logic, a "single category historical - predicted trend sub-chart" can be dynamically generated, enabling seamless switching between "global view - category details" and improving data exploration efficiency. Example 2
[0294] like Figure 2 As shown, this embodiment also provides a method for constructing a food and beverage online sales trend prediction model based on multi-source data fusion and deep learning. The system for constructing the food and beverage online sales trend prediction model based on multi-source data fusion and deep learning, as described above, includes the following steps:
[0295] S100: Collects multi-source data related to online sales of food and beverages, and obtains data from online sales platforms, social media, industry information websites and meteorological information databases based on web crawling technology and API interface calls.
[0296] S200 preprocesses and extracts features from the multi-source data collected by S100. Through data cleaning, denoising, and normalization, feature engineering techniques are used to extract multi-dimensional predictive features (such as time dimension, text sentiment, and cross-correlation).
[0297] S300: Construct a deep learning prediction model and adopt an improved LSTM-Transformer fusion algorithm. It uses bidirectional LSTM to encode temporal features and Transformer to model global features, and fuses the two-dimensional features and maps them to the sales trend prediction space.
[0298] S400: Train a deep learning prediction model based on historical datasets, using the Adam optimization algorithm, learning rate, batch size and number of training rounds as hyperparameters, and use the validation set to evaluate accuracy, mean squared error and mean absolute error, and iteratively optimize the parameters of the deep learning prediction model.
[0299] The S500 inputs the processed data into the trained deep learning prediction model to generate future sales trend prediction results, which are then displayed in multi-dimensional charts using visualization technology.
[0300] Those skilled in the art will understand that the process of implementing all or part of the steps of the above embodiments can be carried out by hardware or by a program instructing the relevant hardware.
[0301] The foregoing has shown and described the basic principles, main features, and advantages of the present invention. Those skilled in the art should understand that the present invention is not limited to the above embodiments. The embodiments and descriptions in the specification are merely preferred examples and are not intended to limit the invention. Various changes and modifications can be made to the invention without departing from its spirit and scope, and all such changes and modifications fall within the scope of the present invention as claimed. The scope of protection of the present invention is defined by the appended claims and their equivalents.
Claims
1. A system for constructing a food and beverage online sales trend prediction model based on multi-source data fusion and deep learning, characterized in that, include: A data acquisition unit (100) is used to collect multi-source data related to online sales of food and beverages. Based on web crawler technology and API interface calling technology, it acquires data from online sales platforms, social media platforms, industry information websites, and meteorological information databases. The data acquisition unit (100) includes an online sales platform data acquisition module (110), a social media data acquisition module (120), an industry information data acquisition module (130), and a meteorological information data acquisition module (140), wherein: The online sales platform data acquisition module (110) obtains sales order information, user purchase behavior data and product price change logs from the e-commerce platform database through the RESTful API interface; The social media data collection module (120) uses the Scrapy framework to build a web crawler to collect user reviews of food and beverages, topic tags, and interaction data from the public API interfaces of multiple e-commerce platforms. The industry information data acquisition module (130) accesses industry report websites through scheduled tasks, parses HTML pages to obtain policy documents, new product release announcements and market analysis white papers; The meteorological information data acquisition module (140) is based on the OpenWeatherMap API interface and acquires real-time temperature, precipitation probability and humidity data in batches according to regional codes; The data processing unit (200) is used to preprocess and extract features from the multi-source data collected by the data acquisition unit (100), remove duplicate and erroneous data through data cleaning algorithm, denoise the data by median filtering algorithm, and complete data normalization and missing value filling by combining the minimum-maximum normalization method and random forest algorithm. It also uses feature engineering technology to extract multi-dimensional predictive features, which include at least time dimension features based on sales timestamps, text sentiment features based on user review texts, price elasticity features based on multi-source data association analysis, and weather impact features. A model building unit (300) is used to build a deep learning prediction model. It employs an improved LSTM-Transformer fusion algorithm, integrating temporal feature modeling and global dependency analysis techniques to achieve nonlinear mapping modeling of food and beverage sales trends. The model building unit (300) uses the improved LSTM-Transformer fusion algorithm to achieve nonlinear mapping modeling of food and beverage sales trends, including the following steps: S300.1, Bidirectional Encoding of Temporal Features: A bidirectional long short-term memory network is used to encode the time-dimensional features extracted by the data processing unit (200), specifically including: Input processing: Arrange the time features by time step. ;in, This is a holistic representation of time-series feature data. For batch size, For historical time steps, As a time feature dimension, It is the set of real numbers; Network configuration: The number of hidden units in the unidirectional LSTM is set to 256, and the feature dimension after concatenation of bidirectional outputs is 512. The calculation formula is as follows: ; ; ; in, express Always in a forward-facing, hidden state; This indicates that the forward LSTM computes the function; express Temporal input characteristics at any given time; express The hidden state of the forward LSTM at each time step; express The hidden state of the LSTM after time step; This indicates the function computed by the backward LSTM; express The hidden state of the LSTM after time step; This represents the temporal coding features of the final output of the bidirectional LSTM; Indicates a splicing operation; This describes the feature dimensions. S300.2, Global Feature Multi-Head Attention Modeling: Cross-feature association analysis is performed on the global features composed of text sentiment features, price elasticity features, and weather impact features extracted by the data processing unit (200), specifically including: Dimensional alignment: Global features are mapped to 512 dimensions through a linear transformation, forming... ;in, This represents the number of global features. Input as global features; Multi-head Query, Key, Value Generation: Perform multi-head projection to generate query vector, key vector, and value vector; No. The projection formula for the size is: ; ; ; in, Indicates the first The query vector of the head; Indicates the first The Query projection matrix of the head; Indicates the first The key vector of each head; Indicates the first Key projection matrix of the head; Indicates the first A vector of values for each head; Indicates the first Value projection matrix of each head; Self-attention weight calculation and feature aggregation: Calculating the first... The self-attention weights of each size are aggregated into a value vector; ; ; in, Indicates the first Among them, the first The first feature and the second The association weights of each feature; Represents the normalization function; Indicates the first In the query vector of the first head, the first Feature vectors of each sample; Indicates the first In the Key vector of the first head, the first... Transpose of the feature vectors of each sample; Indicates the scaling factor; Indicates the first Features after aggregation of individual units; Indicates the first Attention weight matrix for size; Indicates the first The value vector of each head; Multi-head result concatenation and layer normalization: The attention results from 8 heads are concatenated and then subjected to linear transformation and layer normalization to output globally correlated features. : ; in, Presentation layer normalization operation; This represents the output of concatenating eight attention heads, used to fuse multi-dimensional related information; This represents the output projection matrix, used to map the concatenated features to a specified dimension. S300.3, Two-Dimensional Feature Fusion and Prediction: The temporally encoded features are fused with globally correlated features and mapped to the prediction space. Feature fusion: Generate 1024-dimensional fused features by concatenating channels. After aligning the time steps, the dimension is ;in, This represents the final generated fusion feature; A function representing a concatenation operation; This represents the temporal features obtained through bidirectional LSTM encoding; This represents the global association features obtained through Transformer encoding; Indicates batch size; Indicates the time step; Indicates the number of global features; Indicates taking and The larger value in the value is used to align time steps; The channel dimension represents the fused features; Predicted output: Mapped to the sales trend prediction dimension via a fully connected layer, the calculation formula is as follows: ; in, This represents the predicted value output by the deep learning prediction model. Indicates a fully connected layer; Indicates fusion characteristics; This represents the weight matrix of the fully connected layer; This represents the bias term of the fully connected layer; This indicates the dimensional form of the predicted value. It refers to the batch size. It predicts the step size; The model training and validation unit (400) is used to train and validate the deep learning prediction model. The deep learning prediction model is trained based on the historical dataset. The model parameters are adjusted by the Adam optimization algorithm, and the learning rate, number of iterations, and batch size hyperparameters are set to optimize the deep learning prediction model. The accuracy, mean square error, and mean absolute error of the deep learning prediction model are calculated using a validation dataset independent of the training data to evaluate the prediction performance of the deep learning prediction model. The prediction output unit (500) is used to output the prediction results of online sales trends of food and beverages, receive real-time data processed by the data processing unit (200), input the trained deep learning prediction model for prediction, and display the prediction results in the form of multi-dimensional charts through Echarts visualization technology.
2. The system for constructing a food and beverage online sales trend prediction model based on multi-source data fusion and deep learning according to claim 1, characterized in that, The data processing unit (200) includes a data cleaning module (210), a data denoising module (220), and a data standardization module (230), wherein: The data cleaning module (210) generates a unique identifier for the collected sales order data using the MD5 hash algorithm, identifies and deletes duplicate records based on the order ID and timestamp, and uses the 3σ principle to detect price outliers, marking them as erroneous data when the price fluctuation exceeds the historical mean ± 3 times the standard deviation. The data denoising module (220) is used to apply a median filtering algorithm with a window size of 5 to the sales time series data, calculate the median within the sliding window to replace outliers; and to use the TF-IDF algorithm to identify and remove spam comments whose keyword frequency exceeds the threshold for user review text. The data standardization module (230) is used to process numerical features using the minimum-maximum normalization method, and the calculation formula is as follows: ;in, These are the original eigenvalues. and These are the minimum and maximum values of the feature in the training dataset, respectively; These are the normalized feature values; and one-hot encoding is used for the classification features.
3. The system for constructing a food and beverage online sales trend prediction model based on multi-source data fusion and deep learning according to claim 2, characterized in that, The data processing unit (200) further includes a feature engineering module (240), which uses feature engineering techniques to extract multi-dimensional predictive features, including the following steps: S240.1, Time Dimension Feature Extraction: Using a time parsing algorithm, extract weekday ordinal features, holiday features, and seasonal classification features based on the sales timestamp; S240.2, Text sentiment feature extraction: Using natural language processing technology, sentiment features are generated based on user review text; S240.3 Cross-correlation feature extraction: Using data association analysis methods, price elasticity features and weather impact features are generated based on multi-source data; S240.4 Feature Selection and Dimensionality Reduction: A random forest algorithm is used to select key features based on feature importance. Calculate the importance scores of the time dimension features, text sentiment features, and cross-correlation features extracted from S240.1-S240.3; Sort the features in descending order of their scores and sum them up. Retain the feature subset with a cumulative importance of 80%-90% and remove features with low contribution.
4. The system for constructing a food and beverage online sales trend prediction model based on multi-source data fusion and deep learning according to claim 3, characterized in that, The model building unit (300) uses an improved LSTM-Transformer fusion algorithm to model the nonlinear mapping of food and beverage sales trends, and also includes the following steps: S300.4, Model Training and Optimization: To improve prediction accuracy, an adaptive training strategy is adopted, which includes: Define an impairment function, using mean squared error to measure the difference between predicted and true values, and calculate the mean squared difference between predicted and true values. The formula for quantifying the prediction error of a deep learning prediction model is: ; in, For batch size, To predict the step size, It is the first The first sample The predicted value of the step, For the corresponding true value; Optimized configuration: The Adam algorithm was selected to optimize the parameters of the deep learning prediction model, with an initial learning rate of 0.
001. To balance the convergence speed in the early stages of training with the stability in the later stages, the learning rate was adjusted every 10 training epochs. It undergoes exponential decay, where The initial learning rate; The batch size is set to 64, meaning that 64 samples are input simultaneously to update the model during each training iteration; the maximum number of iterations is 100, used to control the training duration; when dividing the dataset, 30% of the data is used as a validation set to monitor the deep learning prediction model training process; when the MSE of the validation set increases for 3 consecutive iterations, the early stop mechanism is triggered to terminate the training.
5. The system for constructing a food and beverage online sales trend prediction model based on multi-source data fusion and deep learning according to claim 1, characterized in that, The model training and verification unit (400) includes a training parameter configuration module (410), a parameter iteration adjustment module (420), and a training process monitoring module (430), wherein: The training parameter configuration module (410) is used to set the hyperparameters of the Adam optimization algorithm, wherein the initial learning rate is selected from the range of 0.0001 to 0.001, the number of iterations is set to 50 to 200, and the batch size is selected from 32 to 128. The parameter iteration adjustment module (420) updates the parameters of the deep learning prediction model round by round using the Adam optimization algorithm based on the historical dataset, and uses the gradient descent mechanism to achieve parameter optimization. The training process monitoring module (430) is used to calculate the mean square error and loss function value of the training set in real time during the training iteration, and to draw the loss curve; when the loss decreases by less than 0.005 for 3 to 5 consecutive rounds, the learning rate decay is triggered, and the decay coefficient is 0.1 times the initial learning rate.
6. The system for constructing a food and beverage online sales trend prediction model based on multi-source data fusion and deep learning according to claim 5, characterized in that, The model training and validation unit (400) further includes a validation set partitioning module (440), a performance evaluation calculation module (450), and a model performance determination module (460), wherein: The validation set partitioning module (440) splits the historical dataset into independent validation datasets at a ratio of 20% to 30%, ensuring that the validation set and the training set are consistent in terms of data distribution characteristics; The performance evaluation calculation module (450) uses the validation dataset to calculate the prediction performance of the deep learning prediction model, including accuracy, mean squared error, and mean absolute error. The accuracy of the deep learning prediction model is quantified by the difference between the predicted value and the true value. The model performance determination module (460) calculates the mean squared error, mean absolute error and accuracy based on the prediction results of the validation set. When using the mean squared error, mean absolute error and accuracy for determination, if the mean squared error is less than 0.1, the mean absolute error is less than 0.07 and the accuracy is greater than 82%, the model prediction performance is determined to be up to standard; otherwise, the deep learning prediction model parameter readjustment or structural optimization process is triggered.
7. The system for constructing a food and beverage online sales trend prediction model based on multi-source data fusion and deep learning according to claim 1, characterized in that, The prediction output unit (500) includes a real-time data adaptation module (510), a model inference execution module (520), and an Echarts visualization rendering module (530), wherein: The real-time data adaptation module (510) is used to receive real-time data from the data processing unit (200) and automatically verify the consistency between data dimensions and time. The model inference execution module (520) is used to input the verified data into the trained deep learning prediction model and output the sales trend prediction for the next 1-30 days. The Echarts visualization rendering module (530) generates visualization charts through Echarts, including at least a line chart comparing historical and predicted sales and a pie chart showing the sales percentage of product categories, to intuitively display the prediction results.
8. The system for constructing a food and beverage online sales trend prediction model based on multi-source data fusion and deep learning according to claim 7, characterized in that, The Echarts visualization rendering module (530) includes a basic chart generation submodule (531), an exception alert submodule (532), and an interactive response submodule (533), wherein: The basic chart generation submodule (531) generates a line chart comparing historical and predicted sales and a pie chart showing the sales percentage of product categories using Echarts. The abnormal warning submodule (532) is based on a preset fluctuation threshold and uses red markers to mark predicted abnormal points in the line graph; The interactive response submodule (533) is used to respond to category click operations and separately display the historical and predicted trend subgraphs of the selected category.
9. A method for constructing a food and beverage online sales trend prediction model based on multi-source data fusion and deep learning, based on the food and beverage online sales trend prediction model construction system based on multi-source data fusion and deep learning as described in any one of claims 1-8, characterized in that, Includes the following steps: S100: Collects multi-source data related to online sales of food and beverages, and obtains data from online sales platforms, social media, industry information websites and meteorological information databases based on web crawling technology and API interface calls. S200: Preprocess and extract features from the multi-source data collected by S100. Through data cleaning, denoising, and normalization, multi-dimensional predictive features are extracted using feature engineering techniques. S300: Construct a deep learning prediction model and adopt an improved LSTM-Transformer fusion algorithm. It uses bidirectional LSTM to encode temporal features and Transformer to model global features, and fuses the two-dimensional features and maps them to the sales trend prediction space. S400: Train a deep learning prediction model based on historical datasets, using the Adam optimization algorithm, learning rate, batch size and number of training rounds as hyperparameters, and use the validation set to evaluate accuracy, mean squared error and mean absolute error, and iteratively optimize the parameters of the deep learning prediction model. The S500 inputs the processed data into the trained deep learning prediction model to generate future sales trend prediction results, which are then displayed in multi-dimensional charts using visualization technology.
Citation Information
Patent Citations
Agricultural product network sales trend prediction method and device, medium and equipment
CN116308453A
Product precision sales analysis system and analysis method based on big data
CN119130523A
Commodity sales volume prediction method and device based on Transformer + LSTM neural network model
CN111626764A
Ship trajectory prediction method based on improved P-B-T
CN118861532A
Cited By
Method for counting sales data of office equipment
CN122636247A