Sales prediction method and device

Through the improved sparrow search algorithm, the LSTM model and gray correlation method are optimized to filter features, and a multivariate model is constructed, which solves the problem of low sales forecasting accuracy in the existing technology, and achieves more accurate sales trend forecasting and marketing strategy optimization.

CN119599710AInactive Publication Date: 2025-03-11INSPUR ZHUOSHU BIG DATA IND DEV CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411556040.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-04
Publication Date
2025-03-11
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

The prior art is difficult to accurately predict product sales, especially when facing complex market environments and massive data, resulting in low prediction accuracy.

Method used

The improved sparrow search algorithm is used to optimize the hyperparameters of the LSTM neural network model, and the relevant features are screened through the gray correlation method to build a multivariate model to improve the accuracy of sales forecasts.

Benefits of technology

It improves the accuracy of sales forecasts, can predict product sales trends more accurately, helps enterprises optimize production and procurement plans, control inventory and improve marketing efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119599710A_ABST
    Figure CN119599710A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of big data, and particularly provides a sales volume prediction method and device, and the method comprises the following steps: S1, collecting a historical sales data set, and collecting and adding environmental factors and economic factors as feature variables; s2, screening out features with relatively high correlation with the sales volume; s3, fusing the features in the step S2 with an original feature set to form an input feature set of the LSTM model; s4, segmenting the data set into a training set and a test; s5, taking a mean square error obtained by calculating an actual value and a predicted value of the model as fitness; s6, searching an optimal hyper-parameter for the model by using an improved sparrow search algorithm; s7, judging whether a set stop condition is met or not; s8, carrying out retraining to obtain a high-precision LSTM network model; and S9, evaluating the prediction effect of the obtained prediction model. Compared with the prior art, the method has the advantages that the prediction precision can be improved, a plurality of feature variables influencing the sales data are fused into the sales volume data, and the multivariable model containing related prediction feature conditions is established.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of big data technology, and specifically provides a sales forecasting method and device. Background Art

[0002] With the rapid development of the Internet, enterprises have accumulated a huge amount of data information in their operations, including user retail data, retail order data, product data, etc. The continuous increase in the amount of data provides enterprises with data support for precision marketing, making enterprise marketing more convenient. Through the analysis and mining of enterprise data, enterprises can gain a deep understanding of customer needs and behavioral habits, predict market trends and product demand, and discover and solve problems in operations. At the same time, data analysis and mining can also help enterprises optimize operational processes, improve efficiency and reduce costs.

[0003] However, the massive amount of data faced by enterprises also brings a series of problems, such as storage, processing and analysis. There are more than 8 million retailers across the country that generate data every day, which has accumulated to TB level. Due to the wide range of data sources and complex structures, data processing is also a very challenging task. Data needs to be cleaned, converted, integrated, stored and analyzed in multiple steps, which can only be completed with the help of various data tools and technologies. In addition, data processing requires strict control of data quality and accuracy to avoid data errors from having a negative impact on the results.

[0004] For enterprises, there are more than eight million retailers in China, and these retailers are the main channels for enterprises to export their products. The large number of retailers has formed a huge and complex sales network. Retailers also have multi-level sales characteristics, and their sales channels are not limited to direct contact with enterprises. Many retailers obtain goods through middlemen such as wholesalers and agents, and sell them to end consumers. Therefore, enterprises also need to establish cooperative relationships with retailers, wholesalers, agents, etc. at different levels to promote the marketing and sales of products. At present, retailers across the country have generated a large amount of data, and the sources of these data include but are not limited to the State Tobacco Monopoly Administration, enterprise collection and other methods, and the total amount has reached the TB level.

[0005] Retail data mainly includes basic information data of retailers and order data and other related information. In addition, hundreds of millions of related business data are generated every year, such as retailer demand information, commodity price information, inventory information, etc., as well as visit data obtained using mobile terminals, order data of retail terminal systems and other related business data. These data are important bases for analyzing retailer consumption behavior and formulating marketing strategies, and can help companies fully understand the operating conditions and characteristics of retailers, so as to better meet their needs.

