Intelligent replenishment analysis method and system based on weather factors

Through the intelligent replenishment analysis method based on weather factors, data preprocessing, clustering analysis, PCA dimensionality reduction and linear regression models are used to build a sales forecast model, which solves the problem of insufficient resilience in the face of weather changes, and realizes the optimization of inventory management and replenishment operations, improving operational efficiency and economic benefits.

CN119719831APending Publication Date: 2025-03-28SHANGHAI HEADING INFORMATION ENG CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411951113.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-27
Publication Date
2025-03-28

AI Technical Summary

Technical Problem

The existing chain convenience store operation and management methods rely on the experience and intuition of store managers, and lack systematic methods based on data analysis, resulting in weak adaptability in the face of weather changes, improper inventory management, which affects operational efficiency and customer experience.

Method used

An intelligent replenishment analysis method based on weather factors is proposed. By obtaining the original data of the product sales volume containing the main weather factors, data preprocessing and clustering analysis are carried out, and combined with PCA dimensionality reduction and linear regression models, a sales forecast model is constructed, and the replenishment plan is adjusted in real time.

Benefits of technology

It improves the ability of chain convenience stores to respond to weather changes, optimizes inventory management and replenishment operations, reduces the uncertainty of relying on manual experience, and improves operational efficiency and economic benefits.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119719831A_ABST
    Figure CN119719831A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of data processing, and provides an intelligent replenishment analysis method and system based on weather factors, and the method comprises the steps: generating a structured data table for clustering analysis; performing clustering analysis on the commodities in the structured data table through a K-means clustering algorithm to generate a corresponding clustering result; integrating the specified commodity sales data and the multivariable weather data under the same clustering label, executing PCA dimension reduction analysis, and extracting a key weather factor combination influencing the commodity sales volume; training the data through a linear regression model based on the clustering labels, the key weather factor combination and the nominal classification variables, and constructing a sales prediction model; key variable combinations, nominal type classification variables, commodities and clustering labels of the day are obtained and input into the sales prediction model, the predicted sales volume is obtained, and the replenishment demand quantity is calculated. According to the method, the coping capacity of chain convenience stores to weather changes is remarkably improved, the influence of weather factors on commodity sales can be predicted more accurately, and therefore inventory management and replenishment plans are optimized.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of data processing technology, and in particular to an intelligent replenishment analysis method and system based on weather factors. Background Art

[0002] In the daily operation of convenience store chains, weather factors have a crucial impact on product sales, replenishment allocation, inventory management and other links. Different weather conditions (such as sunny days, rainy days, cold weather, etc.) will directly affect customers' purchasing behavior and consumption needs, thereby affecting the sales model and inventory level of goods. However, the existing store operation management method mainly relies on the experience and intuitive judgment of the store manager, and lacks a systematic method based on data analysis.

[0003] At present, most stores still rely mainly on traditional experience judgment and manual scheduling, and their ability to respond to weather changes is weak. Specifically, store managers often adjust replenishment plans or merchandise arrangements based on personal experience, and this approach lacks unified standards between different stores and regions, and does not have quantifiable and scalable characteristics. In addition, stores are often unable to monitor the specific impact of weather changes on sales in real time, resulting in excess or shortage of inventory, affecting store operating efficiency and customer experience. Although some retailers have begun to try to use replenishment systems based on historical data, these systems often focus on the analysis of historical sales data and fail to fully consider the real-time impact of external factors such as weather on sales. Therefore, there is a lack of a systematic and intelligent means to comprehensively predict the specific impact of weather factors on the operation of chain convenience stores, and adjust replenishment and sales strategies accordingly, resulting in low store operating efficiency and cost waste. Summary of the invention

[0004] The purpose of the invention is to propose an intelligent replenishment analysis method and system based on weather factors in response to the above technical problems, which solves the problem of relying on individual experience for replenishment decision-making in the prior art. By systematically integrating weather data and sales data, it can accurately predict the demand for goods under different weather conditions, thereby optimizing inventory management and replenishment operations, reducing the uncertainty of traditional reliance on subjective experience of store managers, and enabling chain convenience stores to achieve higher operating efficiency and economic benefits under different climatic conditions. The purpose of the invention can be achieved through the following technical solutions: The present invention proposes an intelligent replenishment analysis method based on weather factors, comprising the following steps: Step S100: obtaining the original sales data of commodities including the main weather factor, generating a structured data table suitable for cluster analysis and performing data preprocessing; Step S200: using a K-means clustering algorithm, cluster analysis is performed on the commodities in the structured data table according to a preset parameter structure to generate corresponding clustering results for classifying the commodities according to clustering labels; Step S300: integrating the sales data of the specified products under the same cluster label and the multivariate weather data corresponding to the sales date, performing PCA dimensionality reduction analysis, extracting the key weather factor combination that affects the sales volume of the products, and using it in the sales forecasting model in the cluster label; Step S400: sorting data based on cluster labels, key weather factor combinations, and nominal categorical variables, training the data through a linear regression model, building a sales forecasting model, and evaluating the performance of the sales forecasting model; Step S500: Obtain the key variable combination, nominal categorical variables, commodities and corresponding cluster labels of the day through the API interface, input them into the trained sales forecasting model, obtain the corresponding predicted sales volume and calculate the replenishment demand.

