Automobile parts long-tail demand prediction method based on meta-learning and graph neural network

CN122222664BActive Publication Date: 2026-08-11FUJIAN YANGTENG INNOVATION INFORMATION TECHNOLOGY CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2026-05-20
Publication Date
2026-08-11

AI Technical Summary

Technical Problem

1、长尾SKU数据稀疏导致预测效果不佳:现有方法通常针对单SKU独立建模,历史数据有限或零销量占比较高时难以学习有效模式

Benefits of technology

1、长尾SKU的预测能力显著提升:

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122222664B_ABST
    Figure CN122222664B_ABST
Patent Text Reader

Abstract

This invention discloses a method for predicting long-tail demand in auto parts based on meta-learning and graph neural networks, comprising: acquiring historical sales data of SKUs and preprocessing it to generate sales sequences, sparse features, and basic features; classifying each SKU according to its average sales and trend slope, generating type-encoded features, and forming SKU feature vectors; constructing an SKU association graph, aggregating information from neighboring nodes to obtain the embedding vector of each SKU, forming input feature vectors; dividing the meta-learning task and training a meta-learning prediction model to output sales distribution parameters; constructing a distribution prediction model and calculating the sales prediction distribution; calculating the KL divergence between the current sales prediction distribution and the baseline sales prediction distribution, and performing hierarchical updates based on the magnitude of the KL divergence; and managing inventory based on the prediction interval of the sales prediction distribution. This invention provides effective decision support for inventory management and replenishment strategies.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of intelligent prediction and automotive parts data modeling technology, and in particular to a method for predicting long-tail demand for automotive parts based on meta-learning and graph neural networks. Background Technology

[0002] As the automotive aftermarket continues to expand, the number of SKUs (stock keeping units) is growing, exhibiting characteristics of diverse categories, dispersed demand, and frequent updates. In actual business operations, a large number of SKUs are long-tail products, with sparse and highly volatile historical sales data, and a high proportion of zero sales, posing significant challenges to demand forecasting.

[0003] Existing demand forecasting methods mainly include those based on statistical models and those based on machine learning. Statistical models (such as ARIMA and exponential smoothing) are typically used for modeling single time series and rely on the assumption of time series stationarity, making them difficult to handle SKUs with large demand fluctuations or significant intermittency. While traditional machine learning methods can utilize more features, most still focus on modeling single SKUs independently, failing to fully leverage the potential correlations between different SKUs.

[0004] In addition, existing methods typically only output point forecasts, which are difficult to characterize the uncertainty range of demand and provide insufficient support for inventory control and replenishment strategy optimization. At the same time, these methods usually assume that the data distribution is static and lack dynamic drift monitoring and online update mechanisms, which leads to a decline in forecast performance over time.

[0005] In scenarios with few samples or new SKUs, especially long-tail SKUs, existing methods often fail to quickly learn effective demand patterns, leading to unstable prediction results. Existing technologies also rarely stratify SKUs based on sales volume or recent trends to allow for different strategies or parameter initialization in the prediction model, thereby further improving the adaptability to few samples.

[0006] In summary, the existing technology has the following technical problems: 1. Sparse data of long-tail SKUs leads to poor prediction results: Existing methods usually model each SKU independently, and it is difficult to learn effective patterns when historical data is limited or the proportion of zero sales is high.

[0007] 2. Insufficient modeling of relationships between SKUs: Existing methods fail to fully utilize the potential demand relationships between different SKUs and cannot share information to improve overall prediction performance.

[0008] 3. Insufficient characterization of demand uncertainty: Existing methods mostly output a single forecast value, which is difficult to reflect the range of demand fluctuations and limits the risk control of inventory and replenishment decisions.

[0009] 4. The model is difficult to adapt to dynamic changes in demand distribution: Changes in market environment and business strategy cause data distribution to drift, and existing methods lack a dynamic update mechanism. Summary of the Invention

[0010] In view of this, the purpose of this invention is to propose a long-tail demand forecasting method for auto parts based on meta-learning and graph neural networks. By combining SKU hierarchical structure, meta-learning, graph structure information fusion and distribution forecasting, this method not only improves the forecasting accuracy, stability and practical business applicability of long-tail SKUs, but also characterizes demand uncertainty, providing effective decision support for inventory management and replenishment strategies.

[0011] To achieve the above-mentioned technical objectives, the technical solution adopted by this invention is as follows: This invention provides a method for predicting long-tail demand for auto parts based on meta-learning and graph neural networks, comprising the following steps: Step 1: Obtain historical sales data for multiple SKUs and preprocess them to generate standardized sales sequences, sparse features, and basic features; Step 2: Based on the average sales volume and trend slope of each SKU within a preset time window, classify each SKU into different types, generate corresponding type coding features, and concatenate them with sales sequence, sparse features and basic features to form SKU feature vector; Step 3: Using each SKU as a node, construct an SKU association graph based on the potential demand associations between SKUs. Use a graph neural network to aggregate the information of neighboring nodes to obtain the embedding vector of each SKU, and concatenate it with the SKU feature vector to form the input feature vector. Step 4: Divide the meta-learning tasks according to the SKU type, and use quantile loss and graph structure regularization to jointly optimize based on the input feature vector to train the meta-learning prediction model to output sales distribution parameters. Step 5: Construct a distribution prediction model based on the sales distribution parameters, and calculate the sales prediction distribution of each SKU within the prediction period; Step 6: Calculate the KL divergence between the current sales forecast distribution and the baseline sales forecast distribution, and execute a tiered update strategy based on the magnitude of the KL divergence. Step 7: Perform inventory management based on the predicted range of the sales forecast distribution.

[0012] Furthermore, step 1 specifically includes: Step 11: Collect historical sales data for SKUs and align them to a uniform time granularity; simultaneously, acquire basic features as auxiliary inputs; the basic features include promotional information, price, and holiday information. Step 12: Determine the SKU category based on the average sales volume and the percentage of zero sales over the past N weeks. Then, use the corresponding imputation strategy to fill in missing values ​​in the historical sales data according to the SKU category; the details are as follows: Step 121: Calculate the average sales volume of each SKU over the most recent N weeks. The formula is as follows:

[0013] in, For the statistical period, Weekly index and =1,2,…, ; For SKU in the Weekly sales; Step 122: Calculate the percentage of zero sales for each SKU in the most recent N weeks. The formula is as follows:

[0014] Step 123: Based on average sales and zero sales percentage The size is used to fill in missing values: If the average sales volume is not less than the preset average threshold and the percentage of zero sales volume is less than the preset percentage of zero sales volume threshold, then the SKU is determined to be a high-frequency stable SKU, and the forward filling method is used to fill the missing values ​​in the historical sales data of the SKU. If the average sales volume is less than the preset average threshold or the percentage of zero sales is not less than the preset percentage of zero sales, then the SKU is identified as a long-tail sparse SKU, and the missing values ​​in the historical sales data of the SKU are filled by the zero-value filling method. Step 13: Truncate abnormal sales data from historical sales records according to the truncation rules, and correct the abnormal sales; details are as follows: Step 131: For each SKU, calculate the average sales volume over the most recent N weeks within a preset time window. and standard deviation ; Step 132: Set the preset and The upper and lower limits for abnormal sales are used as the cutoff limits. Cutoff is performed based on these limits, and the cutoff rules are as follows: like or Then determine This is abnormal sales volume; like Then determine This is normal sales volume; Step 133: Correct abnormal sales: like ,but ; like ,but ; Step 14: Differentiate between abnormal zero sales caused by genuine lack of demand and abnormal zero sales caused by stockouts or product removals, and mark abnormal zero sales accordingly; details are as follows: Step 141, for SKU in the first... Weekly sales In this case, obtain the out-of-stock or discontinued status of the SKU in the corresponding period; Step 142: If there are stockouts or products being removed from shelves during the week, resulting in zero sales, mark the week as having abnormal zero sales and set the zero sales flag zero_flag_t = 1. If the sales volume is zero due to genuine no demand in the current week, then the zero sales flag is set to zero_flag_t = 0. The zero sales flag generated under genuine no demand is used as a sparse feature of the SKU for training the meta-learning prediction model. Step 15: Normalize or standardize the processed sales sequence, sparse features, and basic features using Z-score to generate standardized sales sequence, sparse features, and basic features.

[0015] Furthermore, step 2 specifically includes: Step 21: Calculate the average sales volume and trend slope of each SKU within a preset time window. The specific method is as follows: (1) For each SKU, obtain its average sales over the most recent N weeks. The formula is as follows:

[0016] (2) For each SKU, the least squares method is used to calculate the sales volume. Linear fitting was performed to obtain the trend slope over the most recent N weeks. The formula is:

[0017] in, This represents the average of time indices over N weeks. The average sales volume over N weeks; Step 22: Based on average sales and trend slope SKUs are categorized into stable, fluctuating, or volatile types, with the following specific criteria: Let avg_sales_up be the preset upper limit of average sales volume, avg_sales_down be the preset lower limit of average sales volume, and slope_up be the preset slope threshold; (1) If avg_sales_up ≥ ≥ avg_sales_down, and | | ≤ slope_up, then determine the type of this SKU as a stable type SKU; (2) If < avg_sales_down and | | ≤ slope_up, or > avg_sales_up and | | ≤ slope_up, then determine the type of this SKU as a volatile type SKU; (3) If | | > slope_up, then determine the type of this SKU as an intense type SKU; Step 23: According to the determination results of the stable type, volatile type and intense type, encode the type of each SKU into the corresponding type coding feature; the type coding feature uses a one-hot vector, denoted as SKU_type_onehot; the dimension of the one-hot vector is 3, where the dimension corresponding to the type to which the SKU belongs takes the value of 1, and the remaining dimensions take the value of 0; Step 24: Use the type coding feature as a part of the input of the meta-learning prediction model, and perform vector splicing with the sales volume sequence, sparse features and basic features of the SKU to generate an extended SKU feature vector SKU_feature: SKU_feature = [sales volume sequence, sparse features, basic features, type coding feature].

[0018] Further, the specific steps of step 3 include: Step 31: Construct an SKU association graph G=(V, , W), where V is the set of nodes, is the set of edges, and W is the edge weight matrix; Take each SKU as a node, and denote the set of nodes as V = { , ,..., }, where is the total number of SKUs; for any two nodes and node , when and only when there is a potential demand association between the two, construct an edge between node and node All SKU pairs that meet the conditions constitute an edge set. The potential demand correlations include similarity in sales sequences, co-occurrence of non-zero sales, or correlation in trend slopes; wherein, The node number in the SKU association diagram, i.e., the [number]th node. One SKU; The node number in the SKU association diagram, i.e., the [number]th node. One SKU; =1,2,..., M ; =1,2,..., M ;and ≠ ; Step 32, based on sales volume The existence of similarity, co-occurrence of non-zero sales, and correlation of trend slopes are used to calculate the edge weights. The specific method is as follows: (1) Calculate using Pearson correlation coefficient, Spearman correlation coefficient or dynamic time warp distance. Sales Series and Sales Series similarity between ;in, For the first One SKU, For the first One SKU; (2) Calculation and Non-zero sales co-occurrence ratio The formula is:

[0019] (3) Calculation and Trend slope similarity The formula is: in, for The trend slope over the past N weeks, for The trend slope over the past N weeks, The maximum value of the slope difference of the midline trend across all SKUs is used to normalize the slope difference to the [0,1] interval; (4) The edge weights are calculated by weighted summation based on three dimensions: similarity of sales series, co-occurrence ratio of non-zero sales, and similarity of trend slope. The formula is:

[0020] in, , and These are the preset edge weight coefficients; Step 33: For each SKU node The graph neural network aggregates information from neighboring nodes, calculates the embedding vector, and concatenates it with the SKU feature vector to form the input feature vector; specifically as follows: (1) For each node in the SKU association graph Using graph neural networks to examine their neighbor nodes Information is aggregated, nodes In the Layer embedding vector The calculation formula is: in, The ReLU function is used as the activation function. For nodes The set of neighboring nodes; For nodes with neighboring nodes The boundary weight between; For graph neural networks The learnable weight matrix of the layer; Neighboring nodes In the The embedding vector of the layer, when When =0, Initialize to the basic characteristics of this SKU; For the first Layer bias vector; (2) After aggregation by a multi-layer graph neural network, the embedding vector output by the last layer is... This is concatenated with the feature vector of the SKU to form the final input feature vector. This is used as input to the meta-learning prediction model, and the final input feature vector is... The formula is:

[0021] in, For nodes SKU feature vectors.

[0022] Furthermore, step 4 specifically includes: Step 41: Treat each SKU as an independent meta-learning task; divide all meta-learning tasks into stationary, fluctuating, and intense task sets according to the SKU type; SKUs within each task set share the underlying network parameters; provide differentiated initial values ​​for the model parameters corresponding to the meta-learning task based on the stationary, fluctuating, or intense type of each SKU, so that SKUs of the same type have similar parameter initialization states; and divide the set according to the training set and query set, where the training set is used for the adaptation of the meta-learning prediction model within the meta-learning task, and the query set is used to evaluate the prediction performance after adaptation. Step 42: Input feature vectors from the training set The input is fed into a meta-learning prediction model, the structure of which includes at least one graph neural network layer and at least one fully connected layer. The graph neural network layer takes the input feature vector Use it as the initial node and combine it with the SKU association graph for in-task coding; (1) The node embedding update formula of the graph neural network layer is as follows:

[0023] Among them, when When =0, = ; (2) The fully connected layer maps the encoded features to the sales distribution parameters as output; the sales distribution parameters include the zero inflation probability. , distribution prediction mean and dispersion The formula for the fully connected layer is:

[0024] in, Represents a node Features encoded by an L-layer graph neural network This represents the total number of layers in a graph neural network. This represents the weight matrix of the fully connected layer, used to map the encoded features to the sales distribution parameter space; This represents the bias vector of the fully connected layer; This represents the output mapping function, used to transform the linear output of the fully connected layer so that the output result meets the value requirements of the sales distribution parameter; Represents a node The zero inflation probability of a corresponding SKU is used to characterize the probability that the SKU will have zero actual demand during the forecast period; Represents a node The distribution forecast mean of the corresponding SKU is used to characterize the baseline demand level of that SKU during the forecast period; Represents a node The dispersion of a corresponding SKU is used to characterize the degree of fluctuation in the sales volume of that SKU; Step 43: Jointly optimize and train the meta-learning prediction model using quantile loss and graph structure regularization, specifically including: (1) Calculate quantile loss The quantile loss Used to predict quantiles at different quantile levels, it is defined as:

[0025] in, This represents actual sales figures. For SKU at the quantile level The predicted quantiles below, ∈ (0,1) represents the quantile level; For each SKU, predict multiple quantile levels, including =0.1 corresponds to the P10 quantile, =0.5 corresponds to the P50 quantile and =0.9 corresponds to the P90 quantile; the sum of the quantile losses is the sum of the quantile losses at multiple quantile levels: (2) Define the graph structure regularization term as:

[0026] in, The preset regularization coefficient is used to control the weight of the graph structure regularization term in the total loss; The set of edges in the SKU association graph; For nodes connected by edges in the SKU association graph Embedded vector, For nodes connected by edges in the SKU association graph The embedding vector; For nodes With nodes The squared Euclidean distance between embedding vectors is used to measure the degree of difference between the feature vectors of two connected nodes. (3) The total loss function of the meta-learning prediction model The sum of quantile losses and the weighted sum of graph structure regularization terms: .

[0027] Furthermore, step 5 specifically includes: Step 51: Construct a distribution prediction model using a zero-inflation negative binomial distribution. The input to the distribution prediction model is the sales distribution parameters output by the meta-learning prediction model, including the zero-inflation probability. , distribution prediction mean and dispersion The output is the sales forecast distribution for this SKU within the forecast period. The sales forecast distribution The formula is:

[0028] in, The sales volume of a certain SKU during the forecast period is a non-negative integer. The value range is [0,1]; For indicator functions, when When =0, the value is 1; otherwise, the value is 0. It is the probability mass function of the negative binomial distribution; Step 52: Based on the zero inflation probability , distribution prediction mean and dispersion Given a zero-inflated negative binomial distribution, calculate multiple given quantiles as follows: (1) Define the cumulative distribution function F( ) of the zero-inflated negative binomial distribution. ):

[0029] in, This represents a random variable indicating the sales volume of a SKU within the forecast period; This represents the upper limit of sales volume and must be a non-negative number. Indicates a value from 0 to Sales enumeration values; The sales value is indicated. The predicted probability corresponding to the time; (2) For a given quantile level Given (0, 1), find the smallest integer that satisfies the following conditions. :

[0030] in, For this SKU at the quantile level The predicted quantiles below; if the quantile level =0.1, corresponding The P10 quantile represents the low demand boundary; if the quantile level =0.5, corresponding The P50 quantile represents the baseline demand level; if the quantile level =0.9, corresponding The P90 quantile represents the high demand frontier; Step 53: Use the predicted quantiles as the prediction interval, and the width of the prediction interval is adaptively adjusted according to the SKU type: For high-intensity SKUs, adjust the prediction interval width between the P10 quantile and the P90 quantile to be greater than the preset width; For stationary SKUs, the prediction interval width between the P10 quantile and the P90 quantile is smaller than the preset width. Step 54: The prediction of the zero inflation probability π is guided by the zero sales flag (zero_flag). During the training of the distribution prediction model, for a training sample with zero sales, if the corresponding zero sales flag (zero_flagt=1), the distribution prediction model is guided to reduce the zero inflation probability for that training sample. The dependence is attributed to the low prediction of the zero-inflated negative binomial distribution rather than the zero-inflated part; if the corresponding zero sales flag zero_flagt=0, the distribution prediction model is guided to increase the zero-inflated probability for that training sample. The assignment.