[0006] At the same time, accurate sales forecasting helps to formulate production and procurement plans on demand, better control inventory, and provide effective marketing data support, which is of great significance in market competition. Market perception collects market information and analyzes market trends through various channels to provide basic data and guidance for product recommendations. In market perception forecasting, time series methods are mostly used to predict market development trends. By predicting future sales trends and demand changes, companies can better understand market demand and consumer behavior, thereby making more accurate business decisions and promoting sales. In the actual market environment, product sales are often affected by multiple factors, making the market very complex. This also makes sales forecasting gradually more difficult.

[0007] Therefore, accurately predicting product sales becomes a very challenging task, and researchers need to use a variety of methods and models to improve the accuracy of sales forecasts. Summary of the invention

[0008] The present invention aims at solving the above-mentioned deficiencies of the prior art and provides a sales forecasting method with strong practicability.

[0009] A further technical task of the present invention is to provide a sales forecasting device that is reasonably designed, safe and applicable.

[0010] The technical solution adopted by the present invention to solve its technical problem is:

[0011] A sales forecasting method comprises the following steps:

[0012] S1. Collect historical sales data sets and collect and add environmental and economic factors as feature variables;

[0013] S2. Analyze through grey correlation method and select the features with high correlation with sales volume;

[0014] S3, merge the features in step S2 with the original feature set, construct data samples based on the time series, and form the input feature set of the LSTM model;

[0015] S4, split the dataset into training set and test set;

[0016] S5, the mean square error calculated by the actual value and the predicted value of the model is used as the fitness;

[0017] S6, start iterating and use the improved sparrow search algorithm to find the optimal hyperparameters for the model;

[0018] S7, judging whether the set stop condition has been reached;

[0019] S8, retrain to obtain a high-precision LSTM network model;

[0020] S9. Evaluate the prediction effect of the obtained prediction model.

[0021] Further, in step S1, collecting historical sales data sets includes terminal data collection, business system data collection, and macroeconomic data collection;

[0022] The terminal data collection includes information on multiple dimensions including basic attribute dimensions, field dimensions and marketing dimensions of retailers;

[0023] The business system data collection includes the collection of data from the integrated marketing business system, customer relationship management system, and WeChat terminal platform;

[0024] The macroeconomic data collection includes GDP, national consumer prices, unemployment rate, exports and imports.

[0025] Furthermore, in step S4, the data set is divided into a training set and a test set, the training set is used to train the model, and the test set is used to evaluate the performance of the model.

[0026] Furthermore, in step S5, the number of neurons in the hidden layer of LSTM, the network learning rate, the number of training times, the batch size, and the Dropout probability are taken as optimization objects, the value of the hyperparameter is the position of the sparrow, and the mean square error calculated between the actual value and the predicted value of the model is taken as the fitness.

[0027] Further, in step S6, in the improved sparrow search algorithm, centroid reverse learning is used to retain the useful information of the individual;

[0028] The formula for calculating the center of gravity is as follows:

[0029]

[0030] The calculation formula of the inverse solution of the center of gravity is as follows:

[0031]

[0032] Where k is the contraction factor, which is a random number uniformly distributed in the range of [0,1]. Adding a contraction factor can expand the scope of the reverse search space and increase the probability of finding a better solution. During the algorithm iteration process, the center of gravity of the sparrow population after the updated position is reversely mutated.

[0033] Furthermore, in step S7, it is determined whether the set stop condition has been reached. If the stop condition has not been reached, the process returns to step S6 to continue iterating; otherwise, the optimal LSTM model hyperparameters are output.

[0034] Furthermore, in step S8, the optimal hyperparameters obtained by the improved sparrow search algorithm are combined with the LSTM network model of multiple related feature variables introduced into the improved sparrow search algorithm to construct an improved C-LSTM model, which is then retrained to obtain a high-precision LSTM network model.

