Method, device and storage medium for predicting sales volume based on public opinion data
By integrating external public opinion data with internal sales data, a sales volume forecasting model was constructed, which solved the problem of lagging response to market changes in traditional methods and achieved more forward-looking and accurate sales volume forecasting.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- GUANGZHOU FANGZHOU INFORMATION TECHNOLOGY CO LTD
- Filing Date
- 2026-04-07
- Publication Date
- 2026-07-10
AI Technical Summary
Traditional sales forecasting methods rely on internal static data and lack the ability to capture and integrate dynamic signals from the external market. This results in a delayed response to market changes, insufficient accuracy and adaptability, and an inability to meet companies' needs for forward-looking and accurate sales forecasts.
By integrating external public opinion data with internal sales data and using feature extraction and spatiotemporal alignment fusion processing, a sales volume prediction model is constructed to capture consumers' emotional tendencies and focus of attention in the market, thereby improving the foresight and accuracy of predictions.
By combining historical sales data with public opinion data, we have achieved timely responses to market dynamics, improved the accuracy and foresight of sales volume forecasts, and adapted to the rapidly changing market environment.
Smart Images

Figure CN122367533A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of data processing technology, and in particular to a method, apparatus, device, and storage medium for sales volume prediction based on public opinion data. Background Technology
[0002] Traditional sales forecasting methods mainly rely on historical sales data, price factors, and time series attributes within the enterprise for modeling. While these methods can reflect past sales trends, they are essentially a summary analysis of what has already happened.
[0003] Because existing technologies rely solely on internal static data and lack the ability to capture and integrate dynamic signals from the external market, their response to potential market changes is significantly delayed. The accuracy and adaptability of forecasts are insufficient in rapidly changing market environments, failing to meet enterprises' needs for forward-looking and accurate sales forecasts. Summary of the Invention
[0004] This invention provides a sales volume forecasting method, apparatus, device, and storage medium based on public opinion data. By integrating external public opinion data with internal sales data, it overcomes the shortcomings of existing sales forecasting methods, such as delayed response and insufficient accuracy, and improves the foresight and accuracy of sales forecasting.
[0005] In a first aspect, the present invention provides a sales volume prediction method based on public opinion data, comprising: Acquire public opinion data and historical sales data of the target product within a historical time period, wherein the historical sales data includes historical sales volume and historical price within a preset period of the historical time period; Feature extraction is performed on the public opinion data to obtain a public opinion feature set; According to the preset period, the historical sales volume, historical price and public opinion features in the public opinion feature set are spatiotemporally aligned and fused to obtain a fused feature sequence. The fused feature sequence is input into the sales volume prediction model to obtain the sales volume of the target product in each prediction period within the prediction time period.
[0006] Secondly, the present invention provides a sales volume prediction device based on public opinion data, comprising: The public opinion data and historical sales data acquisition module is used to acquire public opinion data and historical sales data of the target product within a historical time period. The historical sales data includes the historical sales volume and historical price within a preset period of the historical time period. The public opinion feature extraction module is used to extract features from the public opinion data to obtain a public opinion feature set; The feature alignment module is used to perform spatiotemporal alignment and fusion processing on the historical sales volume, historical price and public opinion features in the public opinion feature set according to the preset period to obtain a fused feature sequence; The sales volume prediction module is used to input the fused feature sequence into the sales volume prediction model to obtain the sales volume of the target product in each prediction period within the prediction time period.
[0007] Thirdly, the present invention provides an electronic device, the electronic device comprising: At least one processor; and A memory communicatively connected to the at least one processor; wherein, The memory stores a computer program that can be executed by the at least one processor, the computer program being executed by the at least one processor to enable the at least one processor to perform the sales volume prediction method based on public opinion data as described in the first aspect of the present invention.
[0008] Fourthly, the present invention provides a computer-readable storage medium storing computer instructions that, when executed by a processor, implement the sales volume prediction method based on public opinion data as described in the first aspect of the present invention.
[0009] This invention acquires public opinion data and historical sales data of a target product within a historical time period, then extracts features from the public opinion data to obtain a public opinion feature set. Following a preset cycle, it performs spatiotemporal alignment and fusion processing on historical sales volume, historical prices, and public opinion features from the feature set to obtain a fused feature sequence. This fused feature sequence is then input into a sales volume prediction model to obtain the sales volume of the target product for each prediction cycle within the prediction time period. This achieves the prediction of target product sales volume by combining historical sales data and public opinion data. By capturing dynamic changes in consumer sentiment and focus in the market through public opinion data, it effectively solves the problem of lagging market dynamic response when using only historical sales data in existing technologies, making sales volume prediction more forward-looking and accurate.
[0010] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of the present invention, nor is it intended to limit the scope of the invention. Other features of the invention will become readily apparent from the following description. Attached Figure Description
[0011] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0012] Figure 1 This is a flowchart of a sales volume prediction method based on public opinion data provided in an embodiment of the present invention; Figure 2 This is a schematic diagram of a sales volume prediction device based on public opinion data provided in an embodiment of the present invention; Figure 3 This is a schematic diagram of the structure of the electronic device provided in an embodiment of the present invention. Detailed Implementation
[0013] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. 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 skilled in the art without creative effort should fall within the scope of protection of the present invention.
[0014] Figure 1 This is a flowchart illustrating a sales volume prediction method based on public opinion data, provided as an embodiment of the present invention. This embodiment is applicable to predicting the sales volume of goods within a future time period. The method can be executed by a sales volume prediction device based on public opinion data. This device can be implemented in hardware and / or software and can be configured in an electronic device. Figure 1 As shown, this sales volume prediction method based on public opinion data includes: S101. Obtain public opinion data and historical sales data of the target product within a historical time period. The historical sales data includes the historical sales volume and historical price within a preset period of the historical time period.
[0015] The target product can refer to any category of goods for which sales volume forecasting is required, including pharmaceuticals, electronics, fast-moving consumer goods, and daily necessities. The historical time period refers to the selected past time range for obtaining the required basic data, which can be flexibly set according to the sales characteristics and market change frequency of the target product. Public opinion data refers to textual data related to the target product that reflects the attitudes and perceptions of market participants (consumers, industry bloggers, professionals, etc.). Public opinion data can come from social network platforms, e-commerce review sections, AI intelligent Q&A interfaces, industry popular science platforms, professional evaluation channels, etc. Historical sales data refers to sales-related data of the target product within a historical time period, which can include historical sales volume (the number of sales of the target product within a specified period) and historical price (the actual sales price of the target product within a specified period). The preset period refers to the basic unit for dividing historical data and forecast data by time dimension, which can be flexibly set according to the sales frequency of the target product, such as hour, day, week, month, and is the basis for achieving time dimension data alignment.
[0016] In an optional embodiment, the historical sales volume and historical price of the target product in each preset period within a historical time period can be obtained, the initial public opinion text related to the target product collected in each preset period within the historical time period can be obtained, and the initial public opinion text can be preprocessed to obtain the target public opinion text.
[0017] Specifically, the historical sales volume and historical price of the target product for each preset period within a historical time period can be extracted through the enterprise's internal sales management system, inventory management system, e-commerce backend data interface, etc. If the sales data includes regional dimension information, it needs to be classified and stored according to the sales region to ensure that the time granularity and regional granularity of the data are consistent with the preset period and sales division dimension.
[0018] Using web crawling technology, platform open data interfaces, and third-party data collection tools, initial public opinion texts highly relevant to the target product are collected for each preset period within a historical timeframe. During the collection process, the texts are time-stamped according to the preset period. If the data source can obtain regional information (such as IP address, user location, and region description in the text), regional labeling is performed simultaneously to ensure that the time and regional dimensions of the public opinion texts and sales data are compatible. Further, the collected initial public opinion texts undergo systematic cleaning and standardization to remove invalid noise and unify the data format. Specific processing operations include: deleting HTML / XML tags, advertising content, and meaningless duplicate text from the text; fixing garbled characters caused by encoding errors; converting emoticons to corresponding text descriptions (e.g., converting satisfaction or dissatisfaction symbols in reviews to characters); converting full-width characters to half-width characters; unifying the date and number formats in the text; and correcting typos using spell-checking tools. After preprocessing, standardized target public opinion texts are obtained, which are then categorized and stored according to preset periods and sales regions to form the final public opinion data.
[0019] Using a specific oral hypoglycemic drug as the target product, with a preset period of days, and sales regions divided into four core areas: East China, North China, South China, and Southwest China, and a forecast period of the next 7 days (7 forecast periods), the historical period of the past 7 days can be selected. The historical sales volume (boxes) and historical sales price (yuan / box) of this hypoglycemic drug for each day within the past 7 days are extracted from the company's pharmaceutical sales management system and categorized by the four sales regions: East China, North China, South China, and Southwest China. Simultaneously, data is collected from pharmaceutical science popularization platforms' comment sections, e-commerce drug review sections, Zhihu medical Q&A, and Weibo health... The open interface of the Kang topic discussion collected initial public opinion texts related to this hypoglycemic drug every day for the past 7 days, totaling 52,000 pieces. During collection, the texts were time-stamped by day and geographically tagged by IP location. The initial public opinion texts were cleaned and standardized, removing 10,000 pieces of HTML tags, advertising text, and duplicate text, fixing more than 200 pieces of garbled encoding, converting emoticons into text descriptions, standardizing full-width / half-width characters, and correcting typos, etc. Finally, 42,000 standardized target public opinion texts were obtained and stored in categories by day and sales region.
[0020] In this embodiment, during data collection and preprocessing, on the one hand, public opinion data and sales data are collected and preprocessed according to a unified preset cycle to achieve time granularity standardization of multi-source data. At the same time, public opinion texts are regionally labeled and preprocessed to ensure that public opinion data and historical sales data are fusionable in the time dimension, laying a data foundation for subsequent spatiotemporal alignment and fusion processing. On the other hand, the preprocessing of the initial public opinion text effectively removes noisy data, improves the quality of public opinion data, and avoids invalid information from interfering with subsequent feature extraction and model prediction. Furthermore, the regional dimension labeling of the data enables regional matching between sales data and public opinion data, supporting refined sales volume prediction across regions.
[0021] S102. Extract features from public opinion data to obtain a public opinion feature set.
[0022] In this embodiment, feature extraction refers to the process of transforming unstructured text-based public opinion data into structured numerical features. The public opinion feature set refers to the set of structured numerical features obtained after feature extraction of the target public opinion text. Each preset period corresponds to a public opinion feature set, which can represent at least one of the following: user sentiment towards the target product (positive, negative, neutral), focus of attention (such as product function, quality, price, user experience, after-sales service, etc.), and demand changes (such as user functional needs, purchase intention, and changing trends in demand for the product).
[0023] In an optional embodiment, a pre-trained natural language processing model can be selected as the public opinion feature extraction model. For example, pre-trained models with deep semantic analysis capabilities, such as BERT, GPT series, RoBERTa, and TextCNN, can be selected. The model has completed fine-tuning training for commodity public opinion analysis and can accurately identify information such as sentiment tendency and focus of attention in the text. The target public opinion texts obtained in S101 and classified according to preset periods are input into the public opinion feature extraction model. The model performs overall semantic analysis on the target public opinion texts of each preset period and outputs the structured numerical feature vector corresponding to the preset period. The feature vectors of all preset periods are integrated in chronological order to obtain the public opinion feature set. If the public opinion data contains regional dimension information, the public opinion features of each region and each preset period need to be extracted according to the sales region to form a regional public opinion feature set. The feature dimension of the public opinion feature set can be adjusted according to the model type and actual needs. For example, when using the BERT model, a 768-dimensional or 1024-dimensional feature vector can be output. Each dimension of the feature vector corresponds to a specific semantic feature, which together represent the core information of public opinion within the preset period.
[0024] Following the example above, which uses a certain oral hypoglycemic drug as the target product, the BERT model, which has been fine-tuned and trained with medical public opinion text, is selected as the public opinion feature extraction model. The target public opinion text for each day of the past 7 days is input into the BERT model according to the sales region. The model outputs a 768-dimensional numerical feature vector for each sales region and each day. All feature vectors are integrated in the order of time and region to obtain the public opinion feature set by region. A total of 7 preset periods (days) of public opinion features for four sales regions are obtained.
[0025] S103. According to the preset cycle, perform spatiotemporal alignment and fusion processing on historical sales volume, historical price and public opinion feature set to obtain fused feature sequence.
[0026] Spatiotemporal alignment and fusion processing refers to the process of matching and integrating historical sales volume, historical prices, and public opinion characteristics from both time and space dimensions. Time alignment refers to the matching of multi-source data according to preset and predicted periods in the time dimension, while spatial alignment refers to the matching of multi-source data according to sales regions in the geographical dimension.
[0027] The forecast period refers to the future time range within which the sales volume of the target product needs to be predicted. Its time granularity is consistent with the preset period. The forecast period refers to the basic unit for dividing the forecast period, which has the same time granularity as the preset period. The forecast period includes multiple consecutive forecast periods. The candidate public opinion feature set refers to the set of public opinion features extracted from the public opinion feature set and corresponding to the historical preset period of the forecast period. It is the preliminary public opinion feature after time alignment. The target public opinion feature refers to the public opinion feature extracted from the candidate public opinion feature set and matched with the specific sales region. It is the public opinion feature after spatial alignment. The time feature refers to the feature that characterizes the time attribute of the forecast period. It is an important auxiliary feature that affects the sales volume of the product, including whether it is a weekend, whether it is a holiday, whether it is a peak / off-peak season, seasonal features, etc. The fused feature sequence refers to the feature sequence obtained by integrating the historical sales volume, historical price, target public opinion feature, and time feature of the same sales region and the same time dimension. Each sales region and each forecast period corresponds to a set of fused features. All fused features are arranged in the order of sales region and forecast period to form the fused feature sequence.
[0028] In one embodiment, when aligning the time dimension, for each prediction period within the prediction time period, the public opinion feature set corresponding to the time period corresponding to the preset period is extracted from the public opinion feature set as a candidate public opinion feature set. Simultaneously, historical sales volume and historical sales price for each sales region corresponding to the preset period are extracted from historical sales data, achieving accurate matching of public opinion features, sales volume, and price in the time dimension and ensuring consistency of time attributes across multiple data sources. Further, the candidate public opinion feature set is filtered and extracted based on the geographical dimension. Combining geographical markers, IP addresses, and regional descriptions in the public opinion text, target public opinion features corresponding to each sales region are extracted. Simultaneously, a feature construction algorithm is used to obtain the time features for each prediction period. These time features must be labeled according to a preset period to ensure consistency with the time granularity of other data.
[0029] For example, for a predicted day (such as Saturday) in the next 7 days, the public opinion feature set of Saturday in the previous 7 days is extracted as a candidate public opinion feature set. At the same time, the historical sales volume and historical price of the four sales regions in the previous Saturday are extracted. The public opinion feature sets of different sales regions are selected from the candidate public opinion feature set, and a time feature (such as weekend, non-working day) is marked for Saturday. The target public opinion features, time features, historical sales volume and historical price of each sales region on each predicted day are spliced and merged to obtain the merged features of the four sales regions from Monday to Sunday, forming a merged feature sequence.
[0030] This embodiment performs spatiotemporal alignment and matching of features from multiple data sources. On the one hand, it achieves deep integration of historical sales data and public opinion data, enabling the prediction model to learn both internal sales patterns and external market dynamics simultaneously. On the other hand, it performs spatial alignment and feature fusion by sales region, supporting refined sales volume prediction across regions and adapting to the needs of enterprises in formulating sales strategies in different regions. Furthermore, by incorporating time features, it can improve the accuracy of sales volume prediction by utilizing time periodicity (such as the difference between sales on non-working days and sales on working days).
[0031] S104. Input the fused feature sequence into the sales volume prediction model to obtain the sales volume of the target product in each prediction period within the prediction time period.
[0032] In one embodiment, the sales volume prediction model can be trained through the following steps: S1. Obtain the training dataset. Each training data point in the training dataset includes a feature sequence composed of features from multiple time points, as well as the first sales volume of each sales region at multiple prediction time points. The features at each time point are obtained by fusing public opinion features, regional features, time features, sales volume, and sales price. The time features are the features of the prediction time period.
[0033] Taking a week as an example, a training data set includes {region, (Monday, public opinion characteristics, weekday, sales volume, sales price), (Tuesday, public opinion characteristics, weekday, sales volume, sales price), (Wednesday, public opinion characteristics, weekday, sales volume, sales price), ..., (Sunday, public opinion characteristics, non-working day, sales volume, sales price)}.
[0034] S2. Randomly extract training data and input it into the sales volume prediction model to obtain the second sales volume of each sales region at multiple prediction time points.
[0035] In one embodiment, N training data points can be extracted and input into the model to obtain the second sales volume for each sales region from Monday to Sunday.
[0036] S3. Determine the regional weights of the regional features and the time weights of the time features.
[0037] For example, different time weights are set for Monday to Sunday, and different regional weights are set for different regions. Specifically, the principle for allocating regional weights is: key sales regions with high historical demand and large sales share are allocated higher weight values, while secondary sales regions are allocated basic weight values; the principle for allocating time weights is: key sales time nodes such as holidays, peak sales seasons, and weekdays (applicable to B-end goods / pharmaceutical products) are allocated higher weight values, while non-key time nodes are allocated basic weight values.
[0038] S4. Calculate the loss value based on regional weight, time weight, first sales volume and second sales volume.
[0039] In an optional embodiment, for each sales region, the product of the region weight and the time weight of multiple forecast time points is calculated to obtain the target weight of the sales region at each forecast time point. The sales volume deviation is calculated using the first and second sales volume of all sales regions at each forecast time point. The weighted average of the target weight and the sales volume deviation is calculated to obtain the loss value.
[0040] Specifically, for each sales region, the product of the region weight and the time weights of multiple prediction time points is calculated to obtain the target weight of the sales region at each prediction time point, achieving a comprehensive weighting of region and time. Furthermore, the first and second sales volumes of all sales regions at each prediction time point are used to calculate the sales volume deviation through methods such as absolute error and squared error. The squared error calculation is preferred, that is, the sales volume deviation is equal to the square of the difference between the first and second sales volumes. The target weight of each sales region and each prediction time point is multiplied by the corresponding sales volume deviation, and the weighted average is calculated after summing all the product results. This average value is the final loss value of the model.
[0041] S5. Determine whether the conditions for stopping training are met.
[0042] Set the training stop conditions for the model. The training stop conditions can be one or more of the following: the loss value is less than a preset threshold, the number of training iterations reaches a preset number, or the loss value does not decrease significantly for multiple consecutive rounds. The preset threshold and preset number of iterations can be adjusted according to the actual prediction needs and model type. If the training stop conditions are met, proceed to step S6; otherwise, proceed to step S7.
[0043] S6. Stop training the sales volume prediction model.
[0044] If the model meets the stop training condition set in step S5, then the training of the sales volume prediction model will stop. At this point, the model parameters have reached the optimal state, and the trained sales volume prediction model is obtained.
[0045] S7. Adjust the model parameters of the sales volume prediction model based on the loss value.
[0046] If the model does not meet the stopping training condition, the model parameters of the sales volume prediction model are adjusted in reverse using optimization algorithms such as gradient descent and stochastic gradient descent, based on the loss value calculated in step S4. After the adjustment is completed, return to step S2 and continue to extract training data to iteratively train the model until the model meets the stopping training condition.
[0047] In this embodiment, different weights are set for different regional and temporal features during model training. When calculating the loss value, the regional and temporal weights enable the model to prioritize learning the sales volume differences in key sales regions and the periodic sales patterns of sales volume at key sales time nodes, thereby improving the model's prediction accuracy and solving the problem of insufficient prediction accuracy of traditional models for key regions and key times. The trained sales volume prediction model can be directly used to predict actual sales volume. Specifically, the fused feature sequences of each sales region obtained in S103 are input into the trained sales volume prediction model. The model independently analyzes and predicts the fused feature sequences of each sales region and outputs the sales volume of the target product in each prediction period in each sales region.
[0048] For example, at the end of the week (Sunday), the fused feature sequences of the previous week's sales data for a certain oral hypoglycemic drug in four sales regions of East China, North China, South China, and Southwest China are input into the sales volume prediction model to obtain the predicted sales volume for the next week in the four sales regions of East China, North China, South China, and Southwest China.
[0049] In one optional embodiment, after obtaining the sales volume for each forecast period, multiple public opinion characteristics of each sales region for multiple forecast periods prior to each target forecast period are acquired. Based on these multiple public opinion characteristics, the public opinion trend before the target forecast period is determined. If the public opinion trend is positive, the sales volume of the sales region in the target forecast period is adjusted upwards; if the public opinion trend is negative, the sales volume of the sales region in the target forecast period is adjusted downwards. A positive trend refers to a continuous increase in the proportion of positive sentiment, a continuous increase in product attention, and positive changes in demand characteristics. A negative trend refers to a sharp increase in the proportion of negative sentiment, an increase in attention to negative topics, and negative changes in demand characteristics. A neutral trend is defined as no significant change. For example, in South China, the predicted sales volume of a certain oral hypoglycemic drug from Monday to Sunday next week is 19,000 boxes on Monday, 16,000 boxes on Tuesday, 14,500 boxes on Wednesday, 15,500 boxes on Thursday, 13,000 boxes on Friday, 25,000 boxes on Saturday, and 23,000 boxes on Sunday. By Wednesday, we can obtain the daily public opinion characteristics of South China from last Wednesday to this Tuesday. If the proportion of positive characteristics in the public opinion characteristics increases from 30% to 88%, such as an increase in positive reviews on e-commerce platforms, an increase in the number of people who have added the drug to their favorites, or a medical expert recommending the hypoglycemic drug, we can determine that the public opinion characteristics are showing a positive trend, and the predicted sales volume for Wednesday will be increased by 10%. Conversely, if the proportion of positive characteristics increases from 30% to 88%, such as an increase in positive reviews on e-commerce platforms, an increase in the number of people who have added the drug to their favorites, or a medical expert recommending the hypoglycemic drug, we can determine that the public opinion characteristics are showing a positive trend, and the predicted sales volume for Wednesday will be increased by 10%. The proportion of negative characteristics in the market has increased from 5% to 20%. For example, an increase in negative reviews on e-commerce platforms, a decrease in the number of followers and favorites, or a medical expert giving a negative evaluation of hypoglycemic drugs can confirm that the public opinion characteristics are changing in a negative direction. The predicted sales volume for Wednesday can be lowered by 10%. When the public opinion characteristics are changing in a positive or negative direction, corresponding early warning messages can be generated. For example, when the public opinion characteristics are changing in a positive direction, it means that the sales volume of the target product will exceed expectations, and a prompt message to increase the inventory of the product in the region can be generated. When the public opinion characteristics are changing in a negative direction, it means that the sales volume of the target product in the region is declining, and a prompt message to implement promotional strategies can be generated.
[0050] This invention first acquires public opinion data and historical sales data of a target product within a historical time period. Then, it extracts features from the public opinion data to obtain a public opinion feature set. According to a preset period, it performs spatiotemporal alignment and fusion processing on historical sales volume, historical price, and public opinion features in the public opinion feature set to obtain a fused feature sequence. The fused feature sequence is then input into a sales volume prediction model to obtain the sales volume of the target product in each prediction period within the prediction time period. This achieves the prediction of the target product's sales volume by combining historical sales data and public opinion data. By capturing the dynamic changes in public opinion such as consumer sentiment and focus in the market through public opinion data, it effectively solves the problem of lagging market dynamic response when using only historical sales data in existing technologies, making sales volume prediction more forward-looking and accurate.
[0051] Furthermore, during model training, a loss function with regional and time weights is used to train the model, allowing it to prioritize learning the periodic sales patterns of key sales regions and critical sales time nodes, thereby improving the accuracy of the model's sales volume prediction.
[0052] Furthermore, by dynamically optimizing the basic forecast results based on public opinion trends, the accuracy of sales volume forecasts across regions and multiple periods has been improved.
[0053] Figure 2 This is a schematic diagram of a sales volume prediction device based on public opinion data, provided as an embodiment of the present invention. Figure 2 As shown, the sales volume prediction device based on public opinion data includes: The public opinion data and historical sales data acquisition module 201 is used to acquire public opinion data and historical sales data of the target product within a historical time period. The historical sales data includes the historical sales volume and historical price within a preset period of the historical time period. The public opinion feature extraction module 202 is used to extract features from the public opinion data to obtain a public opinion feature set. The feature alignment module 203 is used to perform spatiotemporal alignment and fusion processing on the historical sales volume, historical price and public opinion features in the public opinion feature set according to the preset period to obtain a fused feature sequence; The sales volume prediction module 204 is used to input the fused feature sequence into the sales volume prediction model to obtain the sales volume of the target product in each prediction period within the prediction time period.
[0054] The sales volume prediction device based on public opinion data provided in the embodiments of the present invention can execute the sales volume prediction method based on public opinion data provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.
[0055] Figure 3 A schematic diagram of an electronic device 40 that can be used to implement embodiments of the present invention is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices (e.g., helmets, glasses, watches, etc.), and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the invention described and / or claimed herein.
[0056] like Figure 3As shown, the electronic device 40 includes at least one processor 41 and a memory, such as a read-only memory (ROM) 42 or a random access memory (RAM) 43, communicatively connected to the at least one processor 41. The memory stores computer programs executable by the at least one processor. The processor 41 can perform various appropriate actions and processes based on the computer program stored in the ROM 42 or loaded from storage unit 48 into the RAM 43. The RAM 43 can also store various programs and data required for the operation of the electronic device 40. The processor 41, ROM 42, and RAM 43 are interconnected via a bus 44. An input / output (I / O) interface 45 is also connected to the bus 44.
[0057] Multiple components in electronic device 40 are connected to I / O interface 45, including: input unit 46, such as keyboard, mouse, etc.; output unit 47, such as various types of monitors, speakers, etc.; storage unit 48, such as disk, optical disk, etc.; and communication unit 49, such as network card, modem, wireless transceiver, etc. Communication unit 49 allows electronic device 40 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.
[0058] Processor 41 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of processor 41 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. Processor 41 performs the various methods and processes described above, such as sales volume prediction methods based on public opinion data.
[0059] In some embodiments, the sales volume forecasting method based on public opinion data can be implemented as a computer program tangibly contained in a computer-readable storage medium, such as storage unit 48. In some embodiments, part or all of the computer program can be loaded and / or installed on electronic device 40 via ROM 42 and / or communication unit 49. When the computer program is loaded into RAM 43 and executed by processor 41, one or more steps of the sales volume forecasting method based on public opinion data described above can be performed. Alternatively, in other embodiments, processor 41 can be configured to perform the sales volume forecasting method based on public opinion data by any other suitable means (e.g., by means of firmware).
[0060] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-a-chip (SoCs), complex programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations may include: implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.
[0061] Computer programs used to implement the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, such that when executed by the processor, the computer programs cause the functions / operations specified in the flowcharts and / or block diagrams to be performed. The computer programs may be executed entirely on a machine, partially on a machine, or as a standalone software package, partially on a machine and partially on a remote machine, or entirely on a remote machine or server.
[0062] In the context of this invention, a computer-readable storage medium can be a tangible medium that may contain or store a computer program for use by or in conjunction with an instruction execution system, apparatus, or device. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination thereof. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof.
[0063] To provide interaction with a user, the systems and techniques described herein can be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the electronic device. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).
[0064] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as data servers), or middleware components (e.g., application servers), or frontend components (e.g., user computers with graphical user interfaces or web browsers through which users can interact with implementations of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., communication networks). Examples of communication networks include local area networks (LANs), wide area networks (WANs), blockchain networks, and the Internet.
[0065] A computing system can include clients and servers. Clients and servers are generally located far apart and typically interact through communication networks. The client-server relationship is created by computer programs running on the respective computers and having a client-server relationship with each other. The server can be a cloud server, also known as a cloud computing server or cloud host, which is a hosting product within the cloud computing service system to address the shortcomings of traditional physical hosts and VPS services, such as high management difficulty and weak business scalability.
[0066] It should be understood that the various forms of processes shown above can be used, with steps reordered, added, or deleted. For example, the steps described in this invention can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution of this invention can be achieved, and this is not limited herein.
[0067] The specific embodiments described above do not constitute a limitation on the scope of protection of this invention. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this invention should be included within the scope of protection of this invention.
Claims
1. A sales volume prediction method based on public opinion data, characterized in that, include: Acquire public opinion data and historical sales data of the target product within a historical time period, wherein the historical sales data includes historical sales volume and historical price within a preset period of the historical time period; Feature extraction is performed on the public opinion data to obtain a public opinion feature set; According to the preset period, the historical sales volume, historical price and public opinion features in the public opinion feature set are spatiotemporally aligned and fused to obtain a fused feature sequence. The fused feature sequence is input into the sales volume prediction model to obtain the sales volume of the target product in each prediction period within the prediction time period.
2. The method according to claim 1, characterized in that, Obtain public opinion data and historical sales data for the target product within a historical time period, including: Obtain the historical sales volume and historical price of the target product in each preset period within a historical time period; Obtain initial public opinion texts related to the target product collected in each preset period within a historical time period; The initial public opinion text is preprocessed to obtain the target public opinion text.
3. The method according to claim 1, characterized in that, According to the preset period, the historical sales volume, historical price, and public opinion features in the public opinion feature set are subjected to spatiotemporal alignment and fusion processing to obtain a fused feature sequence, including: For each prediction period within the prediction time period, a candidate public opinion feature set for the corresponding time period is extracted from the public opinion feature set, and the historical sales volume and historical sales price for each sales region corresponding to the corresponding preset period are extracted. Extract target public opinion features for each sales region from the candidate public opinion feature set, and obtain time features for each prediction period; By fusing historical sales volume, historical sales price, target public opinion characteristics, and time characteristics of the predicted time period in the same sales region, a fused feature sequence for each sales region in each preset period is obtained.
4. The method according to any one of claims 1-3, characterized in that, The sales volume prediction model is trained through the following steps: Obtain a training dataset, in which each piece of training data includes a feature sequence composed of features from multiple time points, and the first sales volume of each sales region at multiple prediction time points. The features of each time point are obtained by fusing public opinion features, regional features, time features, sales volume and sales price. The time features are the features of the prediction time period. Randomly extracted training data is input into the sales volume prediction model to obtain the second sales volume of each sales region at multiple prediction time points; Determine the regional weights of the regional characteristics and the time weights of the time characteristics for each region; The loss value is calculated based on the region weight, the time weight, the first sales volume, and the second sales volume; Determine whether the conditions for stopping training are met; If so, stop training the sales volume prediction model; If not, adjust the model parameters of the sales volume prediction model based on the loss value, and return to the step of randomly extracting training data and inputting it into the sales volume prediction model.
5. The method according to claim 4, characterized in that, The loss value is calculated based on the region weight, the time weight, the first sales volume, and the second sales volume, including: For each sales region, the product of the region weight of the sales region and the time weight of multiple prediction time points is calculated to obtain the target weight of the sales region at each prediction time point. The sales volume deviation is calculated using the first and second sales volumes for all sales regions at each forecast time point. The loss value is obtained by calculating a weighted average of the target weight and the sales volume deviation.
6. The method according to any one of claims 1-3, characterized in that, The fused feature sequence includes fused feature sequences from various sales regions. Inputting the fused feature sequence into the sales volume prediction model yields the sales volume of the target product for each prediction period within the prediction timeframe, including: The fused feature sequences of each sales region are input into the sales volume prediction model to obtain the sales volume of the target product in each sales region for each prediction period.
7. The method according to claim 6, characterized in that, After inputting the fused feature sequences of various sales regions into the sales volume prediction model to obtain the sales volume of the target product in each sales region for each prediction period, the model further includes: Obtain multiple public opinion characteristics for each sales region across multiple forecast periods prior to each target forecast period; The public opinion trend before the target prediction period is determined based on multiple public opinion characteristics; If the public opinion trend is positive, the sales volume of the sales region in the target forecast period will be adjusted upwards; If the public opinion trend is negative, the sales volume of the sales region in the target forecast period will be reduced.
8. A sales volume prediction device based on public opinion data, characterized in that, include: The public opinion data and historical sales data acquisition module is used to acquire public opinion data and historical sales data of the target product within a historical time period. The historical sales data includes the historical sales volume and historical price within a preset period of the historical time period. The public opinion feature extraction module is used to extract features from the public opinion data to obtain a public opinion feature set; The feature alignment module is used to perform spatiotemporal alignment and fusion processing on the historical sales volume, historical price and public opinion features in the public opinion feature set according to the preset period to obtain a fused feature sequence; The sales volume prediction module is used to input the fused feature sequence into the sales volume prediction model to obtain the sales volume of the target product in each prediction period within the prediction time period.
9. An electronic device, characterized in that, The electronic device includes: At least one processor; and A memory communicatively connected to the at least one processor; wherein, The memory stores a computer program that can be executed by the at least one processor, the computer program being executed by the at least one processor to enable the at least one processor to perform the sales volume prediction method based on public opinion data as described in any one of claims 1-7.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions that cause a processor to execute the sales volume prediction method based on public opinion data as described in any one of claims 1-7.