Stock forecasting method, system, computer equipment and medium for spare parts warehouse
By constructing the Gru-Western prediction model network based on the spare parts warehouse, the problem of high-efficiency stocking predictions for multi-category materials is solved, and high-efficiency stocking forecasts for multi-category materials are solved.
Patent Information
- Application Number
- CN202311105188.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-08-30
- Publication Date
- 2025-01-28
- Estimated Expiration
- 2043-08-30
AI Technical Summary
The management and stocking methods of traditional spare parts warehouses have high management costs, especially when the storage amount is large and the types are large, a large amount of manpower and material resources are needed to manage and stock.
Adopt the Gru-WATENTION prediction model network, and by obtaining data of historical materials for data compilation and pre-processing, the multi-material category prediction model group is constructed to achieve predictions for multiple categories of materials stocking.
The cost of management and stocking has been reduced, the accuracy and efficiency of the prediction of stocking prediction can be improved, and the predictions of the stocking prediction of multi -category materials can be performed more efficiently.
Smart Images

Figure CN117236843B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of intelligent management technology for spare parts warehouses, and in particular to a method, system, computer equipment and storage medium for predicting the stocking of spare parts warehouses. Background Art
[0002] As the digital transformation of the power grid continues to deepen, safety tool cabinets are an important part of the transformation, which will inject new vitality into the digitalization of the entire power grid. It is crucial to build intelligent warehousing for assets and equipment and unmanned and intelligent professional warehouses. Professional warehouses are of great significance for the management and maintenance of tools and materials, and are simple and efficient for clarifying the complex and small supply and demand relationships of materials. In order to pursue the development of professional spare parts storage conditions, it is beneficial for the State Grid operation and maintenance personnel to use equipment efficiently and accurately, and it is also beneficial for low material consumption and high return on use. The construction of digital warehousing is conducive to the above goals. In the process of using materials and tools, the stocking requirements for the material list are very complicated, and they are usually sorted and stocked manually.
[0003] Since the amount of materials stored in the spare parts warehouse is large and of different types, even if the list of various goods can be sorted out manually, it still requires a lot of manpower and material resources. Therefore, the traditional spare parts management and stocking methods have the problem of high management costs. Summary of the invention
[0004] Based on this, in order to solve the above technical problems, a spare parts warehouse inventory forecasting method, system, computer equipment and storage medium are provided, which can reduce management and inventory costs and forecast the inventory of materials of multiple categories.
[0005] A method for predicting stock of spare parts warehouse, the method comprising:
[0006] Acquire historical material usage data in the spare parts warehouse, and sort the historical material usage data according to time and quantity of goods to obtain sorted data;
[0007] Performing data preprocessing on the sorted data to obtain a historical data set;
[0008] Constructing a prediction model network based on GRU-Attention, and obtaining several parameter groups through grid search method, and selecting model training parameters from the several parameter groups;
[0009] Acquire each category name from the historical data set, and build a multi-material category prediction model group based on the prediction model network and the category names;
[0010] The data to be prepared is obtained and input into the material category prediction model group to obtain the preparation prediction data.
[0011] In one embodiment, the preprocessing of the sorted data to obtain a historical data set includes:
[0012] Normalizing the sorted data, and dividing the processed data into input data and verification data according to the time step;
[0013] The input data and the verification data are used as a supervised learning group, and the supervised learning group is divided into a training history data set and a testing history data set.
[0014] In one embodiment, the step of constructing a prediction model network based on GRU-Attention includes:
[0015] The material samples and time steps form the input layer, and the GRU unit and Attention layer are used as hidden layers to construct the output layer;
[0016] Building an initial prediction model network with the input layer, the hidden layer, and the output layer;
[0017] Using MAE and RMSE as model evaluation criteria, the initial prediction model network is evaluated and modified to obtain a prediction model network based on GRU-Attention.
[0018] In one embodiment, the GRU unit includes: a reset gate, an update gate, a candidate hidden state, and a hidden state, wherein:
[0019] The reset gate is used to control the memory state saved by the historical GRU unit;
[0020] The update gate is used to control the number of copies of the historical GRU unit contained in the GRU unit;
[0021] The candidate hidden state is used to assist in calculating the hidden state;
[0022] The hidden state is used to output the hidden state in combination with the update gate.
[0023] In one embodiment, a plurality of parameter groups are obtained by searching through a grid search method, and model training parameters are selected from the plurality of parameter groups, including:
[0024] Get the parameter list;
[0025] Select one parameter from the parameter list as a variable, and keep the other parameters unchanged as a group of parameter groups for training, and expand each parameter group in the form of a grid, and compare each training result;
[0026] Model training parameters are selected according to each of the training results.
[0027] In one embodiment, selecting model training parameters according to the training results includes:
[0028] Calculate the loss value corresponding to each of the training results;
[0029] The model training parameters are determined from the parameter list using each of the loss values as a selection criterion.
[0030] In one embodiment, the step of obtaining the to-be-stocked data and inputting it into the material category prediction model group to obtain the stocking prediction data includes:
[0031] Extracting the category name and the time of the goods to be prepared from the data of goods to be prepared;
[0032] Input the name of the category to be prepared and the time to be prepared into the material category prediction model group, and calculate all the stock quantities of the goods corresponding to the name of the category to be prepared within the time to be prepared through the material category prediction model group;
[0033] The stock quantity is output as stock forecast data through the material category forecast model group.
[0034] A stock forecasting system for a spare parts warehouse, the system comprising:
[0035] A data acquisition module is used to acquire historical material usage data in the spare parts warehouse, and to sort the historical material usage data according to time and quantity of goods to obtain sorted data;
[0036] A data preprocessing module, used to perform data preprocessing on the sorted data to obtain a historical data set;
[0037] The network construction and parameter selection module is used to construct a prediction model network based on GRU-Attention, and obtain several parameter groups through grid search method, and select model training parameters from the several parameter groups;
[0038] A model building module, used for obtaining each category name from the historical data set, and building a multi-material category prediction model group based on the prediction model network and the category names;
[0039] The stocking forecast module is used to obtain the data to be stocked and input it into the material category forecast model group to obtain the stocking forecast data.
[0040] A computer device comprises a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the following steps are implemented:
[0041] Acquire historical material usage data in the spare parts warehouse, and sort the historical material usage data according to time and quantity of goods to obtain sorted data;
[0042] Performing data preprocessing on the sorted data to obtain a historical data set;
[0043] Constructing a prediction model network based on GRU-Attention, and obtaining several parameter groups through grid search method, and selecting model training parameters from the several parameter groups;
[0044] Acquire each category name from the historical data set, and build a multi-material category prediction model group based on the prediction model network and the category names;
[0045] The data to be prepared is obtained and input into the material category prediction model group to obtain the preparation prediction data.
[0046] A computer-readable storage medium stores a computer program, which, when executed by a processor, implements the following steps:
[0047] Acquire historical material usage data in the spare parts warehouse, and sort the historical material usage data according to time and quantity of goods to obtain sorted data;
[0048] Performing data preprocessing on the sorted data to obtain a historical data set;
[0049] Constructing a prediction model network based on GRU-Attention, and obtaining several parameter groups through grid search method, and selecting model training parameters from the several parameter groups;
[0050] Acquire each category name from the historical data set, and build a multi-material category prediction model group based on the prediction model network and the category names;
[0051] The data to be prepared is obtained and input into the material category prediction model group to obtain the preparation prediction data.
[0052] The above-mentioned spare parts warehouse inventory prediction method, system, computer equipment and storage medium, by constructing a prediction model network based on GRU-Attention and selecting model training parameters using the grid search method, can be trained based on various types of materials, thereby constructing a multi-material category prediction model group for predicting the inventory of materials of multiple categories, which can reduce management and inventory costs. BRIEF DESCRIPTION OF THE DRAWINGS
[0053] Figure 1This is an application environment diagram of a method for predicting the stock of spare parts warehouse in one embodiment;
[0054] Figure 2 It is a flowchart of a method for predicting the stock of spare parts warehouse in one embodiment;
[0055] Figure 3 A schematic diagram of a data preprocessing process in one embodiment;
[0056] Figure 4 is a schematic diagram of the structure of the Attention layer in one embodiment;
[0057] Figure 5 Schematic diagram of a prediction model network structure based on GRU-Attention in one embodiment;
[0058] Figure 6 is a schematic diagram of the structure of a GRU unit in one embodiment;
[0059] Figure 7 It is a structural block diagram of a stocking forecasting system for a spare parts warehouse in one embodiment;
[0060] Figure 8 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0061] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0062] like Figure 1 As shown, the application environment includes a computer device 110. The computer device 110 can obtain a scene image obtained by scanning the three-dimensional scene 120, the computer device 110 can obtain the historical material usage data in the spare parts warehouse, and sort the historical material usage data according to time and quantity of goods to obtain sorted data; the computer device 110 can perform data preprocessing on the sorted data to obtain a historical data set; the computer device 110 can build a prediction model network based on GRU-Attention, and search through a grid search method to obtain a number of parameter groups, and select model training parameters from the number of parameter groups; the computer device 110 can obtain the names of each category from the historical data set, and build a multi-material category prediction model group based on the prediction model network and the category name; the computer device 110 can obtain the data to be prepared and input it into the material category prediction model group to obtain the preparation prediction data. Among them, the computer device 110 can be, but not limited to, various personal computers, laptops, robots, tablet computers and other devices.
[0063] In one embodiment, Figure 2 As shown, a method for predicting the inventory of spare parts warehouse is provided, comprising the following steps:
[0064] Step 202, obtaining historical material usage data in the spare parts warehouse, and sorting the historical material usage data according to time and quantity of goods to obtain sorted data.
[0065] An intelligent spare parts warehouse management system may be provided in the computer device, and the intelligent spare parts warehouse management system may store usage data of various materials.
[0066] Computer equipment can obtain historical material usage data in the spare parts warehouse through the intelligent spare parts warehouse management system, thereby obtaining a data list of various types of goods. Then, the computer equipment can use the shipping list exported from the system at 24 o'clock on the same day as the standard, with the name of the goods, the quantity of the goods, and the shipping time as a group of data. On the basis of this list, the time is uniformly divided into the day, and the number of goods that need to be predicted to be stocked is the total number of goods used.
[0067] Step 204, preprocessing the sorted data to obtain a historical data set.
[0068] After the computer equipment obtains the inventory data of all the goods in the spare parts warehouse, it belongs to vector data with a time span. In order to obtain a multi-input and single-output prediction data set, the sorted data needs to be preprocessed.
[0069] Among them, in the process of data preprocessing, in order to improve the effect of model prediction and avoid overfitting of the prediction curve, a normalized mathematical method is used to obtain a historical data set.
[0070] Step 206, construct a prediction model network based on GRU-Attention, and obtain several parameter groups through grid search method, and select model training parameters from the several parameter groups.
[0071] The internal system of the computer device can construct a prediction model network based on GRU-Attention, so as to subsequently train a network model based on the prediction model network. The parameters of the model training can be determined by a grid search method. Specifically, the computer device can search for several parameter groups by the grid search method to determine the model training parameters.
[0072] Step 208, obtaining each category name from the historical data set, based on the prediction model network, and building a multi-material category prediction model group according to the category name.
[0073] The multi-material category prediction model group may include various material category prediction models, and each material category prediction model may predict different material categories. Specifically, the computer device may obtain the names of various categories from the historical data set, and construct and train various material category prediction models based on the prediction model network according to the names of various categories.
[0074] Step 210, obtaining the data to be prepared and inputting it into the material category prediction model group to obtain the preparation prediction data.
[0075] The data to be prepared can be used to indicate the name of the goods that need to be prepared, the date on which the goods need to be prepared, and other data. The computer device can collect the data to be prepared through the display screen, and the data to be prepared can be specifically input by the user through the display screen of the computer device. The computer device can input the acquired name of the goods to be prepared and the date on which the goods need to be prepared into the material category prediction model group, thereby displaying the stocking forecast data through the display screen. Among them, the stocking forecast data can be the sum of the stocking quantity required from the date on which the goods need to be prepared to the current date.
[0076] In this embodiment, the computer device constructs a prediction model network based on GRU-Attention and selects the model training parameters using the grid search method. It can then be trained based on various types of materials to build a multi-material category prediction model group for predicting the stocking of materials of multiple categories, thereby reducing management and stocking costs.
[0077] In one embodiment, Figure 3 As shown, a method for predicting the inventory of spare parts warehouses provided may also include a process of data preprocessing, the specific process including: normalizing the sorted data, and dividing the processed data into input data and verification data according to the time step method; using the input data and verification data as a supervised learning group, and dividing the supervised learning group into a training history data set and a test history data set.
[0078] Computer equipment can normalize the sorted data. The purpose of normalization is to limit the preprocessed data set to a certain range, solve the adverse effects caused by singular sample data, speed up model training, and improve model building efficiency.
[0079] Specifically, the computer device can use the Min-Max standardization method to achieve data normalization. The Min-Max standardization method is also called the range standardization method, which is the simplest method to eliminate the influence of variable dimension and variation range. The computer device can find the minimum and maximum values of each attribute from the sorted data, and map its original value X to a value X' in the interval [0, 1] through Min-Max standardization, where X'=(XX min) / (X max -X min ), no matter whether the original data is positive or negative, after processing, the numerical variation range of each observed value of the variable satisfies 0≤X′≤1, and both positive and negative indicators can be converted into positive indicators with the same action direction; if new data is added, it may lead to the maximum value X max and minimum value X min If there is a change, it needs to be redefined and the range recalculated.
[0080] like Figure 3 As shown, in this embodiment, the computer device can convert vector data into supervised learning data, use the data of the first n steps as input data through the time step method, and use the data of the n+1th step as the verification number to form a supervised learning group, and divide the supervised learning group into a training group and a test group with a weight of 8:2.
[0081] In one embodiment, a method for predicting the inventory of spare parts warehouses provided may also include a process of constructing a prediction model network based on GRU-Attention, and the specific process includes: using material samples and time steps to form an input layer, using GRU units and Attention layers as hidden layers, and constructing an output layer; building an initial prediction model network with the input layer, hidden layer, and output layer; using MAE and RMSE as model evaluation criteria, evaluating and modifying the initial prediction model network to obtain a prediction model network based on GRU-Attention.
[0082] In this embodiment, the constructed prediction model network based on GRU-Attention may include an input layer, a hidden layer, and an output layer, wherein the input layer is a two-dimensional array composed of material samples and time steps, and the composition of the input layer is (material_samples, timestamp); the GRU unit layer in the hidden layer automatically learns the input material usage data, extracts the characteristics of data changes and related regularity information, and fits the prediction curve through a huge amount of parameters. The first layer in the hidden layer is composed of 64G GRU units.
[0083] The second hidden layer is the Attention layer. The multi-step input has different effects on the output and the prediction results. Each input has different effects on the prediction results of the model. In this regard, the input to the Attention layer (o 1 ,o 2 ,o 3 ,...,o s ) channels are assigned probability distribution values (α 1 ,α 2 ,α 3 ,...,αs ), the generated Attention weight matrix and feature representation V are as follows: Among them, α t is the probability distribution value obtained by allocation, t=1,2,3...s; o n h is the Attention layer channel; t is the state vector value at time t, and its default value is a unit matrix of the same size as the α matrix; o n is the sum of the output of the GRU layer at the current moment, which is used as input to the Attention layer; Transpose the input of the attention layer at time t.
[0084] In this embodiment, the structure of the Attention layer is as follows Figure 4 As shown. The Attention mechanism is used to assign weights to inputs at different time steps to improve the prediction effect. The main principle is to save the intermediate results of the time series input generated by the GRU network, and link the results with the output values, so that the model can learn how to selectively focus on the data and assign more reasonable weights to the data. The number of units is 50; the third and fourth layers of the hidden layer are two fully connected layers (DenseLayer), with 50 and 1 units respectively; the third fully connected layer is to extract features from the information analyzed by the GRU unit and the Attention layer, and obtain the correlation features between the input data and the verification data through the nonlinear fully connected layer, and perform mapping processing in the last fully connected layer; the numerical value is used as the output result, and a Dense unit is used to output the predicted value of the material quantity.
[0085] The output layer can output the result. Specifically, the output result can be calculated by the ReLU function. The network structure of the prediction model based on GRU-Attention is as follows: Figure 5 shown.
[0086] In the process of building a prediction model network based on GRU-Attention, in order to achieve high-accuracy prediction of spare parts, MAE and RMSE are used as model evaluation criteria. The two evaluation definitions are as follows:
[0087] First, the mean absolute error (MAE) represents the average of the absolute errors between the actual value and the predicted value. In mathematical terms, the mean absolute error is a linear score that reflects the absolute difference between two data. If the predicted value is equal to the actual value, the MAE is 0; if the predicted value is not equal to the actual value, the MAE directly reflects the difference in value, and the comparison weight of each group of data is the same. The formula is: Among them, h, y represent a time series array; n represents the length of the time series array; h(i), y(i) represent the value of the time series array at time i.
[0088] The root mean square error (RMSE) represents the sample standard deviation of the difference between the actual value and the predicted value, in order to illustrate the degree of dispersion between samples. The significance of the root mean square error calculation is mainly the deviation between the predicted value and the actual value. When performing nonlinear fitting on the prediction curve, the smaller the RMSE, the better, indicating that the prediction curve and the actual curve fit better. The formula is: Among them, h, y represent a time series array; n represents the length of the time series array; h(i), y(i) represent the value of the time series array at time i.
[0089] In one embodiment, Figure 6 As shown, the GRU unit includes: a reset gate, an update gate, a candidate hidden state, and a hidden state, wherein: the reset gate is used to control the memory state saved by the historical GRU unit; the update gate is used to control the number of copies of the historical GRU unit contained in the GRU unit; the candidate hidden state is used to assist in calculating the hidden state; the hidden state is used to output the hidden state in combination with the update gate.
[0090] The purpose of the reset gate is to control the memory state saved by the past GRU unit. The calculation method is: use the sigmoid function to control the result range between (0, 1), input gate X t Multiply by the weight term W xr , plus the hidden state H of one time step t-1 Multiply by the weight term W hr , plus the weighted term b r , get the vector result R calculated by adding and resetting the gate t , R t =σ(X t W xr +H t- 1 W hr +b r ).
[0091] The purpose of the update gate is to control the number of copies of the old cell contained in the new cell state. The calculation method is: use the sigmoid function to control the result range between (0, 1), input gate X t Multiply by the weight term W xz , plus the hidden state H of one time step t-1 Multiply by the weight term W hz , plus the weighted term b z , get the value Z of the update gate t , Z t =σ(Xt W xz +H t-1 W hz +b z ).
[0092] The purpose of candidate hidden states is to assist in the calculation of hidden states, R t When all are 1, it is the same as the vector in the ordinary RNN. This state records the memory part that needs to be left behind by this unit at this moment. The calculation method is: use the tanh function to control the result range between (-1, 1), input gate X t Multiply by the weight term W xh , plus the vector result R calculated by the reset gate t Same as the previous hidden state R t The value of each element multiplied by the weight term W hh , plus the weighted term b h , that is, the candidate hidden state
[0093] The purpose of the hidden state is to combine with the update gate to output the final hidden state of the unit. t When Z is 0, the hidden state output is completely the candidate hidden state; when Z t When it is 1, the hidden state output is completely the old state of the previous time step. This approach can capture the memory components of a longer time to a certain extent, and help deal with the common gradient disappearance problem in recurrent neural networks during the calculation process. Calculation method: Update gate Z t Each element of is multiplied by the old state element of the previous time step, plus the all-one vector minus the update gate Z t The value of is multiplied by each element of the candidate hidden state, that is, the hidden state
[0094] In one embodiment, the multi-material category prediction model group uses the name of each category as a parameter setting. Since the prediction model network based on GRU-Attention designed in this application is for a single type of material, it is necessary to set the model group to analyze and train the historical data of each material, but a large number of material categories will definitely lead to performance differences. In order to solve this problem, at the beginning of designing the network model, lightness is used as the design criterion. The specific performance parameters are as follows:
[0095] GRU-Attention Maximum prediction error 0.72 Average sample error 0.31 Average sample deviation 0.59 Minimum loss value 0.0298 Run time / second 13.2
[0096] According to the above list, it can be seen that the lightweight network has fast training speed and high accuracy, and can be applied to the engineering practice of material prediction.
[0097] In one embodiment, a method for predicting inventory of spare parts warehouses provided may also include a process for determining model training parameters, the specific process including: obtaining a parameter list; selecting a parameter from the parameter list as a variable, and keeping the remaining parameters unchanged as a group of parameter groups for training, and expanding each parameter group in the form of a grid, and comparing each training result; selecting model training parameters according to each training result.
[0098] In this embodiment, the determined model training parameters can be obtained by conducting a large number of experimental comparisons through a grid search method, specifically including: first, enumerating a list of parameters within an appropriate range; in principle, in order to avoid the problems of long time and low efficiency caused by redundant and overly complicated training, there are not many network parameters, and two to three parameters are selected for training, and the rest are directly selected according to empirical values; then, one parameter is used as a variable, and the other parameters remain unchanged as a group of parameter groups for training; finally, all parameter groups are expanded in the form of a grid, and all training results are compared, and the parameter group with the best prediction effect, the shortest time, and the highest prediction performance is selected as the parameter of the network model.
[0099] In one embodiment, when selecting model training parameters, the loss values corresponding to each training result can be calculated; each loss value is used as a selection criterion to determine the model training parameters from the parameter list. That is, using the evaluation standard or the Loss value as a comparison criterion, the parameter group with the best prediction effect, the shortest time, and the highest prediction performance is selected as the parameters of the network model.
[0100] The network parameters are listed below:
[0101]
[0102] In one embodiment, a stocking forecasting method for a spare parts warehouse is provided, which may also include a process of obtaining stocking forecast data, and the specific process includes: extracting the name of the to-be-prepared category and the to-be-prepared time from the to-be-prepared data; inputting the name of the to-be-prepared category and the to-be-prepared time into a material category forecasting model group, and calculating all stocking quantities of goods corresponding to the to-be-prepared category name within the to-be-prepared time through the material category forecasting model group; and outputting the stocking quantity as stocking forecast data through the material category forecasting model group.
[0103] In actual application, the user can enter the name of the product category to be prepared through the search bar of the computer device and select the time to be prepared. The computer device can input the name of the product category to be prepared and the time to be prepared into the material category prediction model group, calculate all the preparation quantities of the goods corresponding to the name of the product category to be prepared within the time to be prepared, and then display them on the display screen of the computer device.
[0104] It should be understood that, although the various steps in the above-mentioned flow chart are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps is not strictly limited in order, and these steps can be executed in other orders. Moreover, at least a part of the steps in the above-mentioned flow chart may include a plurality of sub-steps or a plurality of stages, and these sub-steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these sub-steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the sub-steps or stages of other steps.
[0105] In one embodiment, Figure 7 As shown, a stocking prediction system for spare parts warehouse is provided, including: a data acquisition module 710, a data preprocessing module 720, a network construction and parameter selection module 730, a model construction module 740 and a stocking prediction module 750, wherein:
[0106] The data acquisition module 710 is used to acquire the historical material usage data in the spare parts warehouse, and to sort the historical material usage data according to time and quantity of goods to obtain sorted data;
[0107] A data preprocessing module 720 is used to perform data preprocessing on the sorted data to obtain a historical data set;
[0108] The network construction and parameter selection module 730 is used to construct a prediction model network based on GRU-Attention, and obtain several parameter groups through a grid search method, and select model training parameters from the several parameter groups;
[0109] A model building module 740 is used to obtain each category name from the historical data set, and build a multi-material category prediction model group based on the prediction model network and the category name;
[0110] The stocking forecast module 750 is used to obtain the data to be stocked and input it into the material category forecast model group to obtain the stocking forecast data.
[0111] In one embodiment, the data preprocessing module 720 is also used to normalize the sorted data, and divide the processed data into input data and verification data according to the time step; the input data and verification data are used as supervised learning groups, and the supervised learning groups are divided into training history data sets and test history data sets.
[0112] In one embodiment, the network construction and parameter selection module 730 is also used to form an input layer with material samples and time steps, and use GRU units and Attention layers as hidden layers to construct an output layer; build an initial prediction model network with the input layer, hidden layer, and output layer; use MAE and RMSE as model evaluation criteria to evaluate and modify the initial prediction model network to obtain a prediction model network based on GRU-Attention.
[0113] In one embodiment, the GRU unit includes: a reset gate, an update gate, a candidate hidden state, and a hidden state, wherein: the reset gate is used to control the memory state saved by the historical GRU unit; the update gate is used to control the number of copies of the historical GRU unit contained in the GRU unit; the candidate hidden state is used to assist in calculating the hidden state; the hidden state is used to output the hidden state in combination with the update gate.
[0114] In one embodiment, the network construction and parameter selection module 730 is also used to obtain a parameter list; select a parameter from the parameter list as a variable, and keep the other parameters unchanged as a group of parameter groups for training, and expand each parameter group in the form of a grid to compare each training result; select model training parameters according to each training result.
[0115] In one embodiment, the network construction and parameter selection module 730 is also used to calculate the loss value corresponding to each training result; each loss value is used as a selection criterion to determine the model training parameters from the parameter list.
[0116] In one embodiment, the stocking forecast module 750 is also used to extract the name of the to-be-prepared category and the to-be-prepared time from the to-be-prepared data; input the name of the to-be-prepared category and the to-be-prepared time into the material category forecast model group, and calculate all stock quantities of the goods corresponding to the to-be-prepared category name within the to-be-prepared time through the material category forecast model group; and output the stock quantity as stocking forecast data through the material category forecast model group.
[0117] In one embodiment, a computer device is provided. The computer device may be a terminal, and its internal structure diagram may be as follows: Figure 8As shown. The computer device includes a processor, a memory, a network interface, a display screen and an input device connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a method for predicting the inventory of spare parts warehouses is implemented. The display screen of the computer device can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device can be a touch layer covered on the display screen, or a key, trackball or touchpad set on the computer device housing, or an external keyboard, touchpad or mouse, etc.
[0118] Those skilled in the art will understand that Figure 8 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0119] In one embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and when the processor executes the computer program, the following steps are implemented:
[0120] Obtain historical material usage data in the spare parts warehouse, and sort the historical material usage data according to time and quantity of goods to obtain sorted data;
[0121] Perform data preprocessing on the sorted data to obtain a historical data set;
[0122] Construct a prediction model network based on GRU-Attention, and obtain several parameter groups through grid search method, and select model training parameters from several parameter groups;
[0123] Obtain the names of each category from the historical data set, and build a multi-material category prediction model group based on the prediction model network and category names;
[0124] Obtain the data to be prepared and input it into the material category forecast model group to obtain the preparation forecast data.
[0125] In one embodiment, when the processor executes the computer program, the following steps are also implemented: normalizing the sorted data, and dividing the processed data into input data and verification data according to the time step; using the input data and verification data as a supervised learning group, and dividing the supervised learning group into a training history data set and a test history data set.
[0126] In one embodiment, when the processor executes the computer program, the following steps are also implemented: the input layer is composed of material samples and time steps, and the GRU unit and the Attention layer are used as hidden layers to construct the output layer; the initial prediction model network is built with the input layer, the hidden layer, and the output layer; MAE and RMSE are used as model evaluation criteria to evaluate and modify the initial prediction model network to obtain a prediction model network based on GRU-Attention.
[0127] In one embodiment, the GRU unit includes: a reset gate, an update gate, a candidate hidden state, and a hidden state, wherein: the reset gate is used to control the memory state saved by the historical GRU unit; the update gate is used to control the number of copies of the historical GRU unit contained in the GRU unit; the candidate hidden state is used to assist in calculating the hidden state; the hidden state is used to output the hidden state in combination with the update gate.
[0128] In one embodiment, when the processor executes the computer program, the following steps are also implemented: obtaining a parameter list; selecting a parameter from the parameter list as a variable, and keeping the other parameters unchanged as a group of parameter groups for training, and expanding each parameter group in the form of a grid, and comparing each training result; selecting model training parameters according to each training result.
[0129] In one embodiment, when the processor executes the computer program, the following steps are also implemented: calculating the loss value corresponding to each training result; using each loss value as a selection criterion, and determining the model training parameters from the parameter list.
[0130] In one embodiment, when the processor executes the computer program, the following steps are also implemented: extracting the name of the category to be prepared and the time to be prepared from the to-be-prepared data; inputting the name of the category to be prepared and the time to be prepared into the material category prediction model group, and calculating all the stock quantities of the goods corresponding to the category name to be prepared within the time to be prepared through the material category prediction model group; and outputting the stock quantity as stock prediction data through the material category prediction model group.
[0131] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented:
[0132] Obtain historical material usage data in the spare parts warehouse, and sort the historical material usage data according to time and quantity of goods to obtain sorted data;
[0133] Perform data preprocessing on the sorted data to obtain a historical data set;
[0134] Construct a prediction model network based on GRU-Attention, and obtain several parameter groups through grid search method, and select model training parameters from several parameter groups;
[0135] Obtain the names of each category from the historical data set, and build a multi-material category prediction model group based on the prediction model network and category names;
[0136] Obtain the data to be prepared and input it into the material category forecast model group to obtain the preparation forecast data.
[0137] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: normalizing the sorted data, and dividing the processed data into input data and verification data according to the time step method; using the input data and verification data as a supervised learning group, and dividing the supervised learning group into a training history data set and a test history data set.
[0138] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: the input layer is composed of material samples and time steps, and the GRU unit and the Attention layer are used as hidden layers to construct the output layer; the initial prediction model network is built with the input layer, the hidden layer, and the output layer; the initial prediction model network is evaluated and modified using MAE and RMSE as model evaluation criteria to obtain a prediction model network based on GRU-Attention.
[0139] In one embodiment, the GRU unit includes: a reset gate, an update gate, a candidate hidden state, and a hidden state, wherein: the reset gate is used to control the memory state saved by the historical GRU unit; the update gate is used to control the number of copies of the historical GRU unit contained in the GRU unit; the candidate hidden state is used to assist in calculating the hidden state; the hidden state is used to output the hidden state in combination with the update gate.
[0140] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: obtaining a parameter list; selecting a parameter from the parameter list as a variable, and keeping the other parameters unchanged as a group of parameter groups for training, and expanding each parameter group in the form of a grid, and comparing each training result; selecting model training parameters according to each training result.
[0141] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: calculating the loss value corresponding to each training result; using each loss value as a selection criterion, and determining the model training parameters from the parameter list.
[0142] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: extracting the name of the category to be prepared and the time to be prepared from the to-be-prepared data; inputting the name of the category to be prepared and the time to be prepared into the material category prediction model group, and calculating all the stock quantities of the goods corresponding to the category name to be prepared within the time to be prepared through the material category prediction model group; and outputting the stock quantity as stock prediction data through the material category prediction model group.
[0143] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).
[0144] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0145] The above-mentioned embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the invention patent. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the patent of the present application shall be subject to the attached claims.
Claims
1. A method for predicting the stock of spare parts warehouse, characterized in that: The method comprises: Acquire historical material usage data in the spare parts warehouse, and sort the historical material usage data according to time and quantity of goods to obtain sorted data; Performing data preprocessing on the sorted data to obtain a historical data set; Constructing a prediction model network based on GRU-Attention, including: using material samples and time steps to form an input layer, using GRU units and Attention layers as hidden layers, and constructing an output layer; using the input layer, the hidden layer, and the output layer to build an initial prediction model network; using MAE and RMSE as model evaluation criteria, evaluating and modifying the initial prediction model network to obtain a prediction model network based on GRU-Attention; searching for several parameter groups through a grid search method, and selecting model training parameters from the several parameter groups; the GRU unit includes: a reset gate, an update gate, a candidate hidden state, and a hidden state, wherein: the reset gate is used to control the memory state saved by the historical GRU unit; the update gate is used to control the number of copies of the historical GRU unit contained in the GRU unit; the candidate hidden state is used to assist in calculating the hidden state; the hidden state is used to output the hidden state in combination with the update gate; Acquire each category name from the historical data set, and construct a multi-material category prediction model group based on the prediction model network and the category name; wherein the multi-material category prediction model group includes each material category prediction model, and each material category prediction model is used to predict different material categories; The data to be prepared is obtained and inputted into the material category prediction model group to obtain the preparation forecast data, including: extracting the name of the category to be prepared and the time to be prepared from the data to be prepared; inputting the name of the category to be prepared and the time to be prepared into the material category prediction model group, and calculating all the preparation quantities of the goods corresponding to the name of the category to be prepared within the time to be prepared through the material category prediction model group; and outputting the preparation quantity as the preparation forecast data through the material category prediction model group.
2. The method for predicting the stock of spare parts warehouse according to claim 1, characterized in that: The data preprocessing is performed on the sorted data to obtain a historical data set, including: Normalizing the sorted data, and dividing the processed data into input data and verification data according to the time step; The input data and the verification data are used as a supervised learning group, and the supervised learning group is divided into a training history data set and a testing history data set.
3. The method for predicting the stock of spare parts warehouse according to claim 1, characterized in that: A plurality of parameter groups are obtained by searching through a grid search method, and model training parameters are selected from the plurality of parameter groups, including: Get the parameter list; Select one parameter from the parameter list as a variable, and keep the other parameters unchanged as a group of parameter groups for training, and expand each parameter group in the form of a grid, and compare each training result; Model training parameters are selected according to each of the training results.
4. The method for predicting the stock of spare parts warehouse according to claim 3, characterized in that: The selecting model training parameters according to the training results includes: Calculate the loss value corresponding to each of the training results; The model training parameters are determined from the parameter list using each of the loss values as a selection criterion.
5. A spare parts warehouse inventory forecasting system, applied to the method according to any one of claims 1 to 4, characterized in that: The system comprises: A data acquisition module is used to acquire historical material usage data in the spare parts warehouse, and to sort the historical material usage data according to time and quantity of goods to obtain sorted data; A data preprocessing module, used to perform data preprocessing on the sorted data to obtain a historical data set; The network construction and parameter selection module is used to construct a prediction model network based on GRU-Attention, and obtain several parameter groups through grid search method, and select model training parameters from the several parameter groups; A model building module, used for obtaining each category name from the historical data set, and building a multi-material category prediction model group based on the prediction model network and the category name; wherein the multi-material category prediction model group includes each material category prediction model, and each material category prediction model is used to predict different material categories; The stocking forecast module is used to obtain the data to be stocked and input it into the material category forecast model group to obtain the stocking forecast data.
6. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 4 are implemented.
7. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 4 are implemented.
Citation Information
Patent Citations
Stocking system and method
CN102320467A
Optical modem fault prediction method based on time sequence analysis and GRU network
CN115269291A