[0035] Furthermore, in step S9, the trained LSTM model can be used to predict the test set, and the prediction effect of the obtained prediction model can be evaluated by the evaluation index.

[0036] A sales forecasting device, comprising: at least one memory and at least one processor;

[0037] The at least one memory is used to store a machine-readable program;

[0038] The at least one processor is used to call the machine-readable program to execute a sales forecasting method.

[0039] Compared with the prior art, the sales forecasting method and device of the present invention have the following outstanding beneficial effects:

[0040] The present invention uses an improved sparrow search algorithm to optimize the hyperparameters of the LSTM neural network model, thereby obtaining a network model with higher prediction accuracy. In addition, in order to improve the prediction accuracy, multiple characteristic variables that affect sales data are integrated into sales data, and a multivariate model containing relevant prediction characteristic conditions is established. BRIEF DESCRIPTION OF THE DRAWINGS

[0041] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0042] Attached Figure 1 This is an improved C-LSTM model diagram in the sales forecasting method;

[0043] Attached Figure 2 It is a data cleaning chart in the sales forecasting method;

[0044] Attached Figure 3 It is a data processing flow chart in a sales forecasting method;

[0045] Attached Figure 4 It is a detailed distribution diagram of retailers in the sales forecasting method;

[0046] Attached Figure 5It is a schematic diagram of the distribution of retailers across the country in a sales forecasting method. DETAILED DESCRIPTION

[0047] In order to enable those skilled in the art to better understand the solution of the present invention, the present invention is further described in detail below in conjunction with specific implementation methods. Obviously, the described embodiments are only part of the embodiments of the present invention, rather than all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0048] A best embodiment is given below:

[0049] like Figure 1 As shown, a sales forecasting method in this embodiment has the following steps:

[0050] S1. Collect historical sales data sets and collect and add environmental and economic factors as feature variables;

[0051] Collecting historical sales data sets includes terminal data collection, business system data collection, and macroeconomic data collection;

[0052] Terminal data collection includes information on retailers’ basic attributes, fields, and marketing dimensions;

[0053] Business system data collection includes the collection of data from the integrated marketing business system, customer relationship management system, and WeChat terminal platform;

[0054] Macroeconomic data collection includes GDP, national consumer prices, unemployment rate, exports and imports.

[0055] S2. Through the grey correlation method, we can screen out the features with high correlation with sales volume, reduce the dimension of the original data set, and thus reduce the calculation amount of the model.

[0056] S3, merge the features in step S2 with the original feature set, construct data samples based on the time series, and form the input feature set of the LSTM model;

[0057] S4, split the dataset into training set and test set;

[0058] In order to train and test the prediction model in this article, the data set needs to be split into a training set and a test set. The training set is used to train the model, and the test set is used to evaluate the performance of the model.

[0059] S5, the mean square error calculated by the actual value and the predicted value of the model is used as the fitness;

[0060] The number of neurons in the hidden layer of LSTM, network learning rate, number of training times, batch size, and Dropout probability are taken as optimization objects, and the value of the hyperparameter is the position of the sparrow. The mean square error calculated between the actual value and the predicted value of the model is taken as the fitness.

[0061] S6, start iterating and use the improved sparrow search algorithm to find the optimal hyperparameters for the model;

[0062] In the improved sparrow search algorithm, the center of gravity reverse learning is used to retain the useful information of individuals;

[0063] The formula for calculating the center of gravity is as follows:

[0064]

[0065] The calculation formula of the inverse solution of the center of gravity is as follows:

[0066]

[0067] Where k is the contraction factor, which is a random number uniformly distributed in the range of [0,1]. Adding a contraction factor can expand the scope of the reverse search space and increase the probability of finding a better solution. During the algorithm iteration process, the center of gravity of the sparrow population after the updated position is reversely mutated.

[0068] S7, judging whether the set stop condition has been reached;