[0005] Furthermore, step S100 includes: Step S110: obtaining commodity sales raw data for cluster analysis based on main weather factors and commodity sales data, where the main weather factors include weather, temperature and precipitation; Step S120: The original data of commodity sales are processed, and outliers are eliminated according to the 3Sigma principle. The original data of commodity sales are normalized to generate a structured data table. The normalization includes Min-Max Normalization or Z-score normalization.

[0006] Further, step S200 includes: Step S210: performing cluster analysis on the structure data table using the K-means clustering algorithm, wherein the parameter structure includes the number of clusters, the distance function, the aggregation function, and the number of iterations, and generating clustering results of the commodities through cluster analysis; Step S220: calling the simple_silhouette function of the madlib interface to calculate the silhouette coefficient of the clustering result, evaluating the clustering effect based on a preset standard, and adjusting the parameters in the parameter structure if the clustering effect does not meet the evaluation standard; Step S230: Based on the clustering effect meeting the evaluation criteria, call the closest_column function of the madlib interface to assign the products to the corresponding clusters, and calculate the average precipitation, temperature and sales volume of each cluster to analyze the characteristics of each cluster and interpret the clustering results.

[0007] Further, step S300 includes: Step S310: Filter the commodities under the same cluster label, extract commodity sales data and weather factors corresponding to the sales date, where the weather factors include weather conditions, temperature threshold, humidity, wind direction, wind speed, air quality index, precipitation, ultraviolet index, commodity category and sales volume; Step S320: Perform PCA dimensionality reduction analysis based on the data extracted in step S310 to identify key weather factor combinations that have a clear impact on the sales volume of products under the cluster label, and input the key weather factor combinations as features into the sales forecasting model to predict the sales volume of products under the cluster label.

[0008] Further, step S400 includes: Step S410: sorting data for commodities under the same cluster table label, including nominal categorical variables and fields of weather factors in key weather factor combinations; Step S420: Perform linear regression model training based on the linregr_train function of the madlib interface, perform grouping based on nominal categorical variables, train numerical input variables as input variables of the linear regression model, and output training results; the nominal categorical variables include commodity categories, daytime weather, nighttime weather, and a specified day of the week; the numerical input variables include constant daytime wind speed, nighttime wind speed, precipitation rate, daytime temperature, and nighttime temperature; Step S430: The training results include the regression coefficient, determination coefficient R² and standard error of the regression model parameters based on the clustering label; wherein the regression coefficient is the weight corresponding to the weather factor characteristics in the numerical input variable, the determination coefficient is used to measure the degree of fit of the regression model, and the standard error is used to measure the accuracy of the regression model.

[0009] Furthermore, it also includes calling the linregr_predict function of the madlib interface to predict product sales based on the trained regression model, calculating residuals by comparing the predicted product sales and the actual product sales, and troubleshooting and optimizing rows with larger residual structures.

[0010] Further, step S500 includes: Step S510: obtaining weather forecast information including daytime wind speed, nighttime wind speed, precipitation rate, daytime temperature and nighttime temperature in real time through an external API interface; Step S520: Combine the data obtained from the API interface with the real-time information of the store, including the current inventory, specific date and product category, to construct a complete input data set; the input data set conforms to the format analyzed by PCA dimensionality reduction analysis and K-means clustering algorithm; Step S530: Input the integrated data into the trained sales forecasting model. The sales forecasting model calculates the predicted sales volume of the product based on the regression coefficient determined in the training phase. The predicted sales volume is compared with the current inventory to calculate the quantity required for replenishment and make replenishment suggestions.

[0011] Based on the same inventive concept, the present invention provides an intelligent replenishment analysis system based on artificial intelligence, which adopts the intelligent replenishment analysis method as described above, including: The data collection and preprocessing module is used to obtain the original data of commodity sales including the main weather factors, generate a structured data table suitable for cluster analysis, and perform data preprocessing; The clustering analysis module is used to perform clustering analysis on the commodities in the structured data table according to the preset parameter structure through the K-means clustering algorithm to generate corresponding clustering results, which are used to classify the commodities according to the clustering labels; Dimensionality reduction analysis module, used to integrate the sales data of specified products under the same cluster label and the multivariate weather data corresponding to the sales date, perform PCA dimensionality reduction analysis, extract the key weather factor combination that affects the sales volume of the product, and use it in the sales forecast model in the cluster label; Model training and evaluation module, which is used to organize data based on cluster labels, key weather factor combinations, and nominal categorical variables, train data through linear regression models, build sales forecasting models, and evaluate the performance of sales forecasting models; The result output module is used to obtain the key variable combination, nominal categorical variables, commodities and corresponding cluster labels of the day through the API interface, input them into the trained sales forecasting model, obtain the corresponding predicted sales volume and calculate the replenishment demand.

