Intelligent inventory early warning method and device, electronic equipment and storage medium
By collecting multi-source data, using the sales forecast network and order delivery time forecast model to calculate safety stock, and combining the isolation forest algorithm and causal inference model for multi-dimensional anomaly detection, the problems of insufficient real-time and accuracy of inventory warnings are solved, and more efficient inventory management is achieved.
Patent Information
- Application Number
- CN202511154840.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-08-18
- Publication Date
- 2025-10-17
AI Technical Summary
Existing inventory early warning methods lack real-time performance, which can easily lead to inventory backlogs or out-of-stock risks. They also fail to effectively utilize multi-dimensional data for early warning, resulting in insufficient early warning accuracy.
By collecting multi-source data, including time series features, static features and supplier data, the safety stock is calculated using the sales forecast network and order delivery time forecast model, and the isolation forest algorithm and causal inference model are combined to perform multi-dimensional anomaly detection and early warning.
It improves the real-time nature of inventory warnings, reduces the risk of inventory backlogs or out-of-stocks, and enhances the accuracy and response speed of warnings.
Smart Images

Figure CN120806820A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of inventory early warning, and in particular to an intelligent inventory early warning method and device, an electronic device and a storage medium. BACKGROUND
[0002] Under the background of the booming development of e-commerce and the accelerated iteration of smart logistics, enterprise inventory management is facing unprecedented challenges. The surge in multi-category SKUs, the dramatic fluctuations in high-frequency orders, and the constant rise in supply chain complexity make it difficult for traditional inventory management models to meet the needs of efficient enterprise operations. Traditional inventory early warning methods either rely too much on manual experience to set safety inventory thresholds or use simple statistical models based on historical sales data, such as moving average and exponential smoothing. Such methods have obvious limitations in responding to real-time market demand changes.
[0003] At present, the closest existing implementation scheme is an inventory early warning system based on a rule engine. The typical process is as follows: first, static threshold setting, the staff manually sets the upper and lower inventory threshold according to historical sales through formulas such as "safety inventory = average daily sales * lead time"; then, regular data collection, information such as inventory quantity and order data is collected at fixed intervals, such as daily or weekly; finally, rule matching and early warning, when the inventory quantity is lower than the lower limit or higher than the upper limit, the system sends early warning information through the ERP system.
[0004] However, the above scheme has the following defects:
[0005] Threshold setting lag: static thresholds are difficult to adapt to sudden changes in market demand, such as the surge in sales caused by live streaming, which can easily lead to inventory accumulation or stockout risks.
[0006] Multidimensional data missing: only historical sales data is considered, without considering external factors such as supply chain delays, competitor dynamics, and weather sentiment, resulting in a significant reduction in early warning accuracy.
[0007] Insufficient real-time response: the regular collection mechanism cannot capture minute-level order fluctuations in time, such as the second killing activities during the big promotion, which can easily delay the replenishment opportunity.
[0008] Lack of self-optimization: the system cannot learn from historical early warning results, and the early warning rules gradually lose effectiveness over time. SUMMARY
[0009] The present application provides an intelligent inventory early warning method, device, electronic device and storage medium, which solves the technical problem of insufficient real-time of existing inventory early warning methods, which can easily lead to inventory accumulation or stockout risks.
[0010] The application provides an intelligent inventory early warning method, comprising:
[0011] Collecting multi-source data related to inventory, wherein the multi-source data comprises time series features, static features and supplier data;
[0012] Inputting the time series features and the static features into a preset sales prediction network to output predicted sales;
[0013] Inputting the supplier data into a preset order delivery time prediction model to output order delivery time and delay prediction value;
[0014] Calculating safety stock according to the predicted sales, the order delivery time and the delay prediction value;
[0015] Performing inventory early warning according to the safety stock.
[0016] Optionally, the training process of the sales prediction network comprises:
[0017] Obtaining historical time series features and pre-training weights;
[0018] Inputting the historical time series features into an initial sales prediction network to extract context features from the historical time series features through an encoder;
[0019] Converting the context features into predicted sales distribution through a decoder;
[0020] Judging whether the current iteration number meets a preset iteration threshold;
[0021] If not, calculating a loss function, adjusting model parameters of the initial sales prediction network according to the loss function, and returning to the step of inputting the historical time series features into the initial sales prediction network to extract context features from the historical time series features through the encoder;
[0022] If yes, outputting the initial sales prediction network as a trained sales prediction network.
[0023] Optionally, the safety stock calculation formula is as follows:
[0024]
[0025] wherein, is a service level coefficient, is a sales standard deviation, is an order delivery time, is a delay prediction value, is a buffer factor.
[0026] Optionally, the step of performing inventory early warning according to the safety stock comprises:
[0027] perform multi-dimensional anomaly detection on the preset indicators through the isolation forest algorithm and the safe inventory, to obtain an anomaly detection result;
[0028] According to the anomaly detection result and a preset causal inference model, an influencing factor of the anomaly detection result is determined;
[0029] According to the influencing factor, an anomaly early warning is generated.
[0030] Optionally, the method further comprises:
[0031] An indicator value of a preset early warning indicator is calculated;
[0032] According to the indicator value, parameters of the sales prediction network, the order delivery time prediction model, the preset causal inference model and the isolation forest algorithm are optimized.
[0033] The application further provides an intelligent inventory early warning device, comprising:
[0034] A multi-source data acquisition module is configured to acquire multi-source data related to inventory, wherein the multi-source data comprises time series features, static features and supplier data;
[0035] A sales prediction module is configured to input the time series features and the static features into a preset sales prediction network, and output predicted sales;
[0036] An order delivery time and delay prediction value calculation module is configured to input the supplier data into a preset order delivery time prediction model, and output order delivery time and delay prediction values;
[0037] A safe inventory calculation module is configured to calculate a safe inventory according to the predicted sales, the order delivery time and the delay prediction values;
[0038] An inventory early warning module is configured to perform inventory early warning according to the safe inventory.
[0039] Optionally, the training process of the sales prediction network comprises:
[0040] A historical time series feature and pre-training weight acquisition module is configured to acquire historical time series features and pre-training weights;
[0041] A context feature extraction module is configured to input the historical time series features into an initial sales prediction network, and extract context features from the historical time series features through an encoder;
[0042] A conversion module is configured to convert the context features into a predicted sales distribution through a decoder;
[0043] A judgment module is configured to judge whether a current iteration number meets a preset iteration threshold;
[0044] a return module, configured to, if no, calculate a loss function, adjust model parameters of the initial sales volume prediction network according to the loss function, and return to the step of inputting the historical time-series features into the initial sales volume prediction network and extracting context features from the historical time-series features by the encoder;
[0045] a sales volume prediction network determination module, configured to, if yes, output the initial sales volume prediction network as a trained sales volume prediction network.
[0046] Optionally, the inventory early warning module comprises:
[0047] an anomaly detection submodule, configured to perform multi-dimensional anomaly detection on preset indexes by an isolation forest algorithm and the safety stock, to obtain an anomaly detection result;
[0048] an influence factor determination submodule, configured to determine an influence factor of the anomaly detection result according to the anomaly detection result and a preset causal inference model;
[0049] an anomaly early warning generation submodule, configured to generate an anomaly early warning according to the influence factor.
[0050] The application further provides an electronic device, which comprises a processor and a memory:
[0051] The memory is configured to store program code and transmit the program code to the processor;
[0052] The processor is configured to execute the intelligent inventory early warning method according to the instructions in the program code.
[0053] The application further provides a computer readable storage medium, which is configured to store program code, and the program code is configured to execute the intelligent inventory early warning method.
[0054] It can be seen from the above technical solutions that the application has the following advantages: the application collects multi-source data related to inventory, the multi-source data comprising time-series features, static features and supplier data; the time-series features and the static features are input into a preset sales volume prediction network, and a predicted sales volume is output; the supplier data is input into a preset order delivery time prediction model, and a predicted order delivery time and a delay prediction value are output; safety stock is calculated according to the predicted sales volume, the predicted order delivery time and the delay prediction value; and inventory early warning is performed according to the safety stock. The real-time performance of inventory early warning is improved, and the risk of inventory backlog or stockout is reduced. BRIEF DESCRIPTION OF DRAWINGS
[0055] In order to make the technical solutions in the embodiments of the present application or the prior art clearer, the accompanying drawings needed in the embodiments or prior art description will be briefly introduced. Obviously, the accompanying drawings in the following description only represent some embodiments of the present application, and all other drawings obtained by those of ordinary skill in the art without creative effort based on these drawings belong to the protection scope of the present application.
[0056] Figure 1 A step flow chart of a smart inventory early warning method provided by an embodiment of the present application.
[0057] Figure 2 A step flow chart of a smart inventory early warning method provided by another embodiment of the present application.
[0058] Figure 3 A structural block diagram of a smart inventory early warning device provided by an embodiment of the present application. DETAILED DESCRIPTION
[0059] The embodiments of the present application provide a smart inventory early warning method, device, electronic equipment and storage medium, and are used for solving the technical problem that the real-time performance of the existing inventory early warning method is insufficient and is easy to cause inventory backlog or out-of-stock risk.
[0060] In order to make the technical solutions in the embodiments of the present application or the prior art clearer, the accompanying drawings needed in the embodiments or prior art description will be briefly introduced. Obviously, the accompanying drawings in the following description only represent some embodiments of the present application, and all other drawings obtained by those of ordinary skill in the art without creative effort based on these drawings belong to the protection scope of the present application.
[0061] Please refer to Figure 1 , Figure 1 A step flow chart of a smart inventory early warning method provided by an embodiment of the present application.
[0062] The smart inventory early warning method provided by the present application can specifically include the following steps.
[0063] In step 101, multi-source data related to inventory is collected, and the multi-source data includes time sequence features, static features and supplier data.
[0064] In the embodiment of the present application, the multi-source data can be derived from internal data, external data and Internet of Things device data. The internal data includes ERP system inventory data, OMS order data, WMS warehouse entry and exit records, and the collection frequency can be 100 ms; the external data can include the logistics status of the supply chain (such as supplier delivery delay rate) obtained through API, competitor price fluctuation, social media public opinion, weather data, etc.; the Internet of Things devices include smart shelf sensors, RFID tags, etc.
[0065] Through the above data sources, multi-source data related to inventory can be collected, including but not limited to time series features, static features and supplier data. The time series features include historical sales data (in hourly / day granularity, with a window length of 30-90 days), inventory variation, order conversion rate, promotion activity flag (0 / 1); the static features include product category, specification attribute, supplier ID, warehouse geographic location code.
[0066] Step 102, input the time series features and static features into a preset sales prediction network, and output a predicted sales;
[0067] In the embodiment of the present application, the sales prediction network can be constructed using the Transformer architecture. The input is the collected time series features and static features, and the output is the sales probability distribution of the next 7 days.
[0068] Step 103, input the supplier data into a preset order delivery time prediction model, and output an order delivery time and a delay prediction value;
[0069] In the embodiment of the present application, the order delivery time prediction model can be constructed using the random forest algorithm, and the input of the order delivery time prediction model is the supplier data in the multi-source data, and the output is the order delivery time and the delay prediction value.
[0070] The order delivery time refers to how long it takes to complete the delivery of goods, and the delay prediction value refers to how many days of delayed delivery the goods may have.
[0071] Step 104, calculate the safety stock according to the predicted sales, order delivery time and delay prediction value;
[0072] Step 105, perform inventory warning according to the safety stock.
[0073] After the predicted sales, order delivery time and delay prediction value are calculated, the safety stock can be calculated according to the predicted sales, order delivery time and delay prediction value. When the inventory does not meet the safety stock or the expected inventory does not meet the safety stock, inventory warning is performed.
[0074] The application collects multi-source data related to inventory, the multi-source data including time sequence features, static features and supplier data; inputs the time sequence features and the static features into a preset sales prediction network to output predicted sales; inputs the supplier data into a preset order delivery time prediction model to output order delivery time and delay prediction values; calculates safety stock according to the predicted sales, the predicted order delivery time and the delay prediction values; and performs inventory early warning according to the safety stock. The real-time performance of the inventory early warning is improved, and the risk of inventory backlog or stockout is reduced.
[0075] Please refer to Figure 2 , Figure 2 A step flowchart of an intelligent inventory early warning method provided for another embodiment of the application. Specifically, the method can include the following steps:
[0076] Step 201, collecting multi-source data related to inventory, the multi-source data including time sequence features, static features and supplier data;
[0077] Step 201 is the same as step 101, and specific descriptions can be referred to the description of step 101, which will not be repeated here.
[0078] Step 202, inputting the time sequence features and the static features into a preset sales prediction network to output predicted sales;
[0079] In the embodiment of the application, the sales prediction network can be constructed by using a Transformer architecture. The input of the Transformer architecture is the collected time sequence features and static features, and the output is the sales probability distribution of the next 7 days.
[0080] In one example, the construction process of the sales prediction network constructed by using the Transformer architecture is as follows:
[0081] 1. Input layer design:
[0082] The input data includes time sequence features and static features:
[0083] Time sequence features: historical sales (in hourly / day granularity, window length is set to 30-90 days), inventory variation, order conversion rate, promotion activity flag (0 / 1).
[0084] Static features: product category, specification attribute, supplier ID, warehouse geographic location code.
[0085] Feature preprocessing: standardization (Z-score) is performed on the time sequence features, and one-hot encoding or embedding (Embedding) is performed on the static features, and finally, the features are spliced into a tensor with a dimension of [batch_size, seq_len, feature_dim].
[0086] 2. Encoder (encoding) layer construction:
[0087] 6-layer Transformer Encoder stack, each layer contains:
[0088] Multi-head self-attention mechanism: with 8 attention heads, it calculates the correlation weights of different time step sales data to capture long and short term dependencies (such as seasonal fluctuations, promotion cycle effects).
[0089] Position encoding: add sine and cosine position information to solve the problem of Transformer's insensitivity to time sequence order.
[0090] Feedforward neural network (FFN): composed of 2 linear layers + ReLU activation function, dimension from 512→2048→512.
[0091] 3、Decoder (decoding) layer:
[0092] 3-layer Transformer Decoder, input is the output feature of Encoder and the placeholder of future 7 days;
[0093] Output layer through linear layer + Softmax activation, output the probability distribution of future 7 days daily sales (such as the probability of predicting the 3rd day sales is 100-120 pieces is 70%).
[0094] 4、Loss function design:
[0095] Because it needs to output probability distribution, negative log likelihood loss (NLL Loss) is used, combined with L2 regularization to suppress overfitting, the formula is: \(Loss=-\sum_{t=1}^{7}\sum_{k}y_{t,k}\log(\hat{y}_{t,k})+\lambda\sum\theta^2\) where, \(y_{t,k}\) is the one-hot encoding of the actual value of the sales of the tth day, \(\hat{y}_{t,k}\) is the predicted probability, \(\lambda\) is the regularization coefficient.
[0096] Based on the above architecture, the training process of the sales prediction network includes:
[0097] S11, obtain historical time series features and pre-trained weights;
[0098] S12, input historical time series features into the initial sales prediction network, and extract context features from historical time series features through the encoder;
[0099] S13, convert the context features to predicted sales distribution through the decoder;
[0100] S14, determine whether the current iteration number meets the preset iteration threshold;
[0101] S15, if not, calculate the loss function, adjust the model parameters of the initial sales prediction network according to the loss function, and return to the step of inputting the historical time series features into the initial sales prediction network and extracting the context features from the historical time series features through the encoder;
[0102] S16, if yes, output the initial sales prediction network as a trained sales prediction network.
[0103] In a specific implementation, the training process is as follows:
[0104] 1. Data preparation:
[0105] Training set: historical data of the past 3 years (divided into training / validation / test sets according to 7:2:1), including normal sales period and special nodes (such as Double 11, 618);
[0106] Data augmentation: time shift (±1-3 days), sales scaling (±5%-10%) and other operations on the training set to simulate sales fluctuation scenarios.
[0107] Training parameter settings:
[0108] Optimizer: AdamW, initial learning rate 5e-5, using cosine annealing scheduling;
[0109] Batch size (batch_size): 128, iteration rounds (epochs): 100, early stopping strategy (patience=10);
[0110] Hardware environment: 8x NVIDIA A100 GPU, mixed precision training acceleration.
[0111] Training steps:
[0112] Initialize model parameters, load pre-trained weights (optional: fine-tune after pre-training using public retail data sets);
[0113] Each iteration:
[0114] Input historical time series features, extract context features through Encoder;
[0115] Decoder predicts future 7-day sales distribution based on Encoder output;
[0116] Calculate the loss function, and update the parameters through backpropagation;
[0117] Evaluate the prediction accuracy (such as MAE, RMSE) on the validation set, and save the optimal model.
[0118] It should be noted that in the training process, in addition to using historical time sequence characteristics as input characteristics, auxiliary characteristics and supplementary characteristics can also be used.
[0119] Auxiliary characteristics: supply chain delay rate, competitor price fluctuation, social media heat, etc. as external influencing factors, integrated into the input characteristics to improve the prediction robustness (such as the peak of public opinion corresponding to the surge in sales).
[0120] Supplementary features: real-time inventory data of smart shelves are used to correct the noise of historical sales (such as the deviation between actual outbound quantity and system record), and RFID data are used to assist in judging the efficiency of commodity circulation.
[0121] Step 203, input the supplier data into the preset order delivery time prediction model, and output the order delivery time and delay prediction value;
[0122] In the embodiment of the application, the order delivery time prediction model can be constructed by using a random forest algorithm, and the input of the order delivery time prediction model is the supplier data in the multi-source data, and the output is the order delivery time and delay prediction value.
[0123] The construction process of the order delivery time prediction model constructed based on the random forest algorithm is as follows:
[0124] 1. Feature selection and data preprocessing:
[0125] Input characteristics: historical Lead Time (order delivery time) data (supplier delivery cycle, unit: days).
[0126] Supply chain characteristics: supplier historical delay rate, production capacity (capacity utilization rate), logistics mode (air / land / sea, coded as 0 / 1 / 2);
[0127] External characteristics: weather data (such as extreme weather markers such as rainstorm / tornado), holiday factors (whether it is a logistics peak period, such as marking 1 for 45 days before the Spring Festival), regional epidemic control level (0-3 levels);
[0128] Order characteristics: order quantity (matching degree with supplier capacity), emergency order marker (0 / 1).
[0129] Data cleaning: KNN filling is used for missing Lead Time values, and truncation processing is performed on abnormal values (such as extreme delay outside 3σ); one-hot encoding is performed on category characteristics (such as logistics mode), and normalization (Min-Max) is performed on numerical characteristics (such as order quantity).
[0130] 2. Model structure design:
[0131] 100 CART decision trees are used to form a random forest, the maximum depth of each tree is set to 10-15 (to avoid overfitting), and the minimum sample number of a leaf node is set to 5;
[0132] Feature sampling: 80% of samples and 60% of features are randomly selected during the training of each tree (to reduce the correlation between trees);
[0133] The output is the lead time prediction value (continuous value, unit: day) of future procurement, and the prediction interval (such as 95% confidence interval) is attached
[0134] 3. Model training and optimization:
[0135] Training set: supplier delivery records in the past 2 years (training set and validation set are divided according to 8:2);
[0136] Loss function: mean squared error (MSE) is used to evaluate the prediction effect;
[0137] Hyperparameter optimization: the number of trees, maximum depth, minimum split sample size and other parameters are adjusted through grid search (Grid Search), and the model with the minimum MSE of the validation set is finally selected.
[0138] 4. Prediction output:
[0139] Normal order delivery time (L): the benchmark delivery cycle based on the current supply chain status;
[0140] Delay prediction value (ΔL): the potential delay days calculated by the prediction interval (such as the difference between the upper limit of the 95% confidence interval and L).
[0141] L reflects the benchmark delivery cycle of the supply chain, which is the basis for calculating the replenishment buffer period. For example, if the predicted L is 5 days, it means that it takes 5 days from ordering to warehousing.
[0142] The role of ΔL is to capture the uncertainty of the supply chain (such as sudden delay), and to enlarge the buffer space of safety stock. For example, if L=5 days and ΔL=2 days (the prediction may be delayed for 2 days), the total cycle inside the square root in the formula becomes 7 days, and the corresponding inventory fluctuation risk ( ) will be greater than the risk when only L is considered ( ), thereby avoiding stockout caused by delay.
[0143] Step 204, calculating safety stock according to predicted sales, order delivery time and delay prediction value;
[0144] In the embodiments of the present application, the safety stock calculation formula is as follows:
[0145]
[0146] wherein, is a service level coefficient, is a sales standard deviation, is an order delivery time, is a delay prediction value, is a buffer factor.
[0147] In step 205, multi-dimensional anomaly detection is performed on the preset indicators by the isolation forest algorithm and safety stock, and an anomaly detection result is obtained.
[0148] The core of the isolation forest algorithm is to form a forest by constructing multiple isolated trees (iTree), and to make the abnormal points be isolated earlier in the tree structure by using the sparse distribution characteristics of the abnormal points in the feature space.
[0149] In the embodiment of the present application, multi-dimensional anomaly detection can be performed on multiple preset indicators by the isolation forest algorithm, and an anomaly detection result is obtained.
[0150] The preset indicators can include three types, including inventory status indicators, operation efficiency indicators and supply chain coordination indicators.
[0151] The inventory status indicators include actual inventory quantity (current warehouse physical inventory + in-transit inventory), inventory availability rate (available inventory to total inventory ratio), inventory backlog days (storage time of goods exceeding safety stock) and out-of-stock frequency (number of times that actual inventory is 0 in a certain period).
[0152] The operation efficiency indicators include inventory turnover rate (ratio of sales cost to average inventory), inventory turnover days (365 days divided by inventory turnover rate), order fulfillment rate (ratio of actual shipped order quantity to total order quantity) and moving sales rate (ratio of SKU number with sales record to total SKU number).
[0153] The supply chain coordination indicators include replenishment on-time rate (ratio of on-time replenishment order quantity to total replenishment order quantity), supplier delivery delay rate (ratio of delayed delivery order quantity to total purchase order quantity), inventory accuracy rate (ratio of actual inventory to system recorded inventory) and emergency replenishment proportion (ratio of emergency replenishment order quantity to total order quantity).
[0154] Each indicator has a threshold value, but when the indicator is not within the threshold value range, it indicates that the indicator is abnormal, and at this time, the anomaly needs to be traced and analyzed to select the corresponding warning method.
[0155] For example, when the actual inventory quantity is lower than the safety inventory threshold, a warning will be triggered, and the specific level is determined according to the difference size, such as triggering an "emergency warning" when the actual inventory quantity is lower than 30% of the threshold, and triggering a "warning" when the actual inventory quantity is lower than 10% of the threshold; if the actual inventory quantity is higher than the safety threshold and exceeds the reasonable upper limit, and the backlog days exceed the set value, an inventory backlog warning may be triggered.
[0156] In actual scenarios, the safety inventory is updated in real time with multi-source data (such as when the sales forecast changes or the supply chain delay risk rises, the safety inventory is dynamically adjusted), and the inventory quantity is synchronized in real time through multi-source data collection, and the real-time comparison of the two ensures the timeliness and accuracy of the warning. For example, during a large promotion, the sales forecast surges, causing the safety inventory to increase, at which time if the actual inventory quantity does not increase synchronously, the system will quickly identify and trigger a replenishment warning.
[0157] Step 206, determining the influencing factors of the abnormal detection result according to the abnormal detection result and a preset causal inference model;
[0158] In the embodiments of the present application, in combination with the collected multi-source data and the inventory management scenario, the influencing factors of the anomaly can be divided into the following 4 categories (a total of 12 specific factors):
[0159] 1. Internal operation factors:
[0160] Promotion activities: discount strength, activity duration, and promotion channel coverage;
[0161] Inventory operations: warehouse entry record errors, warehouse exit sorting delays, and inventory deviation;
[0162] Order strategy: purchase limit rule adjustment, delivery area change, and sudden increase in return rate.
[0163] 2. Supply chain factors:
[0164] Supplier status: production capacity fluctuation, raw material shortage, and quality inspection pass rate decline;
[0165] Logistics link: transportation route congestion, warehouse sorting efficiency, and delivery service provider replacement;
[0166] Purchasing plan: replenishment cycle adjustment, minimum order quantity change, and emergency purchase frequency.
[0167] 3. Market environment factors:
[0168] Competitor dynamics: competitor price reduction, overlapping promotion activities, and new product launch;
[0169] Demand fluctuation: seasonal consumption change, holiday peak avoidance, and regional preference shift;
[0170] Public opinion influence: deterioration of social media reputation, product quality complaint, and KOL recommendation change.
[0171] 4. External factors:
[0172] Weather disasters: heavy rain causes logistics disruption, high temperature affects fresh food preservation;
[0173] Policy changes: regional administrative policies, import and export tariff adjustments, environmental compliance requirements;
[0174] Technical failure: ERP system downtime, payment interface exception, smart shelf sensor failure.
[0175] The embodiment of the application can associate the anomaly and the influencing factor based on the causal inference model of the DAG structure, so that when the anomaly is determined, the specific influencing factor can be determined through the causal inference model.
[0176] The generation process of the causal inference model based on the DAG structure is as follows:
[0177] 1. DAG structure initialization:
[0178] Build node set: contains 12 abnormal indicators (such as "inventory quantity sudden drop") and the above-mentioned 12 influencing factors, forming a directed acyclic graph (DAG) of 24 nodes;
[0179] Pre-set initial edge: define prior causal relationship based on domain knowledge (such as "logistics congestion" → "delayed replenishment" → "inventory sudden drop", "competitor price reduction" → "order volume sudden drop" → "inventory accumulation"), the weight of the edge is initialized to 0.1-0.3 (indicating the correlation strength).
[0180] 2. Causal relationship learning:
[0181] Data input: historical abnormal event records provided by the multi-source data collection layer (including abnormal indicator values, influencing factor states, and timestamps), forming a time series data set (such as "2023-11-11 00:00 inventory sudden drop" corresponding to "logistics congestion = 1, promotion order volume = 5000");
[0182] Structure learning algorithm: PC algorithm (Peter-Clark) is used to optimize the DAG structure:
[0183] Based on conditional independence test (such as mutual information, chi-square test), delete the edges with no statistical correlation (such as "environmental policy" and "clothing inventory turnover rate" have no significant correlation);
[0184] Correct the direction through the time sequence logic (such as "promotion activity starts" occurs before "order volume surges", then the edge direction is "promotion activity" → "order volume surges");
[0185] Compute edge weights: Fit conditional probability distributions (e.g., P(stockout | logistics congestion = 1) = 0.7) using maximum likelihood estimation, and update weights as conditional probability values.
[0186] 3. Abnormal root cause tracing:
[0187] Abnormal trigger: When the Isolation Forest algorithm identifies an anomaly (e.g., the "stock quantity sudden drop" indicator exceeds the threshold), the abnormal node is taken as the "result node" of the DAG;
[0188] Reverse trace path: Starting from the result node, traverse all possible upstream factors along the reverse edges of the DAG, and calculate the "causal contribution degree": \(Contribution\_degree = \prod_{i=1}^{n} edge\_weight_i \times factor\_occurrence\_probability\) (Example: "stockout" <- "restocking delay" (weight 0.6) <- "logistics congestion" (weight 0.8), and the occurrence probability of logistics congestion is 0.9, then the contribution degree = 0.6 × 0.8 × 0.9 = 0.432).
[0189] Output root cause: Filter the top 3 factors with the highest contribution degree as the main root causes (e.g., "logistics congestion (43.2%)", "promotion order exceeds expectation (31.5%)", and "sorting efficiency decline (18.3%)").
[0190] 4. Dynamic optimization:
[0191] Real-time update: When a new abnormal event occurs and is resolved, its causal relationship data (e.g., "sensor failure" -> "inventory counting error") is fed back to the model, and the edge weights of the DAG are updated through the EM algorithm (Expectation Maximization);
[0192] Knowledge graph fusion: Store high-frequency causal paths (e.g., "live streaming e-commerce" -> "order surge" -> "inventory shortage") in the knowledge graph as a priority reference for future root cause tracing.
[0193] Step 207, generating abnormal warning according to influencing factors.
[0194] After determining the influencing factors, the corresponding abnormal warning information can be generated. Among them, the abnormal warning can include four-level warning mechanism of emergency, warning, attention, and normal, for example, the out-of-stock risk will trigger an emergency warning.
[0195] Further, the embodiment of the present application further comprises: calculating the index value of the preset warning index; and optimizing the parameters of the sales volume prediction network, the order delivery time prediction model, the preset causal inference model, and the isolation forest algorithm according to the index value.
[0196] In specific implementation, 8 indicators such as accuracy and response timeliness can be established to evaluate the warning effect, and then a reinforcement learning algorithm (such as PPO) is used to optimize the model parameters.
[0197] In one example, the 8 early warning indicators cover accuracy, timeliness, practicality, etc. dimensions, as follows:
[0198] 1. Early warning accuracy: actual number of early warnings of anomalies / total number of early warnings (measures the "false positive rate" of early warnings, such as an accuracy of 80% means that 80 out of 100 early warnings are true anomalies).
[0199] 2. Early warning recall rate: number of anomalies successfully warned / total number of actual anomalies (measures the "false negative rate" of early warnings, such as a recall rate of 90% means that 90 out of 100 true anomalies are captured by the system).
[0200] 3. Response timeliness rate: number of early warnings issued before the anomaly spreads / total number of early warnings (such as during a big promotion, the proportion of early warnings issued within 5 minutes).
[0201] 4. Early warning grading accuracy: number of early warning levels matching the actual anomaly severity / total number of early warnings (such as the proportion of "emergency warnings" corresponding to true stockout risks).
[0202] 5. Decision suggestion adoption rate: number of times the enterprise adopts system replenishment suggestions / total number of system output suggestions (reflects the practicality of the suggestions).
[0203] 6. Inventory cost optimization rate: (pre-optimization inventory cost - post-optimization inventory cost) / pre-optimization inventory cost (measures the actual impact of early warning on cost reduction).
[0204] 7. Stockout loss reduction rate: (pre-optimization stockout loss - post-optimization stockout loss) / pre-optimization stockout loss (such as the proportion of stockout loss reduction due to timely early warning).
[0205] 8. Model iteration efficiency: time (in minutes) for model parameters to update to convergence after new data input (reflects the speed of self-adaptive learning).
[0206] In the embodiments of the present application, the evaluation results are presented by combining quantitative early warning indicator scores with qualitative conclusions, including:
[0207] Single indicator score: each indicator is quantified on a scale of 0-100 (such as an accuracy of 85 points and a response timeliness rate of 70 points).
[0208] Comprehensive evaluation level: based on the weighted scores of the 8 indicators (weights are set according to enterprise needs, such as an accuracy weight of 0.2 and a response timeliness rate weight of 0.2), divided into four levels: "excellent (90-100 points), good (70-89 points), average (50-69 points), and poor (<50 points)".
[0209] Problem positioning conclusion: identify the short board of indicators, such as "low recall rate (60 points), mainly due to delayed data collection in the supply chain" "poor classification accuracy (55 points), need to optimize DAG root cause tracing model".
[0210] In the embodiment of the application, the early warning effect evaluation process based on 8 early warning indicators is as follows:
[0211] 1. Index data collection:
[0212] Get "total warning times, classification results, and suggestion adoption records" from the early warning interaction module;
[0213] Get "actual anomaly records, inventory costs, and stockout losses" from the multi-source data collection layer;
[0214] Get "model iteration time" from the adaptive learning module.
[0215] 2. Index calculation and weighted scoring:
[0216] Calculate the single indicator score according to the above formula (e.g. warning accuracy = true anomaly warning times / total warning times x 100);
[0217] Assign weights (example: accuracy 0.2, recall 0.2, response timeliness 0.2, and the remaining four 0.1), calculate the comprehensive score: \( Comprehensive score = \sum (single indicator score x corresponding weight) \).
[0218] 3. Effect evaluation and optimization direction:
[0219] If the comprehensive level is "excellent": maintain the current model parameters, include historical data into the knowledge graph, and strengthen the matching ability of similar scenarios.
[0220] If "warning accuracy is low" (e.g. <70 points): adjust the threshold of isolated forest anomaly detection through PPO algorithm to reduce false positives (e.g. increase the anomaly score judgment threshold from 0.8 to 0.85).
[0221] If "response timeliness is low" (e.g. <60 points): optimize the frequency of multi-source data collection process (e.g. from 100ms to 50ms), shorten the data transmission delay.
[0222] If "decision suggestion adoption rate is low" (e.g. <50 points): adjust the replenishment suggestion formula combined with high adoption rate cases in the knowledge graph (e.g. add "supplier historical cooperation degree" parameter).
[0223] If "inventory cost optimization rate is negative" (cost increases): recalibrate the buffer factor α in the dynamic threshold formula (e.g. from 1.2 to 1.0, reduce excessive inventory).
[0224] Through the above process, the weak link of the early warning strategy can be located based on the quantification results of the 8 indicators, and the adaptive learning module is driven to iteratively optimize the model parameters, forming a closed loop of "evaluation-feedback-optimization".
[0225] In the embodiments of the present application, historical cases can also be constructed into a knowledge graph to support scenario matching and realize self-optimization of the system.
[0226] In specific implementation, the knowledge graph stores the cause-and-effect relationship and decision-making experience of historical cases through structuring, providing reusable "scenario-strategy" mapping for the system, and the specific action mechanism is as follows:
[0227] Scenario matching accelerates decision-making: The knowledge graph stores triples of "abnormal type-influencing factor-optimal coping strategy" (such as <stock sudden drop, live streaming, temporary restocking>). When a new abnormality occurs, the system can quickly locate similar historical cases through entity matching and directly reuse high-effect strategies to reduce repeated calculations.
[0228] Model training data enhancement: The "early warning result-actual impact" data in historical cases (such as <emergency warning, successfully avoiding stockout>) can be used as a reward signal for reinforcement learning to assist PPO algorithm in optimizing parameters (such as improving the early warning response speed in this scenario).
[0229] Rule iteration basis: Through association analysis of the knowledge graph, high-frequency failure rules (such as "rainy day logistics delay" leading to deviation of original early warning classification) can be found to promote updating of dynamic threshold formula or early warning strategy (such as automatically increasing the weight of ΔL in rainy days).
[0230] The detailed process of constructing a knowledge graph from historical cases is as follows:
[0231] 1. Case data collection and structuring:
[0232] Data sources: Extract full information of historical early warning events from system logs, including:
[0233] Abnormal characteristics: abnormal indicators (such as sudden drop in inventory quantity), time of occurrence, involved SKU;
[0234] Influencing factors: multi-source data triggering abnormality (such as live streaming order volume, logistics delay rate);
[0235] Early warning process: early warning level, push channel, response time;
[0236] Processing results: whether to adopt restocking suggestions, final inventory cost / stockout loss change.
[0237] Structuring: Convert unstructured data into triple format (entity 1, relationship, entity 2), for example:
[0238] <“2024-06-18 inventory sudden drop”, “caused by …”, “618 big promotion order surge”>
[0239] <“emergency warning”, “adopt strategy”, “temporary allocation of regional inventory”>
[0240] <“allocation strategy”, “effect is”, “inventory cost reduction of 15%”>
[0241] 2. Knowledge graph entity and relationship definition:
[0242] Core entities: abnormal types (such as inventory backlog, out of stock), influencing factors (such as promotion activities, logistics delays), early warning strategies (such as replenishment recommendations, hierarchical adjustments), effect indicators (such as cost optimization rate, out of stock loss).
[0243] Core relationships: “trigger” (such as promotion activities triggering order surge), “cause” (such as order surge leading to inventory shortage), “correspond” (such as inventory shortage corresponding to emergency warning), “optimization” (such as strategy optimization cost).
[0244] 3. Graph construction and storage:
[0245] Tool selection: use Neo4j as a graph database, create nodes and relationships through Cypher statements;
[0246] Instantiation process:
[0247] Create a unique “event node” for each historical case, associate with abnormal types, time, etc.
[0248] Create entity nodes for influencing factors, strategies, and effects, and connect them to event nodes through relationship edges.
[0249] Add weights to relationship edges (such as “strategy-effect” relationship weight = effect indicator value, such as 0.15 represents a 15% cost reduction).
[0250] 4. Dynamic update and iteration:
[0251] Real-time insertion of new cases: when a new early warning event is closed (such as processing is completed and produces effects), automatically extract triples and insert into knowledge graph;
[0252] Relationship weight optimization: update node importance through PageRank algorithm (such as high-frequency effective strategy node weight promotion), cluster similar scenarios through community discovery algorithm (such as “live streaming” “seckill activity” into “short-term sales surge” scenario).
[0253] Through the above process, the knowledge graph becomes the "experience base" of the system, which supports rapid decision-making and provides scenario-based basis for model parameter optimization, and finally realizes self-iteration upgrade.
[0254] The present application collects multi-source data related to inventory, including time series features, static features and supplier data; inputs the time series features and static features into a preset sales prediction network to output predicted sales; inputs the supplier data into a preset order delivery time prediction model to output order delivery time and delay prediction value; calculates safety stock according to predicted sales, predicted order delivery time and delay prediction value; and performs inventory warning according to safety stock. The real-time performance of inventory warning is improved, and the risk of inventory backlog or stockout is reduced.
[0255] Please refer to Figure 3 , Figure 3 The structure block diagram of the intelligent inventory warning device provided by the embodiment of the present application is shown.
[0256] The embodiment of the present application provides an intelligent inventory warning device, which comprises:
[0257] The multi-source data acquisition module 301 is configured to acquire multi-source data related to inventory, wherein the multi-source data comprises time series features, static features and supplier data;
[0258] The sales prediction module 302 is configured to input the time series features and the static features into a preset sales prediction network to output predicted sales;
[0259] The order delivery time and delay prediction value calculation module 303 is configured to input the supplier data into a preset order delivery time prediction model to output order delivery time and delay prediction value;
[0260] The safety stock calculation module 304 is configured to calculate safety stock according to predicted sales, order delivery time and delay prediction value;
[0261] The inventory warning module 305 is configured to perform inventory warning according to safety stock.
[0262] In the embodiment of the present application, the training process of the sales prediction network comprises:
[0263] The historical time series feature and pre-training weight acquisition module is configured to acquire historical time series features and pre-training weights;
[0264] The context feature extraction module is configured to input the historical time series features into an initial sales prediction network and extract context features from the historical time series features through an encoder;
[0265] The conversion module is configured to convert the context features into predicted sales distribution through a decoder;
[0266] A judgment module is configured to judge whether the current iteration number meets a preset iteration threshold;
[0267] A return module is configured to, if no, calculate a loss function, adjust model parameters of the initial sales volume prediction network according to the loss function, and return the step of inputting the historical time series features into the initial sales volume prediction network and extracting the context features from the historical time series features by the encoder;
[0268] A sales volume prediction network determination module is configured to, if yes, output the initial sales volume prediction network as a trained sales volume prediction network.
[0269] In the embodiment of the application, the safety stock calculation formula is as follows:
[0270]
[0271] wherein, is a service level coefficient, is a sales volume standard deviation, is an order delivery time, is a delay prediction value, is a buffer factor.
[0272] In the embodiment of the application, the inventory early warning module 305 comprises:
[0273] An anomaly detection sub-module is configured to perform multi-dimensional anomaly detection on the preset indicators by the Isolation Forest algorithm and the safety stock, to obtain an anomaly detection result.
[0274] An influence factor determination sub-module is configured to determine an influence factor of the anomaly detection result according to the anomaly detection result and a preset causal inference model.
[0275] An anomaly early warning generation sub-module is configured to generate an anomaly early warning according to the influence factor.
[0276] In the embodiment of the application, further comprising:
[0277] An indicator value calculation module is configured to calculate an indicator value of the preset early warning indicator.
[0278] An optimization module is configured to optimize parameters of the sales volume prediction network, the order delivery time prediction model, the preset causal inference model and the Isolation Forest algorithm according to the indicator value.
[0279] The embodiment of the application further provides an electronic device, which comprises a processor and a memory:
[0280] The memory is configured to store program code and transmit the program code to the processor.
[0281] The processor is configured to execute the intelligent inventory early warning method according to instructions in the program code.
[0282] The embodiment of the present application further provides a computer readable storage medium for storing program codes, the program codes being used for executing the intelligent inventory early warning method.
[0283] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the system, the device and the unit described above can refer to the corresponding processes in the foregoing method embodiments, and will not be described herein.
[0284] Each of the embodiments in the specification is described in a progressive manner, and each embodiment focuses on the difference from other embodiments, and the same and similar parts between the embodiments can be referred to each other.
[0285] Those skilled in the art can understand that the embodiments of the present application can be provided as a method, a device or a computer program product. Therefore, the embodiments of the present application can adopt a completely hardware embodiment, a completely software embodiment or an embodiment combining software and hardware aspects. Moreover, the embodiments of the present application can adopt a computer program product in the form of being implemented on one or more computer usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer usable program codes.
[0286] The embodiments of the present application are described with reference to flowcharts and / or block diagrams according to the method, the terminal device (system) and the computer program product of the embodiments of the present application. It should be understood that each flow and / or block in the flowcharts and / or block diagrams, and the combination of the flows and / or blocks in the flowcharts and / or block diagrams can be implemented by computer program instructions. These computer program instructions can be provided to a general-purpose computer, a special-purpose computer, an embedded processor or other programmable data processing terminal device to produce a machine, so that the instructions executed by the computer or other programmable data processing terminal device produce a device for implementing the functions specified in the flowcharts and / or block diagrams. Figure 1 The function specified in one flow or multiple flows and / or blocks Figure 1 The device for implementing the function specified in one block or multiple blocks.
[0287] These computer program instructions can also be stored in a computer readable storage medium, which can guide the computer or other programmable data processing terminal device to work in a specific way, so that the instructions stored in the computer readable storage medium produce a product including instruction devices, which implement the functions specified in the flowcharts and / or block diagrams. Figure 1 The function specified in one flow or multiple flows and / or blocks Figure 1 The device for implementing the function specified in one block or multiple blocks.
[0288] These computer program instructions can also be loaded into a computer or other programmable data processing terminal device, so that a series of operational steps are performed on the computer or other programmable terminal device to generate a computer-implemented process, so that the instructions executed on the computer or other programmable terminal device provide a process for implementing the functions specified in the flowchart block(s) or block(s). Figure 1 one flow or multiple flows and / or the functions specified in the block(s) Figure 1 one flow or multiple flows and / or the functions specified in the block(s)
[0289] Although the preferred embodiments of the embodiments of the present application have been described, those skilled in the art who have the basic inventive concept can make further changes and modifications to the embodiments. Therefore, the appended claims are intended to include the preferred embodiments and all changes and modifications falling within the scope of the embodiments of the present application.
[0290] It should be noted that the user information (including but not limited to user equipment information, user personal information, etc.) and data (including but not limited to data for analysis, stored data, displayed data, etc.) involved in the present application are all information and data authorized by the user or authorized by all parties, and the collection, use and processing of related data need to comply with relevant laws, regulations and standards of relevant countries and regions, and provide corresponding operation portal for user to choose authorization or refusal.
[0291] Finally, it should be noted that in this document, relational terms such as first and second and the like can only be used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply that these entities or operations exist in any such actual relationship or order. Moreover, the terms "comprising", "including" or any other variant thereof are intended to cover non-exclusive inclusion, so that a process, method, article or terminal device including a series of elements not only includes those elements, but also includes other elements not explicitly listed or inherent to such a process, method, article or terminal device. Without more limitations, the element defined by the statement "comprising a" does not exclude the presence of additional identical elements in the process, method, article or terminal device including the element.
[0292] The above-described and above-mentioned embodiments are only used to illustrate the technical solutions of the present application, but not to limit them; although the present application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that they can still modify the technical solutions recorded in the foregoing embodiments, or make equivalent replacement to part of the technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present application.
Claims
1. An intelligent inventory early warning method, characterized in that: include: Collecting multi-source data related to inventory, wherein the multi-source data includes time series features, static features, and supplier data; Inputting the temporal features and static features into a preset sales forecasting network and outputting predicted sales; Inputting the supplier data into a preset order delivery time prediction model and outputting order delivery time and delay prediction values; Calculating safety stock based on the predicted sales volume, the order delivery time, and the delay prediction value; An inventory warning is issued based on the safety stock.
2. The method according to claim 1, characterized in that The training process of the sales forecasting network includes: Obtain historical time series features and pre-training weights; Inputting the historical time series features into an initial sales forecasting network, and extracting context features from the historical time series features through an encoder; Converting the context features into a predicted sales distribution through a decoder; Determine whether the current number of iterations meets the preset iteration threshold; If not, calculating a loss function, adjusting the model parameters of the initial sales prediction network according to the loss function, and returning to the step of inputting the historical time series features into the initial sales prediction network and extracting context features from the historical time series features through an encoder; If so, the initial sales forecasting network is output as the trained sales forecasting network.
3. The method according to claim 1, characterized in that The safety stock calculation formula is as follows: in, is the service level coefficient, is the sales standard deviation, For order delivery time, is the delay prediction value, is the buffer factor.
4. The method according to claim 1, wherein The step of performing inventory warning according to the safety stock comprises: Perform multi-dimensional anomaly detection on preset indicators using the isolation forest algorithm and the safety stock to obtain an anomaly detection result; Determining factors affecting the abnormality detection results based on the abnormality detection results and a preset causal inference model; Generate an abnormal warning based on the influencing factors.
5. The method according to claim 4, characterized in that Also includes: Calculate the indicator value of the preset early warning indicator; Parameters of the sales forecast network, the order delivery time forecast model, the preset causal inference model, and the isolation forest algorithm are optimized according to the indicator values.
6. An intelligent inventory early warning device, characterized in that: include: A multi-source data acquisition module is used to collect multi-source data related to inventory, wherein the multi-source data includes time series features, static features and supplier data; a sales forecasting module, configured to input the temporal features and static features into a preset sales forecasting network and output predicted sales; an order delivery time and delay prediction value calculation module, configured to input the supplier data into a preset order delivery time prediction model and output order delivery time and delay prediction values; A safety stock calculation module, configured to calculate the safety stock based on the predicted sales volume, the order delivery time, and the delay prediction value; The inventory warning module is used to issue an inventory warning based on the safety stock.
7. The device according to claim 6, characterized in that The training process of the sales forecasting network includes: Historical time series features and pre-training weight acquisition module, used to obtain historical time series features and pre-training weights; a context feature extraction module, configured to input the historical time series features into an initial sales forecasting network and extract context features from the historical time series features through an encoder; A conversion module, configured to convert the context features into a predicted sales distribution through a decoder; A judgment module is used to judge whether the current number of iterations meets a preset iteration threshold; a return module, configured to, if not, calculate a loss function, adjust the model parameters of the initial sales forecasting network according to the loss function, and return to the step of inputting the historical time series features into the initial sales forecasting network and extracting context features from the historical time series features through an encoder; The sales forecast network determination module is used to output the initial sales forecast network as the trained sales forecast network if yes.
8. The device according to claim 6, characterized in that The inventory early warning module includes: An anomaly detection submodule, configured to perform multi-dimensional anomaly detection on preset indicators using an isolation forest algorithm and the safety stock to obtain an anomaly detection result; An influencing factor determination submodule, configured to determine the influencing factors of the anomaly detection result based on the anomaly detection result and a preset causal inference model; The abnormal warning generation submodule is used to generate an abnormal warning based on the influencing factors.
9. An electronic device, characterized in that: The device includes a processor and a memory: The memory is used to store program code and transmit the program code to the processor; The processor is configured to execute the intelligent inventory early warning method according to any one of claims 1 to 5 according to instructions in the program code.
10. A computer-readable storage medium, characterized in that The computer-readable storage medium is used to store program code, and the program code is used to execute the intelligent inventory early warning method according to any one of claims 1 to 5.
Citation Information
Cited By
Full-process business management and analysis system for agricultural equipment sales
CN122086904A