[0031] Furthermore, step 6 specifically includes: Step 61: Use KL divergence to detect distribution drift; the specific method is as follows: Calculate the current sales forecast distribution of SKUs within the current time window. Baseline sales forecast distribution of SKUs within the baseline time window The KL divergence between them is calculated using the following formula:

[0032] in, KL divergence is used to quantify the degree of deviation of the current sales forecast distribution from the baseline sales forecast distribution. The sales volume of a specific SKU during the forecast period, with values ​​ranging from 0 to... ; This is the preset maximum sales volume limit; This indicates that the sales value within the current time window is [value]. The predicted probability; This indicates that the sales value within the baseline time window is [value]. The predicted probability; It is a very small positive number, used to avoid the denominator being zero; Step 62: Compare the calculated KL divergence value with the preset drift judgment threshold threshold: If > threshold, it is determined that the current sales volume prediction distribution has shifted, and the hierarchical update strategy is triggered; if ≤ threshold, it is determined that the current sales volume prediction distribution has not shifted; the drift judgment threshold threshold is set according to the statistical results of historical sales data or business experience; Step 63: After completing the hierarchical update, conduct an effect evaluation; specifically as follows: (1) Calculate the quantile coverage rate , which is used to evaluate whether the prediction interval is reasonable, that is, to evaluate the coverage ability of the prediction interval composed of the P10 quantile and the P90 quantile for the true sales volume; the formula is:

[0033] Among them, is the prediction sample index, is the true sales volume of the rd prediction sample, is the total number of prediction samples; (2) When the quantile coverage rate is lower than the preset coverage rate target value, trigger the distribution recalibration process; when the quantile coverage rate is not lower than the preset coverage rate target value, obtain the P10 quantile, P50 quantile and P90 quantile that meet the conditions.

[0034] Furthermore, the hierarchical update strategy in Step 62 specifically includes: (1) Preset the lower threshold KLthread_down and upper threshold KLthread_up of the KL divergence value, where 0 < KLthread_down < KLthread_up; (2) According to the comparison results of the calculated KL divergence value with the lower threshold and upper threshold, divide the drift degree into three levels, and respectively execute the corresponding update strategies: The first level: slight drift, the judgment condition is that the KL divergence value < KLthread_down, and the incremental update strategy is executed: only fine-tune the model parameters of the meta-learning prediction model, and keep the graph structure and embedding vector unchanged; The second level: moderate drift, the judgment condition is KLthread_down ≤ KL divergence value ≤ KLthread_up, and the graph structure update strategy is executed: recalculate the edge weight matrix W of each edge in the SKU association graph, and use the updated edge weight matrix to re-aggregate neighbor information to obtain the updated embedding vector h i , while the model parameters of the meta-learning prediction model remain unchanged; Level 3: Drastic drift, the judgment condition is KL divergence value > KLthread_up, execute the model retraining strategy: use the latest data in the current time window to retrain the entire meta-learning prediction model and update all parameters.

[0035] Furthermore, the distribution recalibration process in step 63 is as follows: (1) Calculate the empirical distribution of actual sales within the current time window, and compare the empirical distribution with the sales forecast distribution. By comparison, zero sales deviation, mean deviation, and interval coverage deviation are obtained. Among them, zero sales deviation is used to measure the difference between the actual proportion of zero sales and the probability of zero inflation; mean deviation is used to measure the difference between the actual average sales and the distribution prediction mean; and interval coverage deviation is used to measure whether the proportion of actual sales falling into the predicted interval from the P10 quantile to the P90 quantile meets the preset coverage target value. (2) Adjust the zero-inflation probability in the zero-inflation negative binomial distribution based on the zero sales deviation, mean deviation, and interval coverage deviation. , distribution prediction mean and dispersion At least one of the following conditions shall be met, such that the coverage corresponding to the recalculated P10 quantile, P50 quantile and P90 quantile meets the preset coverage target value; (3) Update the forecast interval for the next time window using the adjusted sales distribution parameters; (4) Output the coverage metrics of the P10 quantile, P50 quantile and P90 quantile for each SKU.

[0036] Furthermore, step 7 specifically includes: Step 71: For each SKU, combine the P50 quantile with the current inventory I and the preset safety stock S to calculate the recommended replenishment quantity Q: ; Step 72: Set the P10 quantile as the lower limit threshold for inventory and the P90 quantile as the upper limit threshold for inventory to determine inventory risk. If the current inventory I is lower than the 10th percentile of P, a stockout risk is identified and a replenishment warning is triggered. Replenishment is then carried out according to the recommended replenishment quantity Q. If the current inventory I is between the 10th and 90th percentiles of P, follow the usual replenishment strategy and replenish according to the recommended replenishment quantity Q. If the current inventory I is higher than the 90th percentile of P, a high inventory risk is identified and an inventory backlog warning is triggered. Step 73: For high-intensity SKUs, dynamically increase the value of the safety stock S; for stable SKUs, dynamically decrease the value of the safety stock S.

[0037] By adopting the above technical solution, the present invention has the following beneficial effects compared with the prior art: 1. The predictive ability for long-tail SKUs has been significantly improved: This invention categorizes SKUs into stable, fluctuating, and volatile types by calculating the average sales volume and trend slope over the past N weeks, achieving hierarchical classification. This hierarchical information, combined with a meta-learning mechanism, enables the meta-learning prediction model to adapt rapidly to conditions with few samples or new SKUs, significantly improving the prediction accuracy and stability for long-tail SKUs.

[0038] 2. Strong cross-SKU information sharing capability: This invention constructs an SKU association graph based on sales similarity, co-occurrence relationships, and trend correlations, and aggregates neighbor information through a graph neural network to achieve cross-SKU information sharing. Low-frequency or cold-start SKUs can be predicted using historical patterns of similar SKUs, overcoming the information silo problem of "single-sequence modeling" in traditional methods.

[0039] 3. Comprehensive portrayal of demand uncertainty: This invention uses a zero-inflated negative binomial distribution (ZINB) to model SKU demand, outputting multiple quantile (P10, P50, P90) prediction results, and providing demand forecast intervals and uncertainty indicators. It can provide risk assessment and decision support for inventory upper and lower bounds and replenishment strategies, while existing point forecasting methods cannot provide similar uncertainty indicators.

[0040] 4. Strong dynamic adaptability: This invention employs a sliding window drift monitoring and hierarchical online update strategy: slight drift results in incremental parameter updates, moderate drift in updates to graph edge weights, and severe drift in retraining of the model. This ensures the model's continuous and stable operation under varying demand distributions, significantly improving the reliability and applicability of predictions.

[0041] 5. Rapid adaptation to small sample sizes and new SKUs: The meta-learning mechanism, combined with SKU hierarchical structure, enables the model to share parameters and adjust rapidly across tasks, achieving fast predictions for new or sparse SKUs. This solves the problem of unstable predictions in long-tail and cold-start scenarios of traditional methods.

[0042] 6. Comprehensive decision support capability: The output quantile prediction range is directly used for safety stock calculation, replenishment strategy optimization, and stockout risk warning. For high-volatility SKUs, a wide range is provided to cover volatility, while for stable SKUs, a narrow range ensures stability, supporting personalized decision-making for different SKU types. Attached Figure Description

[0043] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0044] Figure 1 This is an execution flowchart of a method for predicting long-tail demand for auto parts based on meta-learning and graph neural networks, provided in an embodiment of the present invention. Detailed Implementation

[0045] The present invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be particularly noted that the following embodiments are for illustrative purposes only and do not limit the scope of the invention. Similarly, the following embodiments are only some, not all, embodiments of the present invention, and all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0046] Please see Figure 1 The present invention provides a method for predicting long-tail demand for auto parts based on meta-learning and graph neural networks, comprising the following steps: Step 1, Data Acquisition and Standardization Preprocessing: Acquire historical sales data for multiple SKUs and perform preprocessing to generate standardized sales sequences, sparse features, and basic features; In this embodiment, step 1 specifically includes: Step 11: Collect historical sales data of SKUs (automotive parts) (e.g., data obtained from sales platforms, distribution networks, or supply chain systems) and align them to a uniform time granularity (e.g., weekly / monthly); simultaneously, obtain basic features as auxiliary inputs; the basic features include promotional information, pricing, and holiday information. Step 12, Missing Value Imputation: Based on the average sales volume of the SKU over the past N weeks and the percentage of zero sales, determine the SKU category. Then, according to the SKU category, use the corresponding imputation strategy (e.g., forward imputation or zero imputation) to impute missing values ​​in the historical sales data; details are as follows: Step 121: Calculate the average sales volume of each SKU over the most recent N weeks. The formula is as follows:

[0047] in, For the statistical period, Weekly index and =1,2,…, ; For SKU in the Weekly sales; Step 122: Calculate the percentage of zero sales for each SKU in the most recent N weeks. The formula is as follows:

[0048] Step 123: Based on average sales and zero sales percentage The size is used to fill in missing values: If the average sales volume is not less than the preset average threshold and the percentage of zero sales volume is less than the preset percentage of zero sales volume threshold, then the SKU is determined to be a high-frequency stable SKU, and the forward filling method is used to fill the missing values ​​in the historical sales data of the SKU. If the average sales volume is less than the preset average threshold or the percentage of zero sales is not less than the preset percentage of zero sales, then the SKU is identified as a long-tail sparse SKU, and the missing values ​​in the historical sales data of the SKU are filled by the zero-value filling method. Step 13, Outlier Handling: Truncate outlier sales data from historical sales records according to truncation rules and correct outlier sales; details are as follows: Step 131: For each SKU, calculate the average sales volume over the most recent N weeks within a preset time window. and standard deviation ; Step 132: Set the preset and The upper and lower limits for abnormal sales are used as the cutoff limits. Cutoff is performed based on these limits, and the cutoff rules are as follows: like or Then determine This is abnormal sales volume; like Then determine This is normal sales volume; Step 133: Correct abnormal sales: like ,but ; like ,but ; Step 14, Zero Sales Detection: Differentiate between abnormal zero sales caused by genuine lack of demand and abnormal zero sales caused by stockouts or product removals. Mark abnormal zero sales to ensure the validity of the training samples; details are as follows: Step 141, for SKU in the first... Weekly sales In this case, obtain the out-of-stock or discontinued status of the SKU in the corresponding period; Step 142: If there are stockouts or products being removed from shelves during the week, resulting in zero sales, mark the week as having abnormal zero sales and set the zero sales flag zero_flag_t = 1. If the sales volume is zero due to genuine no demand in the current week, then the zero sales flag is set to zero_flag_t = 0. The zero sales flag generated under genuine no demand is used as a sparse feature of the SKU for training the meta-learning prediction model. This processing ensures the validity of the training data while preserving the true demand patterns of SKUs, which is beneficial for model learning and predicting the sparse features of long-tail SKUs.

[0049] Step 15, Feature Standardization: Normalize or Z-score standardize the processed sales sequence, sparse features, and basic features to generate standardized sales sequence, sparse features, and basic features, ensuring that features can be compared between different SKUs.

[0050] Step 2, SKU Scale Hierarchy and Trend Slope Analysis: Based on the average sales volume and trend slope of each SKU within a preset time window, each SKU is divided into different types, generating corresponding type encoding features, which are then concatenated with the sales volume sequence, sparse features, and basic features to form the SKU feature vector. The features extracted in this step will directly determine the initialization strategy and the calculation of graph network edge weights for subsequent meta-learning tasks.

[0051] In this embodiment, step 2 specifically includes: Step 21: Calculate metrics: Calculate the average sales volume and trend slope for each SKU within a preset time window. The specific method is as follows: (1) For each SKU, obtain its average sales over the most recent N weeks. The formula is as follows:

[0052] (2) For each SKU, the least squares method is used to calculate the sales volume. Linear fitting was performed to obtain the trend slope over the most recent N weeks. The formula is:

[0053] in, This represents the average of time indices over N weeks. The average sales volume over N weeks; Recent average sales ( ): Calculate the average daily or weekly effective sales of the target SKU within a set time window of N weeks.