[0012] Furthermore, the cluster analysis module includes: A clustering execution unit, used to perform clustering analysis on the structure data table using a K-means clustering algorithm, wherein the parameter structure includes the number of clusters, the distance function, the aggregation function, and the number of iterations, and to generate clustering results of commodities through clustering analysis; The clustering evaluation unit is used to call the simple_silhouette function of the madlib interface to calculate the silhouette coefficient of the clustering result, evaluate the clustering effect based on the preset standard, and adjust the parameters in the parameter structure if the clustering effect does not meet the evaluation standard; The allocation application unit is used to call the closest_column function of the madlib interface to allocate the products to the corresponding clusters based on whether the clustering effect meets the evaluation criteria, and calculate the average precipitation, temperature and sales volume of each cluster to analyze the characteristics of each cluster and interpret the clustering results.

[0013] Furthermore, the dimensionality reduction analysis module includes: The sorting unit is used to sort the data of the products under the same cluster table label, covering the fields of nominal categorical variables and weather factors in the key weather factor combination; The training unit is used to train the linear regression model based on the linregr_train function of the madlib interface, grouping based on nominal categorical variables, training the numerical input variables as the input variables of the linear regression model, and outputting the training results; the nominal categorical variables include commodity categories, daytime weather, nighttime weather, and a specified day of the week; the numerical input variables include constant daytime wind speed, nighttime wind speed, precipitation rate, daytime temperature, and nighttime temperature; The analysis unit is used for training results including the regression coefficient, determination coefficient R² and standard error of the regression model parameters based on the cluster label; the regression coefficient is the weight corresponding to the weather factor characteristics in the numerical input variable, the determination coefficient is used to measure the degree of fit of the regression model, and the standard error is used to measure the accuracy of the regression model.

[0014] Compared with the prior art, the present invention has at least one of the following technical effects: The intelligent replenishment analysis method and system of the present invention improves the ability of chain convenience stores to respond to weather changes. By integrating K-means clustering, PCA dimensionality reduction and linear regression analysis, it can more accurately predict the impact of weather factors on commodity sales, thereby optimizing inventory management and replenishment plans. Secondly, the system replaces the traditional method that relies on manual experience with automated data analysis, ensuring the consistency and accuracy of operations and reducing inventory waste caused by human judgment errors. In addition, the system's real-time data processing and analysis functions enable stores to respond quickly to weather changes, enhancing the store's market competitiveness and customer satisfaction. BRIEF DESCRIPTION OF THE DRAWINGS

[0015] In order to more clearly illustrate the technical solution of the embodiment of the present invention, the following is a brief introduction to the drawings required for describing the embodiment: Figure 1 The figure is a flow chart of the steps of the intelligent replenishment analysis method based on weather factors of the present invention. DETAILED DESCRIPTION

[0016] In order to make the purpose, technical solution and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the accompanying drawings and specific implementation methods. It should be understood that the specific implementation methods described herein are only used to explain the present invention and are not used to limit the present invention.

[0017] Example 1 In the existing technology, the operation of chain convenience stores is highly dependent on weather conditions, because weather changes directly affect consumer shopping behavior and store sales. Despite this, the operation strategies of most stores are still adjusted based on the personal experience and intuition of store managers. This method lacks consistency and scientificity between different regions and stores, and cannot effectively deal with the challenges brought by the weather, such as failure to adjust replenishment strategies in a timely manner, resulting in inventory backlogs or out-of-stock phenomena.

[0018] To address this issue, the inventor conducted an in-depth study of the relationship between the operating data of chain convenience stores and weather changes, and found that the store's operating strategy can be optimized through scientific data analysis methods. Based on this, the inventor proposed an intelligent replenishment analysis method based on weather factors. This method integrates K-means clustering analysis, principal component analysis (PCA) and multivariate linear regression to analyze and predict the specific impact of weather changes on product sales. This method can provide each store with a tailored replenishment and sales strategy, significantly improving the store's response speed and accuracy to weather changes, thereby optimizing inventory management, improving operational efficiency and reducing costs. The specific implementation methods are as follows: The present invention proposes an intelligent replenishment analysis method based on weather factors, comprising the following steps: Step S100: obtaining the original sales data of commodities including the main weather factor, generating a structured data table suitable for cluster analysis and performing data preprocessing; wherein, Step S100 includes: Step S110: obtaining commodity sales raw data for cluster analysis based on main weather factors and commodity sales data, where the main weather factors include weather, temperature and precipitation; Step S120: The original data of commodity sales are processed, and outliers are eliminated according to the 3Sigma principle. The original data of commodity sales are normalized to generate a structured data table. The normalization includes Min-Max Normalization or Z-score normalization.