[0069] If the stopping condition is not met, return to step S6 to continue iteration; otherwise, output the optimal LSTM model hyperparameters.

[0070] S8. The optimal hyperparameters obtained by the improved sparrow search algorithm are retrained to obtain a high-precision LSTM network model;

[0071] S9. Using the trained LSTM model, the test set can be predicted, and the prediction effect of the obtained prediction model can be evaluated through evaluation indicators.

[0072] Among them, the terminal data collection system: the terminal customer information data is collected and entered by the company's data collection personnel through regular visits to retailers and using mobile terminal devices, including the basic attribute dimension of retailers, field dimension, marketing dimension and other dimensional information. Among them, retail customer information mainly includes basic information such as store name, legal person name of the store, specific address of the store, longitude and latitude of the store, as well as business data such as commodity price information, number of purchases, inventory information, etc. The collection and reporting of data is an important part of corporate marketing, which can help companies better understand the needs of retail customers and market trends, so as to formulate more effective market strategies and marketing plans.

[0073] Business system data information: In addition to the information data collected from retailers through terminal devices, the company also operates multiple other business systems, and these systems share business data through data interfaces. This article mainly collects data from the integrated marketing business system, customer relationship management system, and WeChat terminal platform. Among them, the customer relationship management system mainly records the basic information of corporate customers and their distribution across the country, which can be easily managed.

[0074] Macroeconomic data and information: The monthly and quarterly data released by the National Bureau of Statistics contain various economic indicators and statistics, some of which include GDP, national consumer prices, unemployment rate, exports and imports, etc. In addition, there are also some data on population, education, medical care and environment for reference.

[0075] Data collection is one of the important ways for enterprises to obtain key data, which can be divided into two aspects: internal collection and external collection.

[0076] Internal collection refers to collecting data from various data sources within the enterprise, such as from its own databases, files, documents, logs and other data sources. However, internal data has certain limitations. It only reflects the company's own situation and cannot fully understand the external environment such as the market and competitors. In addition, the internal data of the enterprise comes from the same source and lacks diversity, making it difficult to discover new business opportunities.

[0077] External collection refers to obtaining data from various data sources outside the enterprise, such as social media, news websites, government statistics departments, market research companies and other data sources. External collection can also be achieved through data crawlers, API interfaces, purchasing third-party data, etc. Commercially authorized third-party service interfaces provide a more convenient and efficient way. Enterprises can use the API interfaces provided by open platforms such as Baidu and AutoNavi to obtain relevant information. External data comes from a wide range of sources, including various types of data, and is diverse. By adopting these methods, enterprises can quickly obtain key data and discover new business opportunities, such as new markets and new channels.

[0078] The collected multi-source heterogeneous data is temporarily stored in Kafka, and the distributed characteristics of Kafka are used to improve the reliability and durability of data cache.

[0079] With the rapid development of information technology, the amount of data faced by enterprises is increasing, and the impact of data quality is becoming more significant. The original data often has some problems, and may contain various errors, useless, duplicate and incomplete data. It needs to go through data cleaning, data integration, data conversion and data reduction before it can be effectively used.

[0080] (1) Data cleaning

[0081] like Figure 2 As shown in the figure, data cleaning is a very critical step. Due to the huge amount of data, if there is a large amount of erroneous data or duplicate data, it will have a serious impact on the subsequent analysis and mining work. Data cleaning refers to the processing and correction of data, the purpose is to eliminate the noise, outliers, missing values, duplicate values ​​and other erroneous or inconsistent information in the data, so that the data is cleaner and more reliable. In the big data environment, due to the huge amount of data and diverse sources, there may be different formats, encodings, measurements and other problems, so it is necessary to use automated or semi-automated methods for cleaning. The main process of data cleaning includes identifying and correcting data errors, deleting duplicate data, filling missing data, etc. Figure 1 shown.