[0054] Trend slope ( : Use the least squares method to perform linear fitting on the effective sales volume within the sliding window, and extract the slope of the fitting line to characterize the growth or decline rate of short-term demand.

[0055] Step 22, SKU type determination: According to the average sales volume and the trend slope divide the SKUs into stable type, fluctuating type or intense type. The specific determination rules are as follows: Let avg_sales_up be the preset upper limit of the average sales volume, avg_sales_down be the preset lower limit of the average sales volume, and slope_up be the preset slope threshold; (1) If avg_sales_up ≥ ≥ avg_sales_down, and | | ≤ slope_up, then determine the type of this SKU as a stable type SKU; (2) If < avg_sales_down and | | ≤ slope_up, or > avg_sales_up and | | ≤ slope_up, then determine the type of this SKU as a fluctuating type SKU; (3) If | | > slope_up, then determine the type of this SKU as an intense type SKU; Note: Stable type SKU: The average sales volume is medium to high and the trend is stable; Fluctuating type SKU: The average sales volume is low, but the trend is stable; Intense type SKU: The fluctuation is obvious; Step 23, type encoding: According to the determination results of the stable type, fluctuating type and intense type, encode the type of each SKU into the corresponding type encoding feature; the type encoding feature uses a one-hot vector, denoted as SKU_type_onehot; the dimension of the one-hot vector is 3, where the dimension corresponding to the type to which the SKU belongs takes the value of 1, and the remaining dimensions take the value of 0; Step 24, feature enhancement: The type encoding feature, as a part of the input of the meta-learning prediction model, is vector concatenated with the sales volume sequence, sparse features and basic features of the SKU to generate an extended SKU feature vector SKU_feature: SKU_feature = [sales volume sequence, sparse features, basic features, type encoding feature] The output is a fixed-dimensional vector for each SKU, which is used for subsequent meta-learning task partitioning and condition parameter initialization to accelerate the rapid adaptation of SKUs with few samples.

[0056] Step 3: SKU Association Graph Construction: Using each SKU as a node, construct an SKU association graph based on the potential demand associations between SKUs. Use a graph neural network to aggregate the information of neighboring nodes to obtain the embedding vector of each SKU, and concatenate it with the SKU feature vector to form the input feature vector. In this embodiment, step 3 specifically includes: Step 31: Construct the SKU association graph G=(V, ,W), where V is the set of nodes, Let W be the set of edges, and W be the edge weight matrix. Each SKU is a node, and the set of nodes is denoted as V={ , ,..., },in, The total number of SKUs; for any two nodes and nodes At node , if and only if there is a potential demand relationship between the two With nodes Constructing edges between All SKU pairs that meet the conditions constitute an edge set. The potential demand correlations include similarity in sales sequences, co-occurrence of non-zero sales, or correlation in trend slopes; wherein, The node number in the SKU association diagram, i.e., the [number]th node. One SKU; The node number in the SKU association diagram, i.e., the [number]th node. One SKU; =1,2,..., M ; =1,2,..., M ;and ≠ ; Step 32, based on sales volume The existence of similarity, co-occurrence of non-zero sales, and correlation of trend slopes are used to calculate the edge weights. The specific method is as follows: (1) Calculate using Pearson correlation coefficient, Spearman correlation coefficient or dynamic time warp distance. Sales Series and Sales Series similarity between ;in, For the first One SKU, For the first One SKU; (2) Calculation and Non-zero sales co-occurrence ratio The formula is:

[0057] (3) Calculation and Trend slope similarity The formula is: in, for The trend slope over the past N weeks, for The trend slope over the past N weeks, The maximum value of the slope difference of the midline trend across all SKUs is used to normalize the slope difference to the [0,1] interval; (4) The edge weights are calculated by weighted summation based on three dimensions: similarity of sales series, co-occurrence ratio of non-zero sales, and similarity of trend slope. The formula is:

[0058] in, , and These are the preset edge weight coefficients; Step 33: For each SKU node The graph neural network aggregates information from neighboring nodes, calculates the embedding vector, and concatenates it with the SKU feature vector to form the input feature vector; specifically as follows: (1) For each node in the SKU association graph Using graph neural networks to examine their neighbor nodes Information is aggregated, nodes In the Layer embedding vector The calculation formula is: in, The ReLU function is used as the activation function. For nodes The set of neighboring nodes; For nodes with neighboring nodes The boundary weight between; For graph neural networks The learnable weight matrix of the layer; Neighboring nodes In the The embedding vector of the layer, when When =0, Initialize to the basic characteristics of this SKU; For the first Layer bias vector; (2) After aggregation by a multi-layer graph neural network, the embedding vector output by the last layer is... This is concatenated with the feature vector of the SKU to form the final input feature vector. This is used as input to the meta-learning prediction model, and the final input feature vector is... The formula is:

[0059] in, For nodes SKU feature vectors.

[0060] Step 4: Construct a meta-learning prediction model: Divide the meta-learning tasks according to the type of SKU, and use quantile loss and graph structure regularization to jointly optimize based on the input feature vector to train the meta-learning prediction model and output the sales distribution parameters. In this embodiment, step 4 specifically includes: Step 41, Task Partitioning: Treat each SKU as an independent meta-learning task; divide all meta-learning tasks into stationary, fluctuating, and intense task sets according to the SKU type; SKUs within each task set share the underlying network parameters; based on the stationary, fluctuating, or intense type of each SKU, provide differentiated initial values ​​for the model parameters corresponding to that meta-learning task, so that SKUs of the same type have similar parameter initialization states; and partition according to training set and query set, where the training set is used for the adaptation of the meta-learning prediction model within the meta-learning task, and the query set is used to evaluate the prediction performance after adaptation; Step 42: Input feature vectors from the training set The input is fed into a meta-learning prediction model, the structure of which includes at least one graph neural network layer and at least one fully connected layer. The graph neural network layer takes the input feature vector Use it as the initial node and combine it with the SKU association graph for in-task coding; (1) The node embedding update formula of the graph neural network layer is as follows:

[0061] Among them, when When =0, = ; (2) The fully connected layer maps the encoded features to the sales distribution parameters as output; the sales distribution parameters include the zero inflation probability. , distribution prediction mean and dispersion The formula for the fully connected layer is:

[0062] in, Represents a node Features encoded by an L-layer graph neural network This represents the total number of layers in a graph neural network. This represents the weight matrix of the fully connected layer, used to map the encoded features to the sales distribution parameter space; This represents the bias vector of the fully connected layer; This represents the output mapping function, used to transform the linear output of the fully connected layer so that the output result meets the value requirements of the sales distribution parameter; Represents a node The zero inflation probability of a corresponding SKU is used to characterize the probability that the SKU will have zero actual demand during the forecast period; Represents a node The distribution forecast mean of the corresponding SKU is used to characterize the baseline demand level of that SKU during the forecast period; Represents a node The dispersion of a corresponding SKU is used to characterize the degree of fluctuation in the sales volume of that SKU; Step 43, Training Optimization: During training, quantile loss and graph structure regularization are used to jointly optimize the training of the meta-learning prediction model, specifically including: (1) Calculate quantile loss The quantile loss To predict quantiles at different quantile levels (e.g., P10, P50, P90), the prediction interval for the SKU can be obtained, which is defined as:

[0063] in, This represents actual sales figures. For SKU at the quantile level The predicted quantiles below, ∈ (0,1) represents the quantile level; For each SKU, predict multiple quantile levels, including =0.1 corresponds to the P10 quantile, =0.5 corresponds to the P50 quantile and =0.9 corresponds to the P90 quantile; the sum of the quantile losses is the sum of the quantile losses at multiple quantile levels: (2) Define the graph structure regularization term as:

[0064] in, The preset regularization coefficient is used to control the weight of the graph structure regularization term in the total loss; The set of edges in the SKU association graph; For nodes connected by edges in the SKU association graph Embedded vector, For nodes connected by edges in the SKU association graph The embedding vector; For nodes With nodes The squared Euclidean distance between embedding vectors is used to measure the degree of difference between the feature vectors of two connected nodes. (3) The total loss function of the meta-learning prediction model The sum of quantile losses and the weighted sum of graph structure regularization terms: .

[0065] The purpose of quantile loss is to minimize the deviation of the predicted distribution interval from the actual sales value. Graph structure regularization ensures the smoothness of node embedding vectors and incorporates neighbor information. The total loss function... Its purpose is to enable the meta-learning prediction model to accurately represent the SKU sales distribution and maintain the consistency of the relationship between SKUs by using the prediction output of SKU feature vectors and SKU association graphs.

[0066] Step 5, Distribution Prediction and Risk Range: Based on the sales distribution parameters, construct a distribution prediction model and calculate the sales forecast distribution for each SKU within the prediction period; In this embodiment, step 5 specifically includes: Step 51: Construct a distribution prediction model using the zero-inflated negative binomial distribution (ZINB). The input to the distribution prediction model is the sales distribution parameters output by the meta-learning prediction model, including the zero-inflated probability. , distribution prediction mean and dispersion The output is the sales forecast distribution for this SKU within the forecast period. The sales forecast distribution The formula is:

[0067] in, The sales volume of a certain SKU during the forecast period is a non-negative integer. The value range is [0,1]; For indicator functions, when When =0, the value is 1; otherwise, the value is 0. It is the probability mass function of the negative binomial distribution; Step 52: Based on the zero inflation probability , distribution prediction mean and dispersion Given a zero-inflated negative binomial distribution, calculate multiple given quantiles as follows: (1) Define the cumulative distribution function F( ) of the zero-inflated negative binomial distribution. ):

[0068] in, This represents a random variable indicating the sales volume of a SKU within the forecast period; This represents the upper limit of sales volume and must be a non-negative number. Indicates a value from 0 to Sales enumeration values; The sales value is indicated. The predicted probability corresponding to the time; (2) For a given quantile level Given (0, 1), find the smallest integer that satisfies the following conditions. :

[0069] in, For this SKU at the quantile level The predicted quantiles below; if the quantile level =0.1, corresponding The P10 quantile represents the low demand boundary; if the quantile level =0.5, corresponding The P50 quantile represents the baseline demand level; if the quantile level =0.9, corresponding The P90 quantile represents the high demand frontier; Step 53: Use the predicted quantiles as the prediction interval, and the width of the prediction interval is adaptively adjusted according to the SKU type: For high-intensity SKUs, adjust the prediction interval width between the P10 quantile and the P90 quantile to be greater than the preset width; For stationary SKUs, the prediction interval width between the P10 quantile and the P90 quantile is smaller than the preset width. Step 54: The prediction of the zero inflation probability π is guided by the zero sales flag (zero_flag). During the training of the distribution prediction model, for a training sample with zero sales, if the corresponding zero sales flag (zero_flagt=1), the distribution prediction model is guided to reduce the zero inflation probability for that training sample. The dependence is attributed to the low prediction of the zero-inflated negative binomial distribution rather than the zero-inflated part; if the corresponding zero sales flag zero_flagt=0, the distribution prediction model is guided to increase the zero-inflated probability for that training sample. The assignment.

[0070] Step 6: Calculate the KL divergence between the current sales forecast distribution and the baseline sales forecast distribution, and execute a tiered update strategy based on the magnitude of the KL divergence. In this embodiment, step 6 specifically includes: Step 61, Sliding window detection: KL divergence is used for distribution drift detection; the specific method is as follows: Calculate the current sales forecast distribution of SKUs within the current time window. Baseline sales forecast distribution of SKUs within the baseline time window The KL divergence between them is calculated using the following formula:

[0071] in, KL divergence is used to quantify the degree of deviation of the current sales forecast distribution from the baseline sales forecast distribution. The sales volume of a specific SKU during the forecast period, with values ​​ranging from 0 to... ; This is the preset maximum sales volume limit; This indicates that the sales value within the current time window is [value]. The predicted probability; This indicates that the sales value within the baseline time window is [value]. The predicted probability; It is a very small positive number, used to avoid the denominator being zero; Step 62, Hierarchical Update Strategy: Compare the calculated KL divergence value with the preset drift judgment threshold: like If the threshold is exceeded, it is determined that the current sales forecast distribution has shifted, triggering a tiered update strategy; if If it is less than the drift judgment threshold, it is determined that the current sales volume prediction distribution does not deviate; the drift judgment threshold is set according to the statistical results of historical sales data or business experience; In this embodiment, the hierarchical update strategy specifically includes: (1) Preset the lower threshold KLthread_down and the upper threshold KLthread_up of the KL divergence value, where 0 < KLthread_down < KLthread_up; (2) According to the comparison results of the calculated KL divergence value with the lower threshold and the upper threshold, the degree of drift is divided into three levels, and the corresponding update strategies are executed respectively: The first level: slight drift, the judgment condition is that the KL divergence value < KLthread_down, and the incremental update strategy is executed: only fine-tune the model parameters of the meta-learning prediction model, and keep the graph structure and the embedding vector unchanged; The second level: medium drift, the judgment condition is that KLthread_down ≤ KL divergence value ≤ KLthread_up, and the graph structure update strategy is executed: recalculate the edge weight matrix W of each edge in the SKU association graph, and use the updated edge weight matrix to re-aggregate the neighbor information to obtain the updated embedding vector h i while the model parameters of the meta-learning prediction model remain unchanged; The third level: severe drift, the judgment condition is that the KL divergence value > KLthread_up, and the model retraining strategy is executed: use the latest data in the current time window to retrain the entire meta-learning prediction model and update all parameters.