[0019] This step is to collect key data related to sales, including weather conditions, product information, sales volume and other basic data. These data are integrated from different data sources to form a unified data set, i.e., the structured data table mentioned in step S100. Based on the 3 Sigma principle, the sales volume of the products is subjected to outlier elimination and normalization. The example is as follows: Step S200: Using the K-means clustering algorithm, cluster analysis is performed on the commodities in the structured data table according to the preset parameter structure to generate corresponding clustering results for classifying the commodities according to the clustering labels; specifically, cluster analysis is performed using Kmeans to form categories, and cluster analysis is performed on the commodities using indicators such as weather, temperature, precipitation, and sales volume as data object attributes.

[0020] Wherein, step S200 includes: Step S210: performing cluster analysis on the structure data table using the K-means clustering algorithm, wherein the parameter structure includes the number of clusters, the distance function, the aggregation function, and the number of iterations, and generating clustering results of the commodities through cluster analysis; The code to execute the clustering method is as follows: drop table if exists km_result; create table km_result as select * from madlib.kmeanspp ('kmeans_2024_nor_base_data', -- source data table name 'row_vec', -- the name of the column containing the data points 3, -- Number of center points 'madlib.squared_dist_norm2', -- distance function 'madlib.avg', -- Aggregation function 20, -- number of iterations 0.001 -- Stop iteration condition ); Categorize commodities based on their weather-dependent characteristics for further analysis and operational optimization. The specific steps include: ① Check and delete the existing table km_result with the same name to avoid conflicts when creating a new table; ②Create km_result to store the results of cluster analysis; ③Call the kmeanspp function of the madlib interface, take the structured data table containing the data for clustering as input, set the column name containing the data points, where each line is the vector to be clustered, 3 is the number of center points of the cluster center, which is used to determine how many clusters the data is divided into, set the distance function through squared_dist_norm2, and call the avg function as the aggregation function, which is used to update the cluster center during the iteration process, and set the maximum number of iterations of the algorithm, as well as the conditions for stopping the iteration. Based on this K-means clustering algorithm, the products will be automatically grouped based on the characteristics of the input data, and the products in each group have similarities in the selected characteristics, such as weather sensitivity. It is helpful for further analysis and decision-making.

[0021] Step S220: calling the simple_silhouette function of the madlib interface to calculate the silhouette coefficient of the clustering result, evaluating the clustering effect based on a preset standard, and adjusting the parameters in the parameter structure if the clustering effect does not meet the evaluation standard; The code for executing the clustering effect evaluation is as follows: select * from madlib.simple_silhouette ('kmeans_2024_nor_base_data', 'row_vec', (select centroids from madlib.kmeanspp('kmeans_2024_nor_base_data', 'row_vec', 3, 'madlib.squared_dist_norm2', 'madlib.avg', 20, 0.001)), 'madlib.dist_norm2' ); What needs to be explained specifically is the calculation of the silhouette coefficient, which is an indicator for evaluating the quality of clustering results, ranging from -1 to 1. A higher silhouette coefficient indicates that the distance within the cluster is small and the distance between clusters is large, that is, the clustering effect is good. The value of the silhouette coefficient is 0.6459959672213217, which is close to 1, indicating a good clustering effect. This shows that most points are tightly clustered around their cluster centers and are well separated from other clusters.

[0022] Step S230: Based on the clustering effect meeting the evaluation criteria, call the closest_column function of the madlib interface to assign the products to the corresponding clusters, and calculate the average precipitation, temperature and sales volume of each cluster to analyze the characteristics of each cluster and interpret the clustering results.

[0023] The code for executing cluster allocation is as follows: select cluster_id, round(count(distinct(goods_gid)) / 99.0,4) pct, round(avg(jiangshui),4) avg_jiangshui, round(avg(day_air_temperature),4) avg_day_air_temperature, round(avg(night_air_temperature),2) avg_night_air_temperature, round(avg(salqty),2) avg_salqty from ( select t2.*, (madlib.closest_column(centroids, t2.row_vec)).column_id ascluster_id from kmeans_2024_nor_base_data as t1, km_result, kmeans_2024_nor_base_data t2 where t1.goods_gid = t2.goods_gid) t group by cluster_id; What needs to be explained is that the madlib.closest_column function is used, which assigns each data point to the closest cluster center based on the known cluster center points (centroids). In this way, each product is assigned to the cluster that best matches its characteristics.

[0024] In the code regarding, SQL query explanation: select cluster_id, ..., used to select cluster ID and calculate statistics for each cluster; round(count(distinct(goods_gid)) / 99.0,4) pct is used to calculate the percentage of distinct product IDs in each cluster, providing a relative measure of cluster size; round(avg(jiangshui),4) avg_jiangshui and other average calculations are used to calculate the average precipitation, average daytime and nighttime temperatures, and sales volume for each cluster, which help describe the characteristics of each cluster.

[0025] By calculating the average of key meteorological and sales data for each cluster, it is used to determine the performance of products in different clusters under different weather conditions. For example, a cluster may have increased sales when precipitation is high, which may indicate that the products in this cluster are more popular on rainy days. These statistics can not only be used to describe the characteristics of each cluster, but also provide data support for further sales strategies, inventory management and marketing activities.