[0082] Missing value processing methods include deleting data containing missing values ​​and filling missing values ​​(such as using mean, median, mode, etc. to replace missing values, and manual filling); outlier processing methods include deleting outliers and using statistical methods to process outliers; data format normalization includes converting data in different formats to the same format, such as timestamp conversion, character encoding conversion, etc.; data deduplication refers to deleting duplicate data rows or columns in a data set; illegal data processing methods include deleting illegal data and replacing illegal data with appropriate values.

[0083] Data cleaning is an essential step in data preprocessing, which can improve the quality and accuracy of data and reduce errors in subsequent analysis.

[0084] (2) Data conversion

[0085] Data conversion converts raw data into an analyzable format for data mining and analysis. In a big data environment, the format and structure of data are often very complex and need to be converted to be effectively used. Data conversion includes data format conversion, data type conversion, data structure conversion, etc. For example, converting unstructured data into structured data, converting text data into numerical data, etc. The purpose of data conversion is to enable data to be better used and analyzed. The main methods usually include normalization, discretization, clustering, feature selection, feature extraction and other operations.

[0086] With the development of Internet technology, enterprises are facing increasing challenges in dealing with massive data. Traditional data processing technologies often cannot meet this demand. In order to solve the data storage and computing problems faced by enterprises under the growing business volume, this paper introduces the Spark framework to solve the problem of distributed massive data processing, and at the same time realizes efficient data storage and query through the HDFS distributed file storage system. The Spark framework is an efficient distributed computing framework that can execute large-scale data processing tasks in parallel on distributed clusters, thereby effectively improving data processing efficiency. Compared with MapReduce, Spark has a faster processing speed, because MapReduce needs to store data on disk for calculation, which requires more resources on IO transmission. The Spark framework uses memory-based computing technology to quickly store and calculate data in memory, which is more efficient than traditional disk-based computing methods. In addition, Spark's computing model is more flexible than MapReduce, and can adapt to a variety of computing scenarios, making the computing speed faster.

[0087] At the same time, in order to achieve efficient data storage and query, the HDFS distributed file storage system was introduced. The HDFS system can store data in multiple machines, thereby achieving high reliability and high scalability of data. In addition, the HDFS system also supports fast access and query of data, making data processing more efficient.

[0088] When a Spark task needs to read HDFS data, it first obtains HDFS-related configuration information from the Hadoop configuration file, such as the address and port of the NameNode and DataNode, and the root path of the HDFS file system. Then, Spark uses the API to read the HDFS file and convert it into Spark data structures such as RDD or DataFrame to be handed over to the Spark application for further processing. Similarly, when a Spark task needs to write result data to HDFS, Spark uses the Hadoop API to write the data to the specified HDFS file.

[0089] The advantage of combining Spark with HDFS is that it can give full play to the advantages of Spark's high-speed computing power and HDFS's massive data storage capacity to achieve efficient processing and storage of large-scale data. The Spark and HDFS framework can achieve efficient processing and management of large-scale data, improve the efficiency and reliability of enterprise data processing. At the same time, it also provides strong technical support for the future development of enterprises. The data processing flow chart is as follows Figure 3 shown.

[0090] Although the sparrow search algorithm is a swarm intelligence algorithm with advantages such as strong optimization ability and strong robustness, like other common swarm intelligence algorithms, the sparrow search algorithm is also prone to fall into the local optimum during the iteration process, thus affecting the optimization effect and performance of the algorithm. In order to solve this problem, the center of gravity anti-mutation strategy is introduced to enhance the ability of the algorithm to jump out of the local optimum.

[0091] Reverse learning is a classic intelligent optimization algorithm acceleration technology, which selects the best between the current point and its reverse point. Traditional reverse learning explores more solution spaces by calculating reverse points, thereby obtaining higher quality solutions. However, this method only considers local information and does not effectively utilize the information of the entire population, which may lead to limitations in search. Rahnamayan et al. proposed a centroid-based reverse learning, which is an algorithm further developed on the basis of the traditional reverse learning algorithm. The algorithm can be used to combine the search experience of the entire sparrow population, and the information of all individuals in the population can be concentrated and utilized, thereby improving the search efficiency and expanding the scope of exploration of the problem space. The centroid reverse learning enables the useful information of individuals to be retained when the sparrow search algorithm iterates to the later stage, avoiding the decline in the diversity of the population. This allows the sparrow search algorithm to better find the global optimal solution, avoid premature algorithm maturation, and bring better performance.