[0072] Step 63, after completing the hierarchical update, perform an effect evaluation; specifically as follows: (1) Calculate the quantile coverage rate , which is used to evaluate whether the prediction interval is reasonable, that is, to evaluate the coverage ability of the prediction interval formed by the P10 quantile and the P90 quantile for the true sales volume; the formula is:

[0073] Among them, is the prediction sample index, is the true sales volume of the th prediction sample, is the total number of prediction samples; (2) When the quantile coverage rate is lower than the preset coverage rate target value, trigger the distribution recalibration process; when the quantile coverage rate is not lower than the preset coverage rate target value, obtain the P10 quantile, P50 quantile and P90 quantile that meet the conditions.

[0074] In this embodiment, the distribution recalibration process is as follows: (1) Calculate the empirical distribution of actual sales within the current time window, and compare the empirical distribution with the sales forecast distribution. By comparison, zero sales deviation, mean deviation, and interval coverage deviation are obtained. Among them, zero sales deviation is used to measure the difference between the actual proportion of zero sales and the probability of zero inflation; mean deviation is used to measure the difference between the actual average sales and the distribution prediction mean; and interval coverage deviation is used to measure whether the proportion of actual sales falling into the predicted interval from the P10 quantile to the P90 quantile meets the preset coverage target value. (2) Adjust the zero-inflation probability in the zero-inflation negative binomial distribution based on the zero sales deviation, mean deviation, and interval coverage deviation. , distribution prediction mean and dispersion At least one of the following conditions shall be met, such that the coverage corresponding to the recalculated P10 quantile, P50 quantile and P90 quantile meets the preset coverage target value; (3) Update the forecast interval for the next time window using the adjusted sales distribution parameters to ensure the effectiveness of the forecast for the next time window; (4) Output the coverage metrics of the P10 quantile, P50 quantile and P90 quantile for each SKU.

[0075] Step 7: Perform inventory management based on the predicted range of the sales forecast distribution.

[0076] In this embodiment, step 7 specifically includes: Step 71: For each SKU, combine the P50 quantile with the current inventory I and the preset safety stock S to calculate the recommended replenishment quantity Q: ; Step 72: Set the P10 quantile as the lower limit threshold for inventory and the P90 quantile as the upper limit threshold for inventory to determine inventory risk. If the current inventory I is lower than the 10th percentile of P, a stockout risk is identified and a replenishment warning is triggered. Replenishment is then carried out according to the recommended replenishment quantity Q. If the current inventory I is between the 10th and 90th percentiles of P, follow the usual replenishment strategy and replenish according to the recommended replenishment quantity Q. If the current inventory I is higher than the 90th percentile of P, a high inventory risk is identified and an inventory backlog warning is triggered. Step 73: For high-intensity SKUs, dynamically increase the value of the safety stock S; for stable SKUs, dynamically decrease the value of the safety stock S.

[0077] The output of this step is: the upper and lower limits of the target SKU's inventory, the suggested replenishment quantity, and the procurement recommendation, thereby achieving a closed-loop output of the forecast results to inventory management, procurement planning, and replenishment decisions.

[0078] Basic concept explanation: noun definition Remark SKU (Stock Keeping Unit) The smallest unit of inventory used to uniquely identify a single automotive part. The core prediction and monitoring object of this invention. Long-tailed sparse SKUs This refers to SKUs with sparse historical sales data, a high percentage of zero sales, drastic demand fluctuations, and limited historical samples. This invention focuses on overcoming the challenges of predicting scenarios. Zero sales flag (Flag_zero) The core engineering variable introduced in this invention is recorded as 1 (abnormal) when the sales volume in a certain period is 0 and the system status is "out of stock / removed from shelves", otherwise it is recorded as 0 (true zero demand). Used to filter data noise and as a direct guiding feature for model learning of the zero-inflation probability π in the ZINB distribution. SKU type Based on the set average sales threshold and trend slope threshold, the business rules dynamically classify SKUs into "stable", "fluctuating" and "intense" types. It serves as the sole basis for meta-learning task partitioning, one-hot feature encoding, and conditional initialization of model parameters. SKU Association Graph G=(V, E, W) A weighted graph structure consisting of multiple SKU nodes and their potential relationships. Its edge weights W combine historical sales similarity, the co-occurrence ratio of non-zero sales, and trend slope correlation. This is used to break down information silos in single sequences, enabling low-frequency SKUs to share demand characteristics of similar high-frequency SKUs through GNN. GNN (Graph Neural Network) A deep learning architecture specifically designed for processing graph-structured data, which aggregates information from neighboring nodes through the transformation of weights between network layers. This is used to extract the graph embedding feature vector of the target SKU in the above association graph, thereby improving the generalization ability. Meta-Learning The mechanism aims to enable the model to "learn how to learn." It achieves this by sharing underlying parameters across tasks (across SKUs) and by combining a support set / query set mechanism. This enables the system to achieve rapid adaptive prediction when faced with a small number of samples or newly launched cold-start SKUs. ZINB distribution The zero-inflated negative binomial distribution is a statistical distribution controlled by three core parameters: the zero-inflated probability π, the mean μ, and the dispersion r. This perfectly describes the extreme demand distribution characteristics of long-tail auto parts products: "either they don't sell (zero inflation), or they fluctuate greatly (high dispersion) when they do." P10, P50, P90 The three key quantiles were determined based on the predicted ZINB cumulative distribution function. P10 is the lower bound of demand (to prevent stockouts), P50 is the median of the baseline forecast (to determine procurement), and P90 is the upper bound of demand (to prevent overstocking). Data drift This refers to the statistically significant shift in the probability distribution of SKU sales predicted by the model within the current sliding window relative to the distribution of the historical baseline window (usually measured by KL divergence). As a trigger condition for online monitoring, a hierarchical response strategy is implemented based on the divergence magnitude, including parameter fine-tuning, edge weight updates, or model retraining. Quantile coverage The core evaluation metric of the model refers to the percentage of samples whose actual sales fall within the model's predicted range [P10, P90] within a certain evaluation period. It is used to continuously evaluate the effectiveness of the prediction interval and trigger online recalibration of the distribution parameters when the coverage is not up to standard. Safety stock (S) Supply chain business terminology refers to the amount of buffer inventory reserved to cope with delivery delays or sudden surges in demand. It is used in conjunction with the predicted value P50 to calculate the recommended replenishment quantity, and the system can dynamically amplify the coefficient based on whether the SKU is "intense".

[0079] The above description is only a part of the embodiments of the present invention and does not limit the scope of protection of the present invention. Any equivalent device or equivalent process transformation made based on the content of the present invention specification and drawings, or direct or indirect application in other related technical fields, are similarly included within the patent protection scope of the present invention.

Claims

1. A method for predicting long-tail demand for auto parts based on meta-learning and graph neural networks, characterized in that, Includes the following steps: Step 1: Obtain historical sales data for multiple SKUs and preprocess them to generate standardized sales sequences, sparse features, and basic features; Step 2: Based on the average sales volume and trend slope of each SKU within a preset time window, classify each SKU into different types, generate corresponding type coding features, and concatenate them with sales sequence, sparse features and basic features to form SKU feature vector; Step 3: Using each SKU as a node, construct an SKU association graph based on the potential demand relationships between SKUs. Utilize a graph neural network to aggregate information from neighboring nodes, obtaining the embedding vector for each SKU. Concatenate this embedding vector with the SKU feature vector to form the input feature vector. Specifically, this includes: Step 31: Construct the SKU association graph G=(V, ,W), where V is the set of nodes, Let W be the set of edges, and W be the edge weight matrix. Each SKU is a node, and the set of nodes is denoted as V={ , ,..., },in, The total number of SKUs; for any two nodes and nodes At node , if and only if there is a potential demand relationship between the two With nodes Constructing edges between All SKU pairs that meet the conditions constitute an edge set. The potential demand correlations include similarity in sales sequences, co-occurrence of non-zero sales, or correlation in trend slopes; wherein, The node number in the SKU association diagram, i.e., the [number]th node. One SKU; The node number in the SKU association diagram, i.e., the [number]th node. One SKU; =1,2,..., M ; =1,2,..., M ;and ≠ ; Step 32, based on sales volume The existence of similarity, co-occurrence of non-zero sales, and correlation of trend slopes are used to calculate the edge weights. The specific method is as follows: (1) Calculate using Pearson correlation coefficient, Spearman correlation coefficient or dynamic time warp distance. Sales Series and Sales Series similarity between ;in, For the first One SKU, For the first One SKU; (2) Calculation and Non-zero sales co-occurrence ratio The formula is: (3) Calculation and Trend slope similarity The formula is: in, for The trend slope over the past N weeks, for The trend slope over the past N weeks, The maximum value of the slope difference of the midline trend across all SKUs is used to normalize the slope difference to the [0,1] interval; (4) The edge weights are calculated by weighted summation based on three dimensions: similarity of sales series, co-occurrence ratio of non-zero sales, and similarity of trend slope. The formula is: in, , and These are the preset edge weight coefficients; Step 33: For each SKU node The graph neural network aggregates information from neighboring nodes, calculates the embedding vector, and concatenates it with the SKU feature vector to form the input feature vector. Step 4: Divide the meta-learning tasks according to the SKU type, and use quantile loss and graph structure regularization to jointly optimize based on the input feature vector to train the meta-learning prediction model to output sales distribution parameters. Step 5: Construct a distribution prediction model based on the sales distribution parameters, and calculate the sales prediction distribution of each SKU within the prediction period; Step 6: Calculate the KL divergence between the current sales forecast distribution and the baseline sales forecast distribution, and execute a tiered update strategy based on the magnitude of the KL divergence. Step 7: Perform inventory management based on the predicted range of the sales forecast distribution.