[0026] The cluster allocation results are as follows: An example of explaining the clustering results: At this point, the cluster analysis is complete, and the subsequent regression analysis will be calculated for each group of products separately.

[0027] Step S300: integrating the sales data of the specified products under the same clustering label and the multivariate weather data corresponding to the sales date, performing PCA dimensionality reduction analysis, extracting the key weather factor combination that affects the sales volume of the products, and using it in the sales prediction model in the clustering label; wherein step S300 includes: Step S310: Filter the commodities under the same cluster label, extract commodity sales data and weather factors corresponding to the sales date, where the weather factors include weather conditions, temperature threshold, humidity, wind direction, wind speed, air quality index, precipitation, ultraviolet index, commodity category and sales volume; Step S320: Perform PCA dimensionality reduction analysis based on the data extracted in step S310 to identify key weather factor combinations that have a clear impact on the sales volume of products under the cluster label, and input the key weather factor combinations as features into the sales forecasting model to predict the sales volume of products under the cluster label.

[0028] Specifically, PCA dimensionality reduction analysis mainly uses PCA dimensionality reduction technology to find the key factors that affect product sales from many weather variables such as weather conditions, temperature, humidity, wind speed, etc. The specific steps are: ① Data preparation: collect weather data and related data on the clustered sales of specific commodities, and form a table ads_sales_goods_weather in the greenplum database. The example is as follows: ② Transpose the database to generate a dense matrix containing various indicators drop table if exists ads_sales_goods_weather_wide,ads_sales_goods_weather_wide_dictionary; select madlib.pivot( 'ads_sales_goods_weather', 'ads_sales_goods_weather_wide', 'id,mins,endpoint', 'counter', 'value', 'AVG', '0', 'true' ); 3. Training the model drop table if exists sales_pca_result_table, sales_pca_result_table_mean; select madlib.pca_train('ads_sales_goods_weather_wide',-- original table 'sales_pca_result_table', -- output table 'id', -- source table ID column 1, -- principal component 'endpoint' ); 4. Call the PCA projection function to generate a data table after dimensionality reduction drop table if exists ads_sales_goods_weather_residual_table, ads_sales_goods_weather_result_summary_table, ads_sales_goods_weather_out_table; select madlib.pca_project( 'ads_sales_goods_weather_wide', 'sales_pca_result_table', 'ads_sales_goods_weather_out_table', 'id'); 5. View the projection output table Output table select * from ads_sales_goods_weather_out_table --Data table projected to the principal component Residual table select * from ads_sales_goods_weather_residual_table --The error corresponding to each original data item. The closer to zero, the smaller the error. 6. Determine the dimensions that are ultimately retained as daytime weather, nighttime weather, daytime wind speed, nighttime wind speed, precipitation rate, daytime temperature, and nighttime temperature.

[0029] Step S400: sorting data based on cluster labels, key weather factor combinations, and nominal categorical variables, training the data through a linear regression model, building a sales forecasting model, and evaluating the performance of the sales forecasting model; wherein step S400 includes: Step S410: sorting data for commodities under the same cluster table label, including nominal categorical variables and fields of weather factors in key weather factor combinations; Step S420: Perform linear regression model training based on the linregr_train function of the madlib interface, perform grouping based on nominal categorical variables, train numerical input variables as input variables of the linear regression model, and output training results; the nominal categorical variables include commodity categories, daytime weather, nighttime weather, and a specified day of the week; the numerical input variables include constant daytime wind speed, nighttime wind speed, precipitation rate, daytime temperature, and nighttime temperature; Step S430: The training results include a commodity constant based on cluster labels and nominal categorical variables, and the regression model parameter results also include regression coefficients, determination coefficients R², and standard errors; where the regression coefficients are the weights corresponding to the weather factor characteristics in the numerical input variables, the determination coefficients are used to measure the degree of fit of the regression model, and the standard errors are used to measure the accuracy of the regression model. Nominal categorical variables include the day of the week, that is, a specific day in a week, daytime weather, nighttime weather, and custom variables for commodity categories.

[0030] It also includes calling the linregr_predict function of the madlib interface to predict product sales based on the trained regression model, calculating the residual by comparing the predicted product sales and the actual product sales, and troubleshooting and optimizing the rows with large residual structures.

[0031] Specifically, ① Based on the dimensions obtained by PCA dimensionality reduction, organize basic data such as weather, stores, categories, sales, etc. (Note: adding the day of the week to the dimension is based on experience. The sales of general commodities will change periodically with the day of the week) drop table if exists pca_2024_base_data_part_1; create table pca_2024_base_data_part_1 as select weekday_num, -- day of the week day_weather, -- daytime weather case when jiangshui is null then 0 else (replace(jiangshui,'%',''))::integer end as jiangshui, -- precipitation rate night_weather, -- Night weather day_wind_power, -- daytime wind power night_wind_power, -- Night wind power day_air_temperature::integer, -- daytime temperature night_air_temperature::integer, -- night temperature bsort_code::integer, -- Product category Salqty, -- Sales cluster_id -- the group number after cluster analysis from pca_weather_base_data Where cluster_id = 1 -- Take group 1 as an example for calculation ② Conduct training Because the day of the week, category, weather conditions, etc. cannot be quantified, they are grouped here. select madlib.linregr_train( 'pca_2024_base_data_part_1', 'pca_2024_base_data_linrege_output', 'salqty', 'array[1,jiangshui,day_air_temperature,night_air_temperature]', 'weekday_num,bsort_code,day_weather,night_weather' ) 3. View the results Field Description Coef (regression coefficient): the weight corresponding to each characteristic variable; R2 (coefficient of determination): goodness of fit, that is, the degree to which the model explains the total variation of the target variable and the degree of fit of the model to the target variable.