[0092] The formula for calculating the center of gravity is as follows:

[0093]

[0094] The calculation formula of the inverse solution of the center of gravity is as follows:

[0095]

[0096] Where k is the contraction factor, which is a random number uniformly distributed in the range [0,1]. Adding a contraction factor can expand the scope of the reverse search space and increase the probability of finding a better solution.

[0097] During the algorithm iteration process, the center of gravity of the sparrow population after the updated position is reversely mutated, but it cannot be guaranteed that the position of the sparrow after the mutation will be better than the original position before the mutation. In order to avoid the reduction of optimization efficiency due to too many mutations, the greedy idea is used to decide whether to update the position of the sparrow. Only when the position after the mutation is better than the original position will it be replaced with the new position, otherwise the position after the mutation will be discarded and the original position will be retained. This can effectively avoid the algorithm from falling into unnecessary mutation process, thereby improving the search efficiency of the algorithm.

[0098] LSTM networks have obvious advantages in predicting time series data, but LSTM networks have many hyperparameters, such as the number of network layers, the number of neurons, the learning rate, the batch size, the dropout probability, the number of training times, and the optimization algorithm. Improper selection of these hyperparameters will affect the performance of the prediction model. The selection of hyperparameters usually requires experience and skills. Manual settings may not be able to obtain the optimal solution due to subjective factors, and using methods such as grid search will consume a lot of time.

[0099] This paper uses the improved sparrow algorithm to search for the hyperparameters of the LSTM network model, which can avoid the errors caused by improper hyperparameter selection, thereby improving the accuracy of the network model. The LSTM network model that introduces multiple related feature variables is combined with the improved sparrow search algorithm to construct an improved C-LSTM model.

[0100] Retail distribution Figure 4 , Figure 5 As shown in the figure, the market demands and consumption habits faced by retailers in different regions and types are different. Therefore, companies need to make full use of retail data, segment the market for different retailers, and develop targeted marketing strategies and product innovations to meet their different needs.

[0101] The basic characteristics of retailers are shown in Table 1, and the basic attributes of orders are shown in Table 2.

[0102] Through data mining, machine learning and other technologies, retailer data can be analyzed and modeled, such as cluster analysis, association rule mining, regression analysis, classification algorithms, etc., to discover the similarities and differences between different retailers, predict the purchasing behavior of retailers, and develop more accurate marketing strategies. Enterprises can take the following measures:

[0103] (1) Data mining and analysis: Through data mining and analysis technology, massive retail customer data is processed and analyzed to discover different types of customer groups and their characteristics, thus providing a basis for enterprises to formulate effective marketing strategies.

[0104] (2) Customer segmentation: Retail customers are grouped according to different characteristics, such as region, purchasing power, shopping preferences, etc., and customer groups are further segmented to provide personalized services to different customers.

[0105] (3) Personalized precision marketing: Develop corresponding marketing strategies based on the characteristics and needs of different customer groups, including promotional activities, coupon marketing, etc., to achieve personalized precision marketing.

[0106] (4) Use of digital technology: By using digital technology such as social media and mobile applications, we can establish closer ties with customers and improve customer loyalty and satisfaction.

[0107] In summary, it is very important for enterprises to identify the value of retail customers and implement personalized precision marketing. When processing massive retail customer data, it is necessary to use modern information technology means and take corresponding measures and strategies to create more value for enterprises.

[0108] Table 1 Retailer attributes

[0109]

[0110]

[0111] Table 2

[0112]

[0113] Based on the above method, a sales volume forecasting device in this embodiment includes: at least one memory and at least one processor;