2. The method for predicting long-tail demand for auto parts based on meta-learning and graph neural networks as described in claim 1, characterized in that, Step 1 specifically includes: Step 11: Collect historical sales data for SKUs and align them to a uniform time granularity; simultaneously, acquire basic features as auxiliary inputs; the basic features include promotional information, price, and holiday information. Step 12: Determine the SKU category based on the average sales volume and the percentage of zero sales over the past N weeks. Then, use the corresponding imputation strategy to fill in missing values ​​in the historical sales data according to the SKU category; the details are as follows: Step 121: Calculate the average sales volume of each SKU over the most recent N weeks. The formula is as follows: in, For the statistical period, Weekly index and =1,2,…, ; For SKU in the Weekly sales; Step 122: Calculate the percentage of zero sales for each SKU in the most recent N weeks. The formula is as follows: Step 123: Based on average sales and zero sales percentage The size is used to fill in missing values: If the average sales volume is not less than the preset average threshold and the percentage of zero sales volume is less than the preset percentage of zero sales volume threshold, then the SKU is determined to be a high-frequency stable SKU, and the forward filling method is used to fill the missing values ​​in the historical sales data of the SKU. If the average sales volume is less than the preset average threshold or the percentage of zero sales is not less than the preset percentage of zero sales, then the SKU is identified as a long-tail sparse SKU, and the missing values ​​in the historical sales data of the SKU are filled by the zero-value filling method. Step 13: Truncate abnormal sales data from historical sales records according to the truncation rules, and correct the abnormal sales; details are as follows: Step 131: For each SKU, calculate the average sales volume over the most recent N weeks within a preset time window. and standard deviation ; Step 132: Set the preset and The upper and lower limits for abnormal sales are used as cutoff values. Cutoff is performed based on these limits, with the following rules: like or Then determine This is abnormal sales volume; like Then determine This is normal sales volume; Step 133: Correct abnormal sales: like ,but ; like ,but ; Step 14: Differentiate between abnormal zero sales caused by genuine lack of demand and abnormal zero sales caused by stockouts or product removals, and mark abnormal zero sales accordingly; details are as follows: Step 141, for SKU in the first... Weekly sales In this case, obtain the out-of-stock or discontinued status of the SKU in the corresponding period; Step 142: If there are stockouts or products being removed from shelves during the week, resulting in zero sales, mark the week as having abnormal zero sales and set the zero sales flag zero_flag_t = 1. If the sales volume is zero due to genuine no demand in the current week, then the zero sales flag is set to zero_flag_t = 0. The zero sales flag generated under genuine no demand is used as a sparse feature of the SKU for training the meta-learning prediction model. Step 15: Normalize or standardize the processed sales sequence, sparse features, and basic features using Z-score to generate standardized sales sequence, sparse features, and basic features.

3. The method for predicting long-tail demand for auto parts based on meta-learning and graph neural networks as described in claim 1, characterized in that, Step 2 specifically includes: Step 21: Calculate the average sales volume and trend slope of each SKU within a preset time window. The specific method is as follows: (1) For each SKU, obtain its average sales over the most recent N weeks. The formula is as follows: (2) For each SKU, the least squares method is used to calculate the sales volume. Linear fitting was performed to obtain the trend slope over the most recent N weeks. The formula is: in, This represents the average of time indices over N weeks. The average sales volume over N weeks; Step 22: Based on average sales and trend slope SKUs are categorized into stable, fluctuating, or volatile types, with the following specific criteria: Let avg_sales_up be the preset upper limit of average sales, avg_sales_down be the preset lower limit of average sales, and slope_up be the preset slope threshold. (1) If avg_sales_up≥ ≥avg_sales_down, and | If |≤slope_up, then the SKU is classified as a stationary SKU; (2) If <avg_sales_down and | | ≤ slope_up, or > avg_sales_up and | | ≤ slope_up, then determine the type of this SKU as a volatile SKU; (3) If | If the value is slope_up, then the SKU type is determined to be an aggressive SKU; Step 23: Based on the determination results of the stable, fluctuating, and intense types, encode the type of each SKU into a corresponding type encoding feature; the type encoding feature adopts a one-hot vector, denoted as SKU_type_onehot; the dimension of the one-hot vector is 3, where the dimension corresponding to the type of the SKU is 1, and the other dimensions are 0; Step 24: The type-encoded feature is used as part of the input to the meta-learning prediction model, and is concatenated with the SKU sales sequence, sparse features, and basic features to generate the expanded SKU feature vector SKU_feature: SKU_feature=[sales sequence, sparse features, basic features, type encoding features].

4. The method for predicting long-tail demand for auto parts based on meta-learning and graph neural networks as described in claim 1, characterized in that, Step 33 is as follows: (1) For each node in the SKU association graph Using a graph neural network to its neighbor nodes Information is aggregated, nodes In the Layer embedding vector The calculation formula is: in, The ReLU function is used as the activation function. For nodes The set of neighboring nodes; For nodes with neighboring nodes The boundary weights between them; For graph neural networks The learnable weight matrix of the layer; For neighboring nodes In the The embedding vector of the layer, when When =0, Initialize to the basic characteristics of this SKU; For the first Layer bias vector; (2) After aggregation by a multi-layer graph neural network, the embedding vector output by the last layer is... This is concatenated with the feature vector of the SKU to form the final input feature vector. This is used as input to the meta-learning prediction model, and the final input feature vector is... The formula is: in, For nodes SKU feature vectors.

5. The method for predicting long-tail demand for auto parts based on meta-learning and graph neural networks as described in claim 4, characterized in that, Step 4 specifically includes: Step 41: Treat each SKU as an independent meta-learning task; divide all meta-learning tasks into stationary, fluctuating, and intense task sets according to the SKU type; SKUs within each task set share the underlying network parameters; provide differentiated initial values ​​for the model parameters corresponding to the meta-learning task based on the stationary, fluctuating, or intense type of each SKU, so that SKUs of the same type have similar parameter initialization states; and divide the set according to the training set and query set, where the training set is used for the adaptation of the meta-learning prediction model within the meta-learning task, and the query set is used to evaluate the prediction performance after adaptation. Step 42: Input feature vectors from the training set The input is fed into a meta-learning prediction model, the structure of which includes at least one graph neural network layer and at least one fully connected layer. The graph neural network layer takes the input feature vector Use it as the initial node and combine it with the SKU association graph for in-task coding; (1) The node embedding update formula of the graph neural network layer is as follows: Among them, when When =0, = ; (2) The fully connected layer maps the encoded features to the sales distribution parameters as output; the sales distribution parameters include the zero inflation probability. , distribution prediction mean and dispersion The formula for the fully connected layer is: in, Represents a node Features encoded by an L-layer graph neural network This represents the total number of layers in a graph neural network. This represents the weight matrix of the fully connected layer, used to map the encoded features to the sales distribution parameter space; This represents the bias vector of the fully connected layer; This represents the output mapping function, used to transform the linear output of the fully connected layer so that the output result meets the value requirements of the sales distribution parameter; Represents a node The zero inflation probability of a corresponding SKU is used to characterize the probability that the SKU will have zero actual demand during the forecast period; Represents a node The distribution forecast mean of the corresponding SKU is used to characterize the baseline demand level of that SKU during the forecast period; Represents a node The dispersion of a corresponding SKU is used to characterize the degree of fluctuation in the sales volume of that SKU; Step 43: Jointly optimize and train the meta-learning prediction model using quantile loss and graph structure regularization, specifically including: (1) Calculate the quantile loss The quantile loss Used to predict quantiles at different quantile levels, it is defined as: in, This represents actual sales figures. For SKU at the quantile level The predicted quantiles below, ∈ (0,1) represents the quantile level; For each SKU, predict multiple quantile levels, including =0.1 corresponds to the P10 quantile, =0.5 corresponds to the P50 quantile and =0.9 corresponds to the P90 quantile; the sum of the quantile losses is the sum of the quantile losses at multiple quantile levels: (2) Define the graph structure regularization term as: in, The preset regularization coefficient is used to control the weight of the graph structure regularization term in the total loss; The set of edges in the SKU association graph; For nodes connected by edges in the SKU association graph Embedded vector, For nodes connected by edges in the SKU association graph The embedding vector; For nodes With nodes The squared Euclidean distance between embedding vectors is used to measure the degree of difference between the feature vectors of two connected nodes; (3) The total loss function of the meta-learning prediction model The sum of quantile losses and the weighted sum of graph structure regularization terms: 。 6. The method for predicting long-tail demand for auto parts based on meta-learning and graph neural networks as described in claim 1, characterized in that, Step 5 specifically includes: Step 51: Construct a distribution prediction model using a zero-inflation negative binomial distribution. The input to the distribution prediction model is the sales distribution parameters output by the meta-learning prediction model, including the zero-inflation probability. , distribution prediction mean and dispersion The output is the sales forecast distribution for this SKU within the forecast period. The sales forecast distribution The formula is: in, The sales volume of a certain SKU during the forecast period is a non-negative integer. The value range is [0,1]; For indicator functions, when When =0, the value is 1; otherwise, the value is 0. It is the probability mass function of the negative binomial distribution; Step 52: Based on the zero inflation probability , distribution prediction mean and dispersion Given a zero-inflated negative binomial distribution, calculate multiple given quantiles as follows: (1) Define the cumulative distribution function F( ) of the zero-inflated negative binomial distribution. ): in, This represents a random variable indicating the sales volume of a SKU within the forecast period; This represents the upper limit of sales volume and must be a non-negative number. Indicates a value from 0 to Sales enumeration values; The sales value is indicated. The predicted probability corresponding to the time; (2) For a given quantile level Given (0, 1), find the smallest integer that satisfies the following conditions. : in, For this SKU at the quantile level The predicted quantiles below; if the quantile level =0.1, corresponding The P10 quantile represents the low demand boundary; if the quantile level =0.5, corresponding The P50 quantile represents the baseline demand level; if the quantile level =0.9, corresponding The P90 quantile represents the high demand frontier; Step 53: Use the predicted quantiles as the prediction interval, and the width of the prediction interval is adaptively adjusted according to the SKU type: For high-intensity SKUs, adjust the prediction interval width between the P10 quantile and the P90 quantile to be greater than the preset width; For stationary SKUs, the prediction interval width between the P10 quantile and the P90 quantile is smaller than the preset width. Step 54: The prediction of the zero inflation probability π is guided by the zero sales flag (zero_flag). During the training of the distribution prediction model, for a training sample with zero sales, if the corresponding zero sales flag (zero_flagt=1), the distribution prediction model is guided to reduce the zero inflation probability for that training sample. The dependence is attributed to the low prediction of the zero-inflated negative binomial distribution rather than the zero-inflated part; if the corresponding zero sales flag zero_flagt=0, the distribution prediction model is guided to increase the zero-inflated probability for that training sample. The assignment.

7. The method for predicting long-tail demand for auto parts based on meta-learning and graph neural networks as described in claim 3, characterized in that, Step 6 specifically includes: Step 61: Use KL divergence to detect distribution drift; the specific method is as follows: Calculate the current sales forecast distribution of SKUs within the current time window. Baseline sales forecast distribution of SKUs within the baseline time window The KL divergence between them is calculated using the following formula: in, KL divergence is used to quantify the degree of deviation of the current sales forecast distribution from the baseline sales forecast distribution. The sales volume of a specific SKU during the forecast period, with values ​​ranging from 0 to... ; This is the preset maximum sales volume limit; This indicates that the sales value within the current time window is [value]. The predicted probability; The sales value within the baseline time window is indicated. The predicted probability; It is a very small positive number, used to avoid the denominator being zero; Step 62: Compare the calculated KL divergence value with the preset drift judgment threshold: like If the threshold is exceeded, it is determined that the current sales forecast distribution has shifted, triggering a tiered update strategy; if If the threshold is used, it is determined that the current sales forecast distribution has not shifted; the drift judgment threshold is set based on the statistical results of historical sales data or business experience. Step 63: After completing the tiered update, conduct an effectiveness evaluation; details are as follows: (1) Calculate the quantile coverage This is used to assess whether the forecast interval is reasonable, that is, to evaluate the coverage of actual sales by the forecast interval formed by the P10 quantile and the P90 quantile; the formula is: in, To predict the sample index, For the first The actual sales of a predicted sample To predict the total number of samples; (2) When the quantile coverage rate is lower than the preset coverage rate target value, trigger the distribution recalibration process; when the quantile coverage rate is not lower than the preset coverage rate target value, obtain the P10 quantile, P50 quantile, and P90 quantile that meet the conditions.

8. The method for predicting long-tail demand for auto parts based on meta-learning and graph neural networks as described in claim 7, characterized in that, The hierarchical update strategy in step 62 specifically includes: (1) Preset the lower threshold KLthread_down and upper threshold KLthread_up of the KL divergence value, where 0 < KLthread_down < KLthread_up; (2) According to the comparison results of the calculated KL divergence value with the lower threshold and upper threshold, divide the degree of drift into three levels and execute the corresponding update strategies respectively: The first level: slight drift, the judgment condition is that the KL divergence value < KLthread_down, and execute the incremental update strategy: only fine-tune the model parameters of the meta-learning prediction model, and keep the graph structure and embedding vector unchanged; Level 2: Moderate drift, the criterion is KLthread_down ≤ KL divergence value ≤ KLthread_up, and the graph structure update strategy is executed: recalculate the edge weight matrix W of each edge in the SKU association graph, and re-aggregate the neighbor information using the updated edge weight matrix to obtain the updated embedding vector h. i Meanwhile, the model parameters of the meta-learning prediction model remain unchanged; The third level: severe drift, the judgment condition is that the KL divergence value > KLthread_up, and execute the model retraining strategy: use the latest data in the current time window to retrain the entire meta-learning prediction model and update all parameters.

9. The method for predicting long-tail demand for auto parts based on meta-learning and graph neural networks as described in claim 7, characterized in that, The distribution recalibration process in step 63 is as follows: (1) Calculate the empirical distribution of actual sales within the current time window, and compare the empirical distribution with the sales forecast distribution. By comparison, zero sales deviation, mean deviation, and interval coverage deviation are obtained. Among them, zero sales deviation is used to measure the difference between the actual proportion of zero sales and the probability of zero inflation; mean deviation is used to measure the difference between the actual average sales and the distribution prediction mean; and interval coverage deviation is used to measure whether the proportion of actual sales falling into the predicted interval from the P10 quantile to the P90 quantile meets the preset coverage target value. (2) Adjust the zero-inflation probability in the zero-inflation negative binomial distribution based on the zero sales deviation, mean deviation, and interval coverage deviation. , distribution prediction mean and dispersion At least one of the following conditions shall be met, such that the coverage corresponding to the recalculated P10 quantile, P50 quantile and P90 quantile meets the preset coverage target value; (3) Update the prediction interval of the next time window using the adjusted sales distribution parameters; (4) Output the coverage rate indicators of the P10 quantile, P50 quantile, and P90 quantile for each SKU.

10. The method for predicting long-tail demand for auto parts based on meta-learning and graph neural networks as described in claim 7, characterized in that, Step 7 specifically includes: Step 71: For each SKU, combine the P50 quantile with the current inventory I and the preset safety stock S to calculate the recommended replenishment quantity Q: ; Step 72: Set the P10 quantile as the lower inventory threshold and the P90 quantile as the upper inventory threshold, and perform inventory risk determination: If the current inventory I is lower than the P10 quantile, it is determined that there is a shortage risk and a replenishment warning is triggered, and replenishment is carried out according to the recommended replenishment quantity Q; If the current inventory I is between the P10 quantile and the P90 quantile, execute according to the conventional replenishment strategy, and replenish according to the recommended replenishment quantity Q; If the current inventory I is higher than the P90 quantile, it is determined that there is a high inventory risk and an inventory backlog warning is triggered; Step 73: For aggressive SKUs, dynamically increase the value of the safety stock S; for stable SKUs, dynamically reduce the value of the safety stock S.

Citation Information

Patent Citations

  • Commodity sales prediction method and system based on improved neural network

    CN120931324A

  • Long-tail SKU sales prediction method and system

    CN121414416A