[0032] Std_err (difference): The difference between the data inferred by the model and the original data.

[0033] It was found that the correlation coefficient R values ​​of different groups were different, and subsequent calculations were performed on the results with stronger correlations.

[0034] ④ Use the prediction function to estimate the residual select weekday_num,bsort_code,day_weather,night_weather, salqty,predict, salqty - predict residual from ( select a.*, madlib.linregr_predict(b.coef, array[1, a.jiangshui,a.day_air_temperature,a.night_air_temperature]) as predict from pca_2024_base_data_part_1 a join pca_2024_base_data_linrege_output b on a.weekday_num =b.weekday_num and a.bsort_code=b.bsort_code and a.day_weather= b.day_weather and a.night_weather=b.night_weather )t; The sample results are shown in the following table. The rows with large residual results are checked and optimized. Step S500: Obtain the key variable combination, nominal categorical variables, commodities and corresponding cluster labels of the day through the API interface, input them into the trained sales forecasting model, obtain the corresponding predicted sales volume and calculate the replenishment demand. Step S500 includes: Step S510: obtaining weather forecast information including daytime wind speed, nighttime wind speed, precipitation rate, daytime temperature and nighttime temperature in real time through an external API interface; Step S520: Combine the data obtained from the API interface with the real-time information of the store, including the current inventory, specific date and product category, to construct a complete input data set; the input data set conforms to the format analyzed by PCA dimensionality reduction analysis and K-means clustering algorithm; Step S530: Input the integrated data into the trained sales forecasting model. The sales forecasting model calculates the predicted sales volume of the product based on the regression coefficient determined in the training phase. The predicted sales volume is compared with the current inventory to calculate the quantity required for replenishment and make replenishment suggestions.

[0035] Specifically, weather forecast information is obtained through the API, and the parameters are imported into the regression model to obtain sales forecast values ​​under specific weather conditions.

[0036] The process of importing the model is simply a multivariate linear equation, where the variables are the dimensions obtained by PCA dimensionality reduction, multiplied by the corresponding weights.

[0037] Taking this calculation as an example, the predicted sales volume = constant + q1*daytime wind speed + q2*nighttime wind speed + q3*precipitation rate + q4*daytime temperature + q5*nighttime temperature; different groups of goods and different weather conditions will have different weights.

[0038] Thus, we can get the predicted sales volume of a specific store product on a certain day in the future. By considering some real-time information of the store (such as inventory), we can calculate the store's future sales volume and give a recommended value for the store's orders.

[0039] Example 2 Based on the same inventive concept, the present invention provides an intelligent replenishment analysis system based on artificial intelligence, which adopts the intelligent replenishment analysis method as described above, including: The data collection and preprocessing module is used to obtain the original data of commodity sales including the main weather factors, generate a structured data table suitable for cluster analysis, and perform data preprocessing; The clustering analysis module is used to perform clustering analysis on the commodities in the structured data table according to the preset parameter structure through the K-means clustering algorithm to generate corresponding clustering results, which are used to classify the commodities according to the clustering labels; Dimensionality reduction analysis module, used to integrate the sales data of specified products under the same cluster label and the multivariate weather data corresponding to the sales date, perform PCA dimensionality reduction analysis, extract the key weather factor combination that affects the sales volume of the product, and use it in the sales forecast model in the cluster label; Model training and evaluation module, which is used to organize data based on cluster labels, key weather factor combinations, and nominal categorical variables, train data through linear regression models, build sales forecasting models, and evaluate the performance of sales forecasting models; The result output module is used to obtain the key variable combination, nominal categorical variables, commodities and corresponding cluster labels of the day through the API interface, input them into the trained sales forecasting model, obtain the corresponding predicted sales volume and calculate the replenishment demand.

[0040] Furthermore, the cluster analysis module includes: A clustering execution unit, used to perform clustering analysis on the structure data table using a K-means clustering algorithm, wherein the parameter structure includes the number of clusters, the distance function, the aggregation function, and the number of iterations, and to generate clustering results of commodities through clustering analysis; The clustering evaluation unit is used to call the simple_silhouette function of the madlib interface to calculate the silhouette coefficient of the clustering result, evaluate the clustering effect based on the preset standard, and adjust the parameters in the parameter structure if the clustering effect does not meet the evaluation standard; The allocation application unit is used to call the closest_column function of the madlib interface to allocate the products to the corresponding clusters based on whether the clustering effect meets the evaluation criteria, and calculate the average precipitation, temperature and sales volume of each cluster to analyze the characteristics of each cluster and interpret the clustering results.

[0041] Furthermore, the dimensionality reduction analysis module includes: The sorting unit is used to sort the data of the products under the same cluster table label, covering the fields of nominal categorical variables and weather factors in the key weather factor combination; The training unit is used to train the linear regression model based on the linregr_train function of the madlib interface, grouping based on nominal categorical variables, training the numerical input variables as the input variables of the linear regression model, and outputting the training results; the nominal categorical variables include commodity categories, daytime weather, nighttime weather, and a specified day of the week; the numerical input variables include constant daytime wind speed, nighttime wind speed, precipitation rate, daytime temperature, and nighttime temperature; The analysis unit is used for training results including the regression coefficient, determination coefficient R² and standard error of the regression model parameters based on the cluster label; the regression coefficient is the weight corresponding to the weather factor characteristics in the numerical input variable, the determination coefficient is used to measure the degree of fit of the regression model, and the standard error is used to measure the accuracy of the regression model.

[0042] Although the present invention has been disclosed as above in the form of a preferred embodiment, it is not intended to limit the present invention. Any person skilled in the art may make possible changes and modifications to the technical solution of the present invention by using the methods and technical contents disclosed above without departing from the spirit and scope of the present invention. Therefore, any simple modifications, equivalent changes and modifications made to the above embodiments based on the technical essence of the present invention without departing from the content of the technical solution of the present invention shall fall within the protection scope of the technical solution of the present invention.

Claims

1. An intelligent replenishment analysis method based on weather factors, characterized in that: The following steps are involved: Step S100: obtaining the original sales data of commodities including the main weather factor, generating a structured data table suitable for cluster analysis and performing data preprocessing; Step S200: using a K-means clustering algorithm, cluster analysis is performed on the commodities in the structured data table according to a preset parameter structure to generate corresponding clustering results for classifying the commodities according to clustering labels; Step S300: integrating the sales data of the specified commodity under the same clustering label and the multivariate weather data corresponding to the sales date, performing the PCA dimensionality reduction analysis, extracting the key weather factor combination that affects the sales volume of the commodity, and using it in the sales forecasting model in the clustering label; Step S400: sorting data based on the clustering labels, the key weather factor combinations, and the nominal categorical variables, training the data through a linear regression model, building the sales forecasting model, and evaluating the performance of the sales forecasting model; Step S500: Obtain the key variable combination, the nominal categorical variable, the commodity and the corresponding cluster label of the day through the API interface, input them into the trained sales forecasting model, obtain the corresponding predicted sales volume and calculate the replenishment demand.

2. The intelligent replenishment analysis method according to claim 1, characterized in that: The step S100 includes: Step S110: acquiring the commodity sales raw data for the cluster analysis based on the main weather factors and the commodity sales data, wherein the main weather factors include weather, temperature and precipitation; Step S120: performing data processing on the raw data of the commodity sales, removing outliers according to the 3 Sigma principle, and normalizing the raw data of the commodity sales to generate the structured data table, wherein the normalization includes Min-Max Normalization or Z-score normalization.

3. The intelligent replenishment analysis method according to claim 1, characterized in that: The step S200 includes: Step S210: performing the cluster analysis on the structure data table using a K-means clustering algorithm, wherein the parameter structure includes the number of clusters, a distance function, an aggregation function, and the number of iterations, and generating the clustering result of the commodity through the cluster analysis; Step S220: calling the simple_silhouette function of the madlib interface to calculate the silhouette coefficient of the clustering result, evaluating the clustering effect based on a preset standard, and adjusting the parameters in the parameter structure based on the clustering effect not meeting the evaluation standard; Step S230: Based on the clustering effect satisfying the evaluation criteria, the closest_column function of the madlib interface is called to assign the product to the corresponding cluster, and the average value of the precipitation, the temperature and the sales volume of each cluster is calculated to analyze the characteristics of each cluster and interpret the clustering results.

4. The intelligent replenishment analysis method according to claim 3, characterized in that: The step S300 includes: Step S310: Filter the commodities belonging to the same cluster label, extract the commodity sales data and the weather factors corresponding to the sales date, the weather factors including weather conditions, temperature threshold, humidity, wind direction, wind force, air quality index, precipitation, ultraviolet index, commodity category and sales volume; Step S320: Perform the PCA dimensionality reduction analysis based on the data extracted in step S310 to identify the key weather factor combination that has a clear impact on the sales volume of the product under the cluster label, and input the key weather factor combination as a feature into the sales forecasting model to predict the sales volume of the product under the cluster label.