[0114] The at least one memory is used to store a machine-readable program;

[0115] The at least one processor is used to call the machine-readable program to execute a sales forecasting method.

[0116] The above-mentioned specific implementations are only specific cases of the present invention. The patent protection scope of the present invention includes but is not limited to the above-mentioned specific implementations. Any technical solutions that conform to the above-mentioned specific implementations of the present invention and any appropriate changes or substitutions made by ordinary technicians in the relevant technical field shall fall within the patent protection scope of the present invention.

[0117] Although embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that various changes, modifications, substitutions and variations may be made to the embodiments without departing from the principles and spirit of the present invention, and that the scope of the present invention is defined by the appended claims and their equivalents.

Claims

1. A sales forecasting method, characterized in that: The steps are as follows: S1. Collect historical sales data sets and collect and add environmental and economic factors as feature variables; S2. Analyze through grey correlation method and select the features with high correlation with sales volume; S3, merge the features in step S2 with the original feature set, construct data samples based on the time series, and form the input feature set of the LSTM model; S4, split the dataset into training set and test set; S5, the mean square error calculated by the actual value and the predicted value of the model is used as the fitness; S6, start iterating and use the improved sparrow search algorithm to find the optimal hyperparameters for the model; S7, judging whether the set stop condition has been reached; S8, retrain to obtain a high-precision LSTM network model; S9. Evaluate the prediction effect of the obtained prediction model.

2. A sales forecasting method according to claim 1, characterized in that: In step S1, collecting historical sales data sets includes terminal data collection, business system data collection and macroeconomic data collection; The terminal data collection includes information on multiple dimensions including basic attribute dimensions, field dimensions and marketing dimensions of retailers; The business system data collection includes the collection of data from the integrated marketing business system, customer relationship management system, and WeChat terminal platform; The macroeconomic data collection includes GDP, national consumer prices, unemployment rate, exports and imports.

3. A sales forecasting method according to claim 2, characterized in that: In step S4, the data set is divided into a training set and a test set. The training set is used to train the model, and the test set is used to evaluate the performance of the model.

4. A sales forecasting method according to claim 3, characterized in that: In step S5, the number of neurons in the hidden layer of LSTM, the network learning rate, the number of training times, the batch size, and the Dropout probability are taken as optimization objects. The value of the hyperparameter is the position of the sparrow, and the mean square error calculated between the actual value and the predicted value of the model is taken as the fitness.

5. A sales forecasting method according to claim 4, characterized in that: In step S6, in the improved sparrow search algorithm, centroid reverse learning is used to retain the useful information of the individual; The formula for calculating the center of gravity is as follows: The calculation formula of the inverse solution of the center of gravity is as follows: Where k is the contraction factor, which is a random number uniformly distributed in the range of [0,1]. Adding a contraction factor can expand the scope of the reverse search space and increase the probability of finding a better solution. During the algorithm iteration process, the center of gravity of the sparrow population after the updated position is reversely mutated.

6. A sales forecasting method according to claim 5, characterized in that: In step S7, it is determined whether the set stop condition has been reached. If the stop condition has not been reached, the process returns to step S6 to continue iterating; otherwise, the optimal LSTM model hyperparameters are output.

7. A sales forecasting method according to claim 6, characterized in that: In step S8, the optimal hyperparameters obtained by the improved sparrow search algorithm are combined with the LSTM network model that introduces multiple related feature variables and the improved sparrow search algorithm to construct an improved C-LSTM model, which is retrained to obtain a high-precision LSTM network model.

8. A sales forecasting method according to claim 7, characterized in that: In step S9, the trained LSTM model can be used to predict the test set, and the prediction effect of the obtained prediction model can be evaluated by the evaluation index.

9. A sales forecasting device, characterized in that: include: at least one memory and at least one processor; The at least one memory is used to store a machine-readable program; The at least one processor is configured to call the machine-readable program to execute the method according to any one of claims 1 to 8.