A Product Sales Forecasting Method and System Based on Intelligent Extraction and Integration Learning of Date Features from a Dual Calendar System
By using intelligent extraction of date features from dual calendar systems and ensemble learning with AdaBoost, this method solves the problems of neglecting lunar calendar factors, imprecise trend factors, and insufficient prediction accuracy of single models in existing technologies, thus achieving high-precision commodity sales forecasting.
Patent Information
- Application Number
- CN202611311473.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-08-27
- Publication Date
- 2026-11-17
AI Technical Summary
Existing time series forecasting methods ignore lunar calendar factors when processing date features, do not handle trend factors with sufficient precision, have limited prediction accuracy of single models, lack the application of ensemble learning, and are difficult to adapt to complex nonlinear and dynamic changes.
We employ intelligent extraction of date features using a dual-calendar system, combining solar and lunar calendar systems. Through AdaBoost ensemble learning, we dynamically extract trend factors using ARIMA, Holt-Winters, Prophet, LSTM, and Transformer models for multi-model ensemble prediction.
It improves the model's generalization ability and prediction accuracy, accurately captures long-term trends and short-term fluctuations in sales data, adapts to holidays and seasonal changes in different cultural backgrounds, and significantly enhances prediction accuracy and stability.
Smart Images

Figure FT_1 
Figure FT_2 
Figure FT_3
Abstract
Description
Technical Field
[0001] This invention relates to the field of commodity sales forecasting technology, and in particular to a commodity sales forecasting method and system based on intelligent extraction and integrated learning of date features from dual calendars. Background Technology
[0002] Univariate time series forecasting requires only time and the data itself for prediction, and is widely used in sales forecasting, financial market trend analysis, and energy demand forecasting due to its ease of acquisition and operation. However, in practical applications, univariate time series forecasting faces significant challenges.
[0003] In existing technologies, time series forecasting methods are mainly divided into three categories: statistical methods (such as ARIMA models, Holt-Winters models, and grey models), artificial intelligence methods (such as Prophet models, LSTM models, and Transformer models), and combined model methods. Each of these methods has the following shortcomings: (i) Single models have limited predictive accuracy. While statistical methods have a solid theoretical foundation and strong interpretability, they are usually based on linear assumptions and struggle to capture complex nonlinear relationships and dynamic changes. Although artificial intelligence methods have strong nonlinear modeling capabilities, their models are complex, training and inference are slow, and they are often considered "black box models" with difficult-to-interpret internal decision-making processes. Single models often cannot simultaneously address the modeling needs of trends, seasonality, and random fluctuations, resulting in limited accuracy and generalization ability of prediction results.
[0004] (ii) Outdated date feature processing methods; holidays in different countries and regions have a significant impact on sales data, and the impact of holidays on sales varies depending on the product category. Existing methods typically require manually listing and encoding holidays one by one when processing date features, which not only increases the workload of researchers but also limits the generalization ability of the model. In particular, for sales data in the context of Chinese culture, traditional holidays such as the Spring Festival, Mid-Autumn Festival, and Dragon Boat Festival, which are calculated according to the lunar calendar, have a significant impact on sales, but most existing methods only consider the Gregorian calendar date, ignoring the importance of the lunar calendar date feature.
[0005] (iii) The processing of trend factors is not refined enough; the market environment changes rapidly, and consumer preferences and market demands are constantly evolving, making trend modeling of time series data complex. Existing methods usually require manual extraction of trend factors or rely on the built-in trend processing functions of the model (such as the piecewise linear trend of the Prophet model) when processing trend changes, which lacks flexibility and adaptability and is difficult to dynamically adjust according to data characteristics.
[0006] (iv) Insufficient application of ensemble learning in time series forecasting; Although ensemble learning has been widely used in classification and regression problems, in time series forecasting, due to the time-series data having temporal dependencies, traditional ensemble methods such as Bagging will destroy the time order, and the application of existing Boosting-based ensemble methods in time series forecasting is still relatively limited, lacking specific optimization for time series characteristics.
[0007] In summary, existing technologies urgently need a product sales forecasting method that can automatically and intelligently extract date features (especially considering both solar and lunar calendars), finely process trend factors, and integrate the advantages of multiple models through ensemble learning. Summary of the Invention
[0008] To address the problems existing in the prior art, this invention provides a product sales forecasting method and system based on intelligent extraction and ensemble learning of date features using both solar and lunar calendar systems. This method intelligently extracts date features, automatically identifies holidays and seasonal changes, and enables the model to flexibly capture sales patterns under different cultural backgrounds. It also reduces manual intervention and improves the model's generalization ability and prediction accuracy.
[0009] In a first aspect, embodiments of the present invention provide a product sales forecasting method based on intelligent extraction and ensemble learning of dual-calendar date features, including: Obtain univariate time series data of product sales, wherein the univariate time series data includes historical sales data and corresponding date information; Trend factor processing is performed on univariate time series data to obtain the trend factor corresponding to the univariate time series data; Extracting date features from univariate time series data using both solar and lunar calendars; including mapping each date to both the solar and lunar calendars simultaneously, and extracting predetermined types of feature dates from each calendar system. Based on the extracted feature dates and the univariate time series data, the seasonal factor for each feature date is calculated, and the sales data for the feature dates in the univariate time series data are seasonally adjusted using the seasonal factor to obtain seasonally adjusted data. The seasonally adjusted data were input into different base forecasting models to obtain multiple initial forecast results; An ensemble algorithm is used to integrate multiple initial prediction results to obtain an ensemble prediction result. Sales forecast results are obtained based on integrated forecast results, corresponding seasonal factors, and trend factors.
[0010] Preferred methods for trend factor processing of univariate time series data include: The univariate time series data is accumulated and processed to obtain stationary series data; The ARIMA model is used to predict the trend components in the accumulated stationary series data. Trend curves are obtained by curve fitting the trend component data in stationary series data. The trend factor corresponding to the univariate time series data is obtained based on the trend curve.
[0011] Preferably, the characteristic date includes both a Gregorian calendar characteristic date and a lunar calendar characteristic date; The Gregorian calendar characteristic date includes at least: Gregorian year, Gregorian month, Gregorian day, Gregorian year-month-day, Gregorian year-month, Gregorian month-day, weekday, which week of the month, and the i-th week of the i-th month; The lunar calendar characteristic date includes at least: lunar year, lunar month, lunar day, lunar year-month-day, lunar year-month, and lunar month-day.
[0012] Preferably, the method for calculating the seasonal factor for each characteristic date includes: Use sales data from univariate time series data and sales data corresponding to characteristic dates to obtain average daily sales and sales data for characteristic dates; Identify the influencing factors of characteristic dates based on sales data and average daily sales data for characteristic dates; Seasonal factors are obtained based on the influence factors of all characteristic dates; The sales data corresponding to the characteristic dates in the univariate time series data are adjusted using the obtained seasonal factors to obtain the adjusted seasonally adjusted data.
[0013] Preferably, the basic prediction model includes at least the ARIMA model, Holt-Winters model, Prophet model, LSTM model, and Transformer model.
[0014] Preferably, the ensemble learning algorithm is the AdaBoost algorithm, comprising: The prediction results of each base model are used as the output of the weak learner; Through iterative training, the sample weights are dynamically adjusted based on the prediction performance of each weak learner. Weak learners with better prediction performance are assigned higher weights, while weak learners with poorer prediction performance are assigned lower weights. The weighted predictions of all weak learners are combined to form the final prediction of the strong learner.
[0015] Preferably, before inputting the seasonally adjusted data into different base forecasting models, the seasonally adjusted data is processed as follows: A grey model based on particle swarm optimization algorithm is used to preprocess the seasonally adjusted data. The grey model is used to weaken the volatility of the data, generate upper and lower bound predicted values of the data, and construct confidence intervals.
[0016] Secondly, a commodity sales forecasting system based on intelligent extraction and ensemble learning of date features from a dual-calendar system includes: The data acquisition module is used to acquire univariate time series data of commodity sales, which includes historical sales data and corresponding date information; The trend factor processing module is used to process univariate time series data with trend factors to obtain the trend factor corresponding to the univariate time series data. The feature date extraction module performs dual-calendar date feature extraction on univariate time series data; including: mapping each date to both the Gregorian and lunar calendar systems, and extracting predetermined types of feature dates from each calendar system respectively; The seasonal factor processing module calculates the seasonal factor for each characteristic date based on the extracted characteristic dates and the univariate time series data, and uses the seasonal factor to seasonally adjust the sales data of the characteristic dates in the univariate time series data to obtain seasonally adjusted data. The basic forecast module inputs seasonally adjusted data into different basic forecast models to obtain multiple initial forecast results; The integration module uses an integration algorithm to integrate multiple initial prediction results to obtain an integrated prediction result; The results prediction module obtains sales forecast results based on integrated forecast results, corresponding seasonal factors, and trend factors.
[0017] Thirdly, an electronic device includes: One or more processors; Memory, used to store one or more programs; When the one or more programs are executed by the one or more processors, the one or more processors implement the product sales forecasting method based on intelligent extraction and ensemble learning of dual calendar date features.
[0018] Fourthly, a computer-readable medium storing a computer program that, when executed by a processor, implements the aforementioned method for predicting commodity sales based on intelligent extraction and ensemble learning of dual-calendar date features.
[0019] The beneficial effects of this invention are as follows: This invention, through the comprehensive application of intelligent extraction of date features using a dual calendar system, refined trend factor processing, and AdaBoost ensemble learning, can accurately capture the long-term trends and short-term fluctuations of sales data. Experimental results show that the correlation coefficient between the predicted and actual values can be improved to over 0.86 (e-commerce platform data) and over 0.93 (mobile phone parts data), with a directional accuracy of 1.0. This indicates that the correlation between the predicted results and the actual data is significantly enhanced, and the direction of data change can be predicted completely and accurately.
[0020] This invention incorporates both the Gregorian and lunar calendars, extracting fifteen date features to enable the model to automatically identify holidays and seasonal changes in different cultural contexts. This eliminates the need for manually listing and encoding holidays, significantly reducing the workload for researchers and improving the model's generalization ability and cross-cultural adaptability.
[0021] This invention combines a comprehensive trend extraction method using grey model, ARIMA model, and multinomial fitting. It dynamically extracts trend factors through steps such as cumulative generation, ARIMA prediction, and curve fitting, effectively balancing trends and random fluctuations in the data. This method replaces the built-in trend processing function in models such as Prophet and improves the model's adaptability to trend changes.
[0022] The AdaBoost algorithm is used to integrate five basic models and their combination with the grey model. Through iterative training and dynamic weight allocation, the advantages of each model are fully utilized, the shortcomings of a single model are made up for, and the accuracy and stability of prediction are significantly improved. Attached Figure Description
[0023] Figure 1 A flowchart illustrating a product sales forecasting method based on intelligent extraction and ensemble learning of date features using a dual calendar system, provided as an embodiment of the present invention; Figure 2 This is a structural block diagram of a commodity sales forecasting system based on intelligent extraction and ensemble learning of date features using a dual calendar system, as described in an embodiment of the present invention. Figure 3 This is a structural block diagram of an electronic device provided in an embodiment of the present invention. Detailed Implementation
[0024] To enable those skilled in the art to better understand the technical solutions of the present invention, exemplary embodiments of the present invention are described below in conjunction with the accompanying drawings, including various details of the embodiments of the present invention to aid understanding. These should be considered merely exemplary. Therefore, those skilled in the art should recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of the present invention. Similarly, for clarity and brevity, descriptions of well-known functions and structures are omitted in the following description.
[0025] Where there is no conflict, the various embodiments of the present invention and the features thereof may be combined with each other.
[0026] As used herein, the term “and / or” includes any and all combinations of one or more related enumerated entries.
[0027] The terminology used herein is for the purpose of describing particular embodiments only and is not intended to limit the invention. As used herein, the singular forms “a” and “the” are intended to include the plural forms as well, unless the context clearly indicates otherwise. It will also be understood that when the terms “comprising” and / or “made of” are used in this specification, the presence of the stated feature, integral, step, operation, element, and / or component is specified, but the presence or addition of one or more other features, integrals, steps, operations, elements, components, and / or groups thereof is not excluded. Terms such as “connected” or “linked” are not limited to physical or mechanical connections but can include electrical connections, whether direct or indirect.
[0028] Unless otherwise specified, all terms used herein (including technical and scientific terms) have the same meaning as commonly understood by one of ordinary skill in the art. It will also be understood that terms such as those defined in commonly used dictionaries should be interpreted as having the meaning consistent with their meaning in the context of the relevant art and the invention, and will not be interpreted as having an idealized or overly formal meaning unless expressly so defined herein.
[0029] In the technical solution of this invention, the collection, storage, use, processing, transmission, provision, and disclosure of user personal information all comply with relevant laws and regulations and do not violate public order and good morals. The use of user data in this technical solution follows relevant national laws and regulations (e.g., the "Information Security Technology - Personal Information Security Specification"). For example: appropriate measures are taken for personal information access control; restrictions are imposed on the display of personal information; the purpose of using personal information does not exceed the scope of direct or reasonable association; and explicit identity targeting is eliminated when using personal information to avoid precisely locating a specific individual. Example
[0030] like Figure 1 As shown, this embodiment provides a product sales forecasting method based on intelligent extraction and ensemble learning of date features from a dual-calendar system; including: S1. Obtain univariate time series data of commodity sales, wherein the univariate time series data includes historical sales data and corresponding date information; in this embodiment, after obtaining the data, the univariate time series data is cleaned, missing values are filled in, and the obtained data is divided into training set and test set; S2. Perform trend factor processing on the univariate time series data to obtain the trend factor corresponding to the univariate time series data; This embodiment includes the following specific methods for trend factor processing of univariate time series data: Trend factor processing is performed on univariate time series data to obtain the corresponding trend factor. This step specifically includes: S201. Accumulation Generation (AGO) is a process that accumulates univariate time series data to transform non-stationary series into stationary series, reducing random fluctuations in the data and making the underlying trend more apparent.
[0031] S202. ARIMA Model Prediction: The ARIMA model is used to predict the stationary sequence data after accumulation. Specifically, by turning off the trend function of the ARIMA model (such as setting the difference order d=0 or restricting the model to a pure moving average form), it focuses on the prediction of the random components, thereby obtaining the random components in the stationary sequence data.
[0032] S203. Obtain trend components: Obtain trend component data based on the difference between the stationary sequence data and the random components; S204. Curve Fitting: Perform curve fitting on the trend component data; based on the characteristics of the data, select at least one of linear function, quadratic function, exponential function or logistic function for fitting, use the least squares method for parameter estimation, select the optimal fitting function by calculating the sum of squared residuals, and extract the trend curve.
[0033] S205. Calculate the trend factor: Obtain the trend factor corresponding to the univariate time series data based on the fitted trend curve. The trend factor represents a quantitative measure of the trend of sales volume or sales revenue for each date.
[0034] In another embodiment, the accumulated stationary sequence data, whose trend components are obtained through the difference operation in step 203, and the curve fitting in step 204 make the extracted trend curve smoother and more stable, avoiding the interference of random fluctuations in the data on the extraction of trend factors.
[0035] S3. Extract date features from univariate time series data using both calendar systems; including: mapping each date to both the Gregorian and lunar calendars, and extracting predetermined types of feature dates from each calendar system; In this embodiment, the characteristic date includes both the Gregorian calendar characteristic date and the lunar calendar characteristic date; The Gregorian calendar characteristic dates are extracted from Gregorian calendar dates and include nine types of Gregorian calendar characteristic dates: Gregorian year, Gregorian month, Gregorian day, Gregorian year-month-day, Gregorian year-month, Gregorian month-day, weekday, which week of each month, and the i-th week of the i-th month. The lunar calendar characteristic dates are extracted from lunar calendar dates; including: six types of lunar calendar characteristic dates: lunar year, lunar month, lunar day, lunar year-month-day, lunar year-month, and lunar month-day. The extraction of the above fifteen date features enables the model to automatically identify Gregorian calendar holidays (such as New Year's Day and National Day) and traditional lunar calendar holidays (such as Spring Festival, Mid-Autumn Festival, and Dragon Boat Festival) without the need for manual listing and coding.
[0036] S4. Calculate the seasonal factor for each characteristic date based on the extracted characteristic dates and the univariate time series data, and use the seasonal factor to seasonally adjust the sales data of the characteristic dates in the univariate time series data to obtain seasonally adjusted data; The specific methods in this step include: S401. Calculate the average sales volume for all days as a baseline; S402. For each characteristic date type extracted in step S3, calculate the ratio of the average sales volume of that characteristic date type to the benchmark value, as the influence factor for that characteristic date type; the formula for calculating the influence factor is: F_Featured Date Type = Average Sales Volume Meeting This Featured Date Type / Average Sales Volume of All Dates S403. For each characteristic date, calculate the sum of the influence factors corresponding to all its characteristic date types, divide by the total number of characteristic date types, and obtain the seasonal factor for that characteristic date. The formula for calculating the seasonal factor is:
[0037] In the formula: where, Seasonal factors; Let n be the influence factor for the i-th characteristic date type, and n be the total number of characteristic date types; in this embodiment, n=15.
[0038] The seasonal factor is used to adjust the sales data for corresponding dates in univariate time series data: the original sales volume of each characteristic date is divided by the corresponding seasonal factor to obtain seasonally adjusted data, thereby eliminating the effects of seasonality and periodicity.
[0039] S5. Input the seasonally adjusted data into different basic forecast models to obtain multiple initial forecast results; The basic prediction models in this embodiment include at least the ARIMA model, Holt-Winters model, Prophet model, LSTM model, and Transformer model; wherein: ARIMA model: used to capture linear trends and autocorrelation in time series.
[0040] Holt-Winters model: used to capture the horizontal, trend, and seasonal components in time series.
[0041] The Prophet model is used to handle nonlinear trends and complex seasonality. It is based on an additive regression model and consists of a trend term, a periodic term, a holiday term, and an error term.
[0042] LSTM model: Long Short-Term Memory network, which controls the flow of information through forget gate, input gate and output gate to capture long-term dependencies in time series.
[0043] Transformer model: Based on self-attention mechanism, it extracts input features in parallel through multi-head attention to capture complex temporal dependencies.
[0044] The parameters of each basic model were optimized using the Bayesian optimization algorithm.
[0045] The seasonally adjusted data are input into each basic forecasting model for prediction, and the prediction results of each basic model are obtained. S6. The multiple initial prediction results are integrated using an ensemble algorithm to obtain the integrated prediction result; This embodiment integrates the prediction results of various models (including base models and combined models) using the AdaBoost ensemble learning algorithm, including: S601. Use the prediction results of each model as the output of the weak learner.
[0046] S602. Multiple weak learners are trained iteratively, each of which is designed to correct the errors made by the previous learner on the training data.
[0047] S603. Dynamically adjust the sample weights based on the prediction performance of each weak learner, and assign greater weights to samples that are predicted incorrectly.
[0048] S604. Assign higher weights to weak learners with better prediction performance and lower weights to weak learners with poorer prediction performance.
[0049] S605. Combine the weighted prediction results of all weak learners to form the final prediction result of the strong learner.
[0050] S7. Obtain sales forecast results based on integrated forecast results, corresponding seasonal factors, and trend factors; specifically, multiply the obtained integrated forecast results by the corresponding seasonal factors and add the corresponding trend factors in sequence to obtain the final sales forecast results.
[0051] In one embodiment, the method further includes grey model preprocessing; preprocessing the obtained seasonally adjusted data using a grey model improved based on particle swarm optimization algorithm, including: The preprocessed data is normalized so that all values are between 0 and 1; Initialize the particle swarm, where each particle represents a combination of parameters from the gray prediction model; By iteratively updating the position and velocity of particles, the particles update their position and velocity based on the individual optimal solution and the global optimal solution, thus searching for the optimal parameters; An improved GM(1,1) grey prediction model is constructed using the optimized parameters; A fitness function is defined to evaluate the quality of a particle's position. The fitness function comprehensively considers the degree of matching between the predicted value and the actual value, as well as the closeness of the predicted values to the upper and lower bounds. By using optimized grey model parameters, upper and lower bound predicted values of the data are generated, and confidence intervals of the data are constructed to smooth out fluctuations in the data.
[0052] The data after gray model preprocessing are also input into the basic model for prediction to obtain the basic prediction results. Example
[0053] This embodiment provides an application of a product sales forecasting method based on intelligent extraction and ensemble learning of dual calendar date features in sales volume forecasting on an e-commerce platform.
[0054] 1. Data Preparation We obtained daily sales data from a certain e-commerce platform for the past six years, spanning from August 1, 2016 to November 5, 2021. The data includes fields such as sales volume, sales amount (RMB), and date. In the data preprocessing stage, the data was cleaned, including filling in missing values, and the data was divided into training and testing sets, with the training set comprising 80% of the total data and the testing set comprising 20%.
[0055] 2. Trend Factor Processing Trend factor processing is performed according to step S2 in Example 1: First, the original time series data is accumulated and generated to convert the non-stationary series into a stationary series.
[0056] Secondly, the ARIMA model is used to predict the accumulated stationary sequence data. By disabling the trend function of the ARIMA model, it is made to focus on the prediction of the random component, thus obtaining the random component in the stationary sequence data. The trend component data is obtained based on the difference between the stationary sequence data and the random component.
[0057] Next, curve fitting is performed on the trend component data. Based on the data characteristics, a linear function, quadratic function, exponential function, or logistic function is selected for fitting. Parameter estimation is performed using the least squares method, and the optimal fitting function is selected by calculating the sum of squared residuals to extract the trend curve.
[0058] Next, the trend factor corresponding to each date is calculated based on the fitted trend curve.
[0059] 3. Intelligent extraction of date features from dual calendar systems Date feature extraction is performed according to step S3 in Example 1: Each date is mapped to both the Gregorian and Lunar calendar systems. For example, January 1, 2017: The characteristics of the Gregorian calendar include: Gregorian year = 2017, Gregorian month = 01, Gregorian day = 01, Gregorian year-month-day = 2017-01-01, Gregorian year-month = 2017-01, Gregorian month-day = 01-01, weekday = 7 (Sunday), which week of the month = 1, and the i-th week of the i-th month = 0101.
[0060] The lunar calendar features include: Lunar year = 2016, Lunar month = 12 (the twelfth lunar month), Lunar day = 04 (the fourth day of the first lunar month), Lunar year, month and day = 2016-12-04, Lunar year and month = 2016-12, Lunar month and day = 12-04 (the fourth day of the twelfth lunar month).
[0061] By extracting the above fifteen date features, the model can automatically identify the impact of holidays such as New Year's Day and Spring Festival on sales.
[0062] 4. Seasonal factor treatment Seasonal factor processing was performed according to the method in step S4 of Example 1: First, calculate the average sales volume for all days as a baseline.
[0063] Secondly, for each characteristic date type, the ratio of the average sales volume satisfying that characteristic date type to the benchmark value is calculated, which serves as the influencing factor for that characteristic date type.
[0064] Then, for each characteristic date, the sum of the influence factors corresponding to all its characteristic date types is calculated and divided by 15 to obtain the seasonal factor of that characteristic date.
[0065] Finally, the original sales volume for each characteristic date is divided by the corresponding seasonal factor to obtain the seasonally adjusted data.
[0066] 5. Basic Model Construction and Prediction Five basic prediction models were constructed: ARIMA, Holt-Winters, Prophet, LSTM, and Transformer. The parameters of each model were optimized using a Bayesian optimization algorithm.
[0067] The seasonally adjusted data were input into each of the basic forecasting models for prediction, and the prediction results of each basic model were obtained.
[0068] Meanwhile, a grey model based on particle swarm optimization algorithm is used to preprocess the seasonally adjusted data, and then the preprocessed data is input into each basic model for prediction to obtain the prediction results of the combined model.
[0069] 6. Ensemble learning The AdaBoost ensemble learning algorithm is used to integrate the prediction results of all the above models (including five basic models and five combined models, for a total of ten models): Multiple weak learners are trained iteratively, and the sample weights are dynamically adjusted according to the prediction performance of each weak learner. Weak learners with better prediction performance are given higher weights, and weak learners with poor prediction performance are given lower weights. The weighted prediction results of all weak learners are combined to form the final prediction result of the strong learner.
[0070] 7. Result Restoration and Evaluation The final sales forecast is obtained by multiplying the prediction result obtained from ensemble learning by the corresponding seasonal factor and adding the corresponding trend factor.
[0071] Experimental results show that the prediction method of the present invention performs well on sales data of e-commerce platforms: the correlation coefficient between the predicted value and the actual value reaches 0.864, and the directional accuracy reaches 1.0, indicating that there is a strong positive correlation between the prediction result and the actual data, and the direction of change of the predicted value is completely consistent with the direction of change of the actual value in all time periods.
[0072] 8. Rolling Forecast Validation To verify the practicality of this invention in real-world business scenarios, a 7-day rolling forecasting method was used. In each forecasting period, only historical data prior to the current date was used for training to predict sales for the next 7 days. The forecast results were then fed back into the training set for the next period's forecast.
[0073] The results show that the model performs well in short-term forecasts (1-4 days), with low average MAE and RMSE. The model is able to capture the trend and fluctuation of the data well in most forecast periods, which verifies the effectiveness and stability of the invention in practical applications. Example
[0074] This embodiment provides an application of the method of the present invention in predicting the sales volume of mobile phone parts for a certain brand.
[0075] 1. Data Preparation We obtained sales data for mobile phone parts from a specific brand, covering daily sales from January 1, 2019 to June 30, 2024, totaling 2008 days of data records. We then conducted in-depth analysis of data from the "parts" category under the "mobile phone" group across all regions.
[0076] 2. Prediction and Assessment The same steps as in Example 2 were used for trend factor processing, intelligent extraction of dual calendar date features, seasonal factor processing, basic model construction and prediction, grey model preprocessing, ensemble learning and result restoration.
[0077] Experimental results show that the prediction method of this invention also performs well on mobile phone parts sales data: the correlation coefficient of the Prophet model combined with date features reaches 0.80; after AdaBoost ensemble learning, the correlation coefficient between the predicted value and the true value reaches 0.93, and the directional accuracy reaches 1.0. This indicates that the method of this invention has good predictive performance and generalization ability on sales data of different types and time spans. Example
[0078] like Figure 2 As shown, a product sales forecasting system based on intelligent extraction and ensemble learning of date features from dual calendars includes: The data acquisition module is used to acquire univariate time series data of commodity sales, which includes historical sales data and corresponding date information; The trend factor processing module is used to process univariate time series data with trend factors to obtain the trend factor corresponding to the univariate time series data. The feature date extraction module performs dual-calendar date feature extraction on univariate time series data; including: mapping each date to both the Gregorian and lunar calendar systems, and extracting predetermined types of feature dates from each calendar system respectively; The seasonal factor processing module calculates the seasonal factor for each characteristic date based on the extracted characteristic dates and the univariate time series data, and uses the seasonal factor to seasonally adjust the sales data of the characteristic dates in the univariate time series data to obtain seasonally adjusted data. The basic forecast module inputs seasonally adjusted data into different basic forecast models to obtain multiple initial forecast results; The integration module uses an integration algorithm to integrate multiple initial prediction results to obtain an integrated prediction result; The results prediction module obtains sales forecast results based on integrated forecast results, corresponding seasonal factors, and trend factors. Data visualization module: Using ECharts, it displays comparative analysis of historical sales data and forecast results in various chart formats such as line charts and bar charts.
[0079] User management module: Provides user registration, login, and permission management functions to ensure data security and privacy.
[0080] Data Management Module: Supports uploading, storing, viewing, and deleting data files in various formats.
[0081] Based on the same inventive concept, embodiments of the present invention also provide an electronic device. Figure 3 This is a structural block diagram of an electronic device provided in an embodiment of the present invention. Figure 3 As shown, an embodiment of the present invention provides an electronic device including: one or more processors 101, a memory 102, and one or more I / O interfaces 103. The memory 102 stores one or more programs, which, when executed by the one or more processors, enable the one or more processors to implement any of the product sales forecasting methods based on intelligent extraction and ensemble learning of dual-calendar date features as described in the above embodiments; the one or more I / O interfaces 103 are connected between the processor and the memory, configured to enable information interaction between the processor and the memory.
[0082] The processor 101 is a device with data processing capabilities, including but not limited to a central processing unit (CPU); the memory 102 is a device with data storage capabilities, including but not limited to random access memory (RAM, more specifically SDRAM, DDR, etc.), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), and flash memory (FLASH); the I / O interface (read / write interface) 103 is connected between the processor 101 and the memory 102, and can realize information interaction between the processor 101 and the memory 102, including but not limited to a data bus (Bus).
[0083] In some embodiments, the processor 101, memory 102, and I / O interface 103 are interconnected via bus 104, and thus connected to other components of the computing device.
[0084] In some embodiments, the one or more processors 101 include a field-programmable gate array.
[0085] This invention also provides a computer-readable medium. The computer-readable medium stores a computer program, which, when executed by a processor, implements the steps of any of the commodity sales forecasting methods based on intelligent extraction and ensemble learning of dual-calendar date features as described in the above embodiments. The computer-readable storage medium can be volatile or non-volatile.
[0086] This invention also provides a computer program product, including computer-readable code, or a non-volatile computer-readable storage medium carrying computer-readable code. When the computer-readable code is run in the processor of an electronic device, the processor in the electronic device executes the above-described product sales forecasting method based on intelligent extraction and integrated learning of dual-calendar date features.
[0087] Those skilled in the art will understand that all or some of the steps, systems, and apparatuses disclosed above, and their functional modules / units, can be implemented as software, firmware, hardware, or suitable combinations thereof. In hardware implementations, the division between functional modules / units mentioned above does not necessarily correspond to the division of physical components; for example, a physical component may have multiple functions, or a function or step may be performed collaboratively by several physical components. Some or all physical components may be implemented as software executed by a processor, such as a central processing unit, digital signal processor, or microprocessor, or as hardware, or as an integrated circuit, such as an application-specific integrated circuit (ASIC). Such software can be distributed on a computer-readable storage medium, which may include computer storage media (or non-transitory media) and communication media (or transient media).
[0088] As is known to those skilled in the art, the term computer storage medium includes volatile and non-volatile, removable and non-removable media implemented in any method or technology for storing information, such as computer-readable program instructions, data structures, program modules, or other data. Computer storage media includes, but is not limited to, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM), static random access memory (SRAM), flash memory or other memory technologies, portable compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical disc storage, magnetic cartridges, magnetic tape, disk storage or other magnetic storage devices, or any other medium that can be used to store desired information and is accessible to a computer. Furthermore, it is known to those skilled in the art that communication media typically contain computer-readable program instructions, data structures, program modules, or other data in modulated data signals such as carrier waves or other transmission mechanisms, and may include any information delivery medium.
[0089] The computer-readable program instructions described herein can be downloaded from computer-readable storage media to various computing / processing devices, or downloaded via a network, such as the Internet, local area network, wide area network, and / or wireless network, to an external computer or external storage device. The network may include copper transmission cables, fiber optic transmission, wireless transmission, routers, firewalls, switches, gateway computers, and / or edge servers. A network adapter card or network interface in each computing / processing device receives the computer-readable program instructions from the network and forwards them to the computer-readable storage media in the respective computing / processing device.
[0090] The computer program instructions used to perform the operations of this invention may be assembly instructions, instruction set architecture (ISA) instructions, machine instructions, machine-dependent instructions, microcode, firmware instructions, state setting data, or source code or object code written in any combination of one or more programming languages, including object-oriented programming languages such as Smalltalk, C++, etc., and conventional procedural programming languages such as the "C" language or similar programming languages. The computer-readable program instructions may be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving a remote computer, the remote computer may be connected to the user's computer via any type of network—including a local area network (LAN) or a wide area network (WAN)—or may be connected to an external computer (e.g., via the Internet using an Internet service provider). In some embodiments, electronic circuitry, such as programmable logic circuitry, field-programmable gate arrays (FPGAs), or programmable logic arrays (PLAs), is personalized by utilizing state information from the computer-readable program instructions. This electronic circuitry can execute the computer-readable program instructions to implement various aspects of the invention.
[0091] The computer program product described herein can be implemented specifically through hardware, software, or a combination thereof. In one alternative embodiment, the computer program product is specifically embodied in a computer storage medium; in another alternative embodiment, the computer program product is specifically embodied in a software product, such as a software development kit (SDK), etc.
[0092] Various aspects of the present invention are described herein with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It should be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer-readable program instructions.
[0093] These computer-readable program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing apparatus to produce a machine such that, when executed by the processor of the computer or other programmable data processing apparatus, they create means for implementing the functions / actions specified in one or more blocks of the flowchart and / or block diagram. These computer-readable program instructions can also be stored in a computer-readable storage medium that causes a computer, programmable data processing apparatus, and / or other device to operate in a particular manner; thus, the computer-readable medium storing the instructions comprises an article of manufacture that includes instructions for implementing aspects of the functions / actions specified in one or more blocks of the flowchart and / or block diagram.
[0094] Computer-readable program instructions may also be loaded onto a computer, other programmable data processing apparatus, or other device to cause a series of operational steps to be performed on the computer, other programmable data processing apparatus, or other device to produce a computer-implemented process, thereby causing the instructions executed on the computer, other programmable data processing apparatus, or other device to perform the functions / actions specified in one or more boxes of a flowchart and / or block diagram.
[0095] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of the present invention. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of an instruction, which contains one or more executable instructions for implementing a specified logical function. In some alternative implementations, the functions marked in the blocks may occur in a different order than those shown in the drawings. For example, two consecutive blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, may be implemented using a dedicated hardware-based system that performs the specified function or action, or using a combination of dedicated hardware and computer instructions.
[0096] Example embodiments have been disclosed herein, and while specific terminology has been used, it is for illustrative purposes only and should be construed as such, and is not intended to be limiting. In some instances, it will be apparent to those skilled in the art that features, characteristics, and / or elements described in conjunction with particular embodiments may be used alone, or in combination with features, characteristics, and / or elements described in conjunction with other embodiments, unless otherwise expressly indicated. Therefore, those skilled in the art will understand that various changes in form and detail may be made without departing from the scope of the invention as set forth in the appended claims.
Claims
1. A commodity sales forecasting method based on intelligent extraction and ensemble learning of date features from a dual-calendar system, characterized in that, include: Obtain univariate time series data of product sales, wherein the univariate time series data includes historical sales data and corresponding date information; Trend factor processing is performed on univariate time series data to obtain the trend factor corresponding to the univariate time series data; Extracting date features from univariate time series data using both solar and lunar calendars; including mapping each date to both the solar and lunar calendars simultaneously, and extracting predetermined types of feature dates from each calendar system. Based on the extracted feature dates and the univariate time series data, the seasonal factor for each feature date is calculated, and the sales data for the feature dates in the univariate time series data are seasonally adjusted using the seasonal factor to obtain seasonally adjusted data. The seasonally adjusted data were input into different base forecasting models to obtain multiple initial forecast results; An ensemble algorithm is used to integrate multiple initial prediction results to obtain an ensemble prediction result. Sales forecast results are obtained based on integrated forecast results, corresponding seasonal factors, and trend factors.
2. The commodity sales forecasting method based on intelligent extraction and ensemble learning of date features using a dual calendar system as described in claim 1, characterized in that, Methods for applying trend factors to univariate time series data include: The univariate time series data is accumulated and processed to obtain stationary series data; The ARIMA model is used to predict the trend components in the accumulated stationary series data. Trend curves are obtained by curve fitting the trend component data in stationary series data. The trend factor corresponding to the univariate time series data is obtained based on the trend curve.
3. The commodity sales forecasting method based on intelligent extraction and ensemble learning of dual-calendar date features according to claim 1, characterized in that, The characteristic dates include Gregorian calendar characteristic dates and lunar calendar characteristic dates; The Gregorian calendar characteristic date includes at least: Gregorian year, Gregorian month, Gregorian day, Gregorian year-month-day, Gregorian year-month, Gregorian month-day, weekday, which week of the month, and the i-th week of the i-th month; The lunar calendar characteristic date includes at least: lunar year, lunar month, lunar day, lunar year-month-day, lunar year-month, and lunar month-day.
4. The commodity sales forecasting method based on intelligent extraction and ensemble learning of dual-calendar date features according to claim 1, characterized in that, Methods for calculating the seasonal factor for each characteristic date include: Use sales data from univariate time series data and sales data corresponding to characteristic dates to obtain average daily sales and sales data for characteristic dates; Identify the influencing factors of characteristic dates based on sales data and average daily sales data for characteristic dates; Seasonal factors are obtained based on the influence factors of all characteristic dates; The sales data corresponding to the characteristic dates in the univariate time series data are adjusted using the obtained seasonal factors to obtain the adjusted seasonally adjusted data.
5. The commodity sales forecasting method based on intelligent extraction and ensemble learning of dual-calendar date features according to claim 1, characterized in that, The basic prediction models include at least the ARIMA model, Holt-Winters model, Prophet model, LSTM model, and Transformer model.
6. The commodity sales forecasting method based on intelligent extraction and ensemble learning of dual-calendar date features according to claim 1, characterized in that, The ensemble learning algorithm is the AdaBoost algorithm, which includes: The prediction results of each base model are used as the output of the weak learner; Through iterative training, the sample weights are dynamically adjusted based on the prediction performance of each weak learner. Weak learners with good prediction performance are given high weights, while weak learners with poor prediction performance are given low weights. The weighted predictions of all weak learners are combined to form the final prediction of the strong learner.
7. The commodity sales forecasting method based on intelligent extraction and ensemble learning of dual-calendar date features according to claim 1, characterized in that, Before inputting the seasonally adjusted data into different base forecasting models, the seasonally adjusted data is processed as follows: A grey model based on particle swarm optimization algorithm is used to preprocess the seasonally adjusted data. The grey model is used to weaken the volatility of the data, generate upper and lower bound predicted values of the data, and construct confidence intervals.
8. A commodity sales forecasting system based on intelligent extraction and ensemble learning of date features from a dual-calendar system, characterized in that, include: The data acquisition module is used to acquire univariate time series data of commodity sales, which includes historical sales data and corresponding date information; The trend factor processing module is used to process univariate time series data with trend factors to obtain the trend factor corresponding to the univariate time series data. The feature date extraction module performs dual-calendar date feature extraction on univariate time series data; including: mapping each date to both the Gregorian and lunar calendar systems, and extracting predetermined types of feature dates from each calendar system respectively; The seasonal factor processing module calculates the seasonal factor for each characteristic date based on the extracted characteristic dates and the univariate time series data, and uses the seasonal factor to seasonally adjust the sales data of the characteristic dates in the univariate time series data to obtain seasonally adjusted data. The basic forecast module inputs seasonally adjusted data into different basic forecast models to obtain multiple initial forecast results; The integration module uses an integration algorithm to integrate multiple initial prediction results to obtain an integrated prediction result; The results prediction module obtains sales forecast results based on integrated forecast results, corresponding seasonal factors, and trend factors.
9. An electronic device, characterized in that, include: One or more processors; Memory, used to store one or more programs; When the one or more programs are executed by the one or more processors, the one or more processors implement a commodity sales forecasting method based on intelligent extraction and ensemble learning of dual calendar date features as described in any one of claims 1 to 7.
10. A computer-readable medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements a commodity sales forecasting method based on intelligent extraction and integrated learning of dual calendar date features as described in any one of claims 1 to 7.