5. The intelligent replenishment analysis method according to claim 4, characterized in that: Step S400 includes: Step S410: sorting data for the commodities under the same cluster table label, covering the nominal categorical variables and the fields of the weather factors in the key weather factor combination; Step S420: Perform linear regression model training based on the linregr_train function of the madlib interface, perform grouping based on the nominal categorical variables, train the numerical input variables as the input variables of the linear regression model, and output the training results; the nominal categorical variables include commodity categories, daytime weather, nighttime weather, and a specified date of the week; the numerical input variables include the constants of the daytime wind speed, the nighttime wind speed, the precipitation rate, the daytime temperature, and the nighttime temperature; Step S430: The training results include the regression coefficient, determination coefficient R² and standard error of the regression model parameters based on the clustering label; wherein the regression coefficient is the weight corresponding to the weather factor characteristics in the numerical input variable, the determination coefficient is used to measure the degree of fit of the regression model, and the standard error is used to measure the accuracy of the regression model.

6. The intelligent replenishment analysis method according to claim 5, characterized in that: The method further includes calling the linregr_predict function of the madlib interface to predict product sales based on the trained regression model, calculating residuals by comparing the predicted product sales with the actual product sales, and troubleshooting and optimizing rows with larger residual structures.

7. The intelligent replenishment analysis method according to claim 5, characterized in that: The step S500 includes: Step S510: obtaining weather forecast information including the daytime wind speed, the nighttime wind speed, the precipitation rate, the daytime temperature and the nighttime temperature in real time through an external API interface; Step S520: combining the data obtained from the API interface with the real-time information of the store, including the current inventory, specific date and the commodity category, to construct a complete input data set; the input data set conforms to the format analyzed by the PCA dimensionality reduction analysis and the K-means clustering algorithm; Step S530: Input the integrated data into the trained sales forecasting model, and the sales forecasting model calculates the predicted sales volume of the product according to the regression coefficient determined in the training phase; calculates the quantity required for replenishment by comparing the predicted sales volume with the current inventory, and makes replenishment suggestions.

8. An intelligent replenishment analysis system based on artificial intelligence, using the intelligent replenishment analysis method according to any one of claims 1 to 7, characterized in that: include: The data collection and preprocessing module is used to obtain the original data of commodity sales including the main weather factors, generate a structured data table suitable for cluster analysis, and perform data preprocessing; A clustering analysis module, used to perform clustering analysis on the commodities in the structured data table according to a preset parameter structure through a K-means clustering algorithm to generate corresponding clustering results, and used to classify the commodities according to clustering labels; A dimensionality reduction analysis module, used to integrate the sales data of the specified commodity under the same cluster label and the multivariate weather data corresponding to the sales date, perform the PCA dimensionality reduction analysis, extract the key weather factor combination that affects the sales volume of the commodity, and use it in the sales forecast model in the cluster label; A model training and evaluation module, for arranging data based on the cluster labels, the key weather factor combinations, and the nominal categorical variables, training the data through a linear regression model, building the sales forecasting model, and evaluating the performance of the sales forecasting model; The result output module is used to obtain the key variable combination, the nominal categorical variable, the product and the corresponding cluster label of the day through the API interface, input them into the trained sales forecasting model, obtain the corresponding predicted sales volume and calculate the replenishment demand.

9. The intelligent replenishment analysis method according to claim 8, characterized in that: The cluster analysis module comprises: A clustering execution unit, configured to perform the clustering analysis on the structure data table using a K-means clustering algorithm, wherein the parameter structure includes the number of clusters, a distance function, an aggregation function, and the number of iterations, and to generate the clustering result of the commodity through the clustering analysis; A clustering evaluation unit, configured to call the simple_silhouette function of the madlib interface to calculate the silhouette coefficient of the clustering result, evaluate the clustering effect based on a preset standard, and adjust the parameters in the parameter structure based on the clustering effect not meeting the evaluation standard; An allocation application unit is used to call the closest_column function of the madlib interface to allocate the goods to the corresponding cluster clusters based on the clustering effect satisfying the evaluation criteria, and calculate the average values ​​of the precipitation, the temperature and the sales volume of each cluster cluster, so as to analyze the characteristics of each cluster cluster and interpret the clustering results.

10. The intelligent replenishment analysis method according to claim 8, characterized in that: The dimensionality reduction analysis module includes: A sorting unit, used for sorting data for the commodities under the same clustering table label, covering the nominal categorical variables and the fields of the weather factors in the key weather factor combination; A training unit, for performing linear regression model training based on the linregr_train function of the madlib interface, performing grouping based on the nominal categorical variables, training numerical input variables as input variables of the linear regression model, and outputting training results; the nominal categorical variables include commodity categories, daytime weather, nighttime weather, and a specified date of the week; the numerical input variables include constants such as the daytime wind force, the nighttime wind force, the precipitation rate, the daytime temperature, and the nighttime temperature; An analysis unit, for which the training results include a regression coefficient, a determination coefficient R² and a standard error of the regression model parameters based on the clustering label; wherein the regression coefficient is the weight corresponding to the weather factor feature in the numerical input variable, the determination coefficient is used to measure the degree of fit of the regression model, and the standard error is used to measure the accuracy of the regression model.