A waste assessment neural network model training method and waste assessment system
Through the combination of the logarithmic mean loss function and the gradient descent algorithm, the training method of the waste assessment neural network model is optimized, solving the problem of too long training time in the existing technology, and achieving faster model convergence and timeliness prediction.
Patent Information
- Application Number
- CN202410716811.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-04
- Publication Date
- 2025-01-21
- Estimated Expiration
- 2044-06-04
AI Technical Summary
The training time of existing waste evaluation neural network models is too long to meet the timeliness requirements for waste prediction.
A new training method is adopted, by obtaining the sample set and performing iterative training, using the logarithmic mean loss function to calculate the error rate of the sample, and adjusting the weight matrix parameters through the gradient descent algorithm to accelerate the convergence of the model.
It shortens the training time of the scrap assessment neural network model, improves the convergence speed of the model, and meets the timeliness requirements of the scrap trading platform.
Smart Images

Figure CN118709741B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of artificial intelligence technology, and in particular to a waste assessment neural network model training method and a waste assessment system. Background Art
[0002] In the process of processing and production, various waste materials are inevitably generated, such as metal waste, fly ash, smelting waste slag and slag. Buyers and sellers can trade waste materials comprehensively and efficiently through the waste trading platform to achieve waste recycling. In the waste trading platform, after the seller enters the waste information, it is necessary to promptly feedback the seller with forecast information including the selling price and the number of possible buyers. It is time-consuming and difficult to obtain forecast information through manual statistics and analysis of massive data.
[0003] At present, there is a deep learning model based on GRU neural network to replace manual acquisition of waste prediction information, and waste information and historical transaction data are used as training samples of GRU neural network. The trained GRU neural network can quickly output good prediction results. Since the waste trading platform continuously reaches new waste transactions every day, the historical transaction data is constantly updated, and it is necessary to timely train and update the GRU neural network to ensure the effectiveness of the prediction information. This puts forward the requirement of as short a training time as possible for the GRU neural network. However, in the iterative training process of the existing waste GRU neural network, the discriminator uses the mean square loss function to calculate the error rate of the sample, and the mean square loss function may have a larger error, slower gradient descent, and slower convergence, resulting in a longer training time. In addition, in the iterative training process of the existing waste GRU neural network, each iteration usually randomly selects a training sample to adjust the weight matrix parameters of the GRU neural network through the gradient descent algorithm. The gradient descent is slow, resulting in a slow model convergence speed, which is not conducive to improving the efficiency of model training. Summary of the invention
[0004] The present invention aims to solve the technical problem in the prior art that the training time of the waste assessment neural network model is too long and cannot meet the timeliness of waste prediction, improves the training method of the waste assessment neural network model, and provides a waste assessment neural network model training method and a waste assessment system to shorten the training time of the waste assessment neural network.
[0005] In order to achieve the above-mentioned object of the present invention, according to the first aspect of the present invention, the present invention provides a waste assessment neural network model training method, comprising: obtaining a sample set, the sample set comprising a plurality of input vectors and an actual output vector corresponding to each input vector, wherein the input vector comprises the waste type, waste code, waste form, unit price expectation, transaction time and component quantity of the waste, and the actual output vector comprises the transaction unit price of the waste and the number of enterprises participating in the waste transaction; performing iterative training: inputting the sample input vectors into the GRU generation network in sequence according to the order of the sample transaction time in the sample set to generate a predicted output vector for each sample; the discriminator uses the logarithmic mean loss function Calculate the error rate of each sample, and select the maximum error rate as the error rate of this iteration; wherein the logarithmic mean loss function is used to obtain the difference between the logarithmic value of the mean of the numerical values of each dimension in the actual output vector of the sample and the predicted output vector and the mean of the logarithmic value of the numerical values; if the error rate of this iteration is less than or equal to the preset error rate threshold, stop the iteration, use the GRU generation network obtained in this iteration as the waste assessment neural network model, save the model parameters of the waste assessment neural network model to the database, and if the error rate of this iteration is greater than the preset error rate threshold, select the sample with the maximum error rate, adjust the weight matrix parameters of the GRU generation network through the gradient descent algorithm, and enter the next iteration.
[0006] In order to achieve the above-mentioned purpose of the present invention, according to the second aspect of the present invention, the present invention provides a waste assessment neural network model training device, which is used to implement a waste assessment neural network model training method described in the first aspect of the present invention, including: a sample set acquisition module, which is used to acquire a sample set, and the sample set includes multiple input vectors and an actual output vector corresponding to each input vector, wherein the input vector includes the waste code, waste form, unit price expectation, transaction time and component quantity of the waste, and the actual output vector includes the transaction unit price of the waste and the number of enterprises participating in the waste transaction; an iterative training module, which performs iterative training: the sample input vectors are input into the GRU generation network in sequence according to the order of the sample transaction time in the sample set to generate each The discriminator calculates the error rate of each sample using the logarithmic mean loss function, and selects the maximum error rate as the error rate of this iteration; wherein the logarithmic mean loss function is used to obtain the difference between the logarithmic value of the numerical mean of each dimension in the actual output vector of the sample and the predicted output vector and the mean of the logarithmic value of the numerical value; if the error rate of this iteration is less than or equal to the preset error rate threshold, the iteration is stopped, and the GRU generation network obtained in this iteration is used as the waste assessment neural network model, and the model parameters of the waste assessment neural network model are saved to the database. If the error rate of this iteration is greater than the preset error rate threshold, the sample with the largest error rate is selected to adjust the weight matrix parameters of the GRU generation network through the gradient descent algorithm to enter the next iteration.
[0007] In order to achieve the above-mentioned purpose of the present invention, according to the third aspect of the present invention, the present invention provides a computer program product, including a computer program / instruction, which, when executed by a processor, implements the steps of a waste assessment neural network model training method described in the first aspect of the present invention.
[0008] In order to achieve the above-mentioned object of the present invention, according to a fourth aspect of the present invention, the present invention provides an electronic device, the electronic device comprising: at least one processor; and
[0009] A memory communicatively connected to the at least one processor; wherein the memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute a waste assessment neural network model training method as described in the first aspect of the present invention.
[0010] The above-mentioned waste assessment neural network model training method, waste assessment neural network model training device, computer program product and electronic device provided by the first aspect to the fourth aspect of the present invention, in the process of training the waste assessment neural network model, the discriminator calculates the error rate of each sample using the logarithmic mean loss function, selects the maximum error rate as the error rate of this iteration, and in each iteration, selects the sample with the maximum error rate to adjust the weight matrix parameters of the GRU generation network through the gradient descent algorithm, rather than randomly selecting samples in the prior art, thereby increasing the gradient descent speed, accelerating the model convergence, and shortening the training time; the inventor proposes a logarithmic mean loss function, which obtains the error rate by calculating the difference between the logarithmic value of the mean of the numerical values of each dimension in the actual output vector and the predicted output vector of the sample and the mean of the logarithmic value of the numerical value, and utilizes the characteristic of the logarithmic mean loss function that the larger the error, the faster the gradient descent, thereby accelerating the convergence speed of the model, thereby efficiently completing the training of the waste assessment neural network model, shortening the training time, meeting the needs of the waste trading platform to continuously update the waste trading information every day, and timely training and updating the waste assessment neural network model, thereby ensuring the validity of the prediction information.
[0011] In order to achieve the above-mentioned object of the present invention, according to a fifth aspect of the present invention, the present invention provides a distributed training system, comprising at least one management node, a database and at least one learning node; the management node receives waste information and waste transaction information corresponding to the waste information in real time, converts the waste information and the corresponding waste transaction information into input feature vectors and output feature vectors corresponding to the input feature vectors respectively by using a data dictionary, forms a sample with the corresponding input feature vectors and output feature vectors and stores it in the database, and the database records the update time of the sample set of the waste type to which the sample belongs; the waste information includes the waste type; the database stores the sample in the sample set of the waste type according to the waste type to which the sample belongs, and stores model parameters of the waste assessment neural network model corresponding to the waste type one by one; each learning node is assigned to learn a waste assessment neural network model of at least one waste type, the learning node obtains the sample set of the assigned waste type from the database, obtains new model parameters of the waste assessment neural network model according to the waste assessment neural network model training method according to the first aspect of the present invention, and stores the new model parameters of the waste assessment neural network model in the database, and the database records the update time of the model parameters of the waste assessment neural network model of the waste type.
[0012] In order to achieve the above-mentioned object of the present invention, according to a sixth aspect of the present invention, the present invention provides a waste evaluation system, characterized in that it includes at least one evaluation node and the distributed training system described in the fifth aspect of the present invention; the management node is also configured to receive waste information to be evaluated, extract waste types from the waste information to be evaluated, convert the waste information to be evaluated into input vectors to be evaluated using a data dictionary, and send the waste types and the input vectors to be evaluated to any evaluation node; the evaluation node that receives the waste types and the input vectors to be evaluated obtains model parameters of a waste evaluation neural network model corresponding to the waste types from a database, constructs a waste evaluation neural network model according to the obtained model parameters, inputs the input vectors to be evaluated into the constructed waste evaluation neural network model to obtain a predicted output vector, and returns the predicted output vector to the management node; the management node converts the predicted output vector into expected transaction information according to the data dictionary and returns it.
[0013] The distributed training system and waste assessment system provided by the present application distribute functions on different nodes, and each node is independent of each other and does not affect each other, so that the system has stronger stability, scalability and processing capabilities. Different waste assessment neural network models are established according to the types of waste to conduct separate learning and training, which can reduce the complexity of the waste assessment neural network model and avoid overfitting and underfitting of the neural network. At the same time, it can improve the efficiency of learning and training and save resources. The waste assessment neural network models of each type of waste in the waste assessment system are regularly updated, and the sample sets are also continuously updated, which improves the reference value of waste assessment. BRIEF DESCRIPTION OF THE DRAWINGS
[0014] Figure 1 It is a flow chart of a waste material assessment neural network model training method in a preferred embodiment of the present invention;
[0015] Figure 2 is a neural network structure of a waste material assessment neural network model in a preferred embodiment of the present invention;
[0016] Figure 3 is a schematic structural diagram of an electronic device in a preferred embodiment of the present invention;
[0017] Figure 4 is a partial schematic diagram of a data dictionary in a preferred embodiment of the present invention;
[0018] Figure 5 is another partial schematic diagram of a data dictionary in a preferred embodiment of the present invention;
[0019] Figure 6 is another partial schematic diagram of a data dictionary in a preferred embodiment of the present invention;
[0020] Figure 7 This is a sample schematic diagram in a database in a preferred embodiment of the present invention;
[0021] Figure 8 is a flow chart of a distributed training system in a preferred embodiment of the present invention;
[0022] Fig. 9 is a block diagram of a waste material evaluation system in a preferred embodiment of the present invention;
[0023] Fig.10 It is a schematic diagram of the process of a waste assessment system in a preferred embodiment of the present invention. DETAILED DESCRIPTION
[0024] The present invention discloses a method for training a waste material assessment neural network model. In a preferred embodiment, Figure 1As shown, it includes: step S1, obtaining a sample set, the sample set includes multiple input vectors and actual output vectors corresponding to each input vector, wherein the input vector includes the waste type, waste code, waste form, unit price expectation, transaction time and component quantity of the waste, and the actual output vector includes the transaction unit price of the waste and the number of enterprises participating in the waste transaction.
[0025] The sample set comes from historical data. The input vector comes from the waste information in the historical data. The waste information includes multiple dimensions. Therefore, the input vector also has multiple dimensions. The input vector includes the digital representation of the waste type, waste code, waste form, unit price expectation, transaction time and component quantity of the waste. In order to describe the waste more accurately, preferably, the input vector includes macro dimensions, micro dimensions and price dimensions. Among them, the macro dimensions include social factors, economic factors, fiscal policy factors, monetary policy factors, etc., the micro dimensions include waste codes, waste source countries, source country codes, economic levels, waste quality, waste form, transaction time, etc., and the price dimension includes unit price expectation (used to describe the estimated value of the waste), unit price variance (used to describe the dispersion of components), component quantity, etc. The actual output vector comes from the waste transaction information of the waste in the historical data, including the digital representation of the transaction unit price of the waste and the number of enterprises participating in the waste transaction.
[0026] Step S2, perform iterative training of supervised learning: Step S21, input the sample input vector into the GRU generation network in sequence according to the order of sample transaction time in the sample set, and generate a predicted output vector for each sample; Step S22, the discriminator calculates the error rate of each sample using the logarithmic mean loss function, and selects the maximum error rate as the error rate of this iteration; wherein the logarithmic mean loss function is used to obtain the difference between the logarithmic value of the mean of the numerical values of each dimension in the actual output vector of the sample and the predicted output vector and the mean of the logarithmic value of the numerical values; Step S23, if the error rate of this iteration is less than or equal to the preset error rate threshold, then stop the iteration, the iterative training is completed, and the GRU generation network obtained in this iteration is used as the waste assessment neural network model, and the model parameters of the waste assessment neural network model are saved to the database. If the error rate of this iteration is greater than the preset error rate threshold, then select the sample with the largest error rate to adjust the weight matrix parameters of the GRU generation network through the gradient descent algorithm, enter the next iteration, and execute step S21. The model parameters of the waste assessment neural network model preferably include, but are not limited to, weight parameter matrix parameters and the memory vector generated by the last sample.
[0027] In this embodiment, preferably, in order to improve the processing speed, the input vectors and actual output vectors in the sample set are normalized to (-1, 1) before performing the iterative training of step S2. The normalization function of each dimension of the input vector and the actual output vector is preferably but not limited to:
[0028]
[0029] Among them, f(x) represents the normalized dimension value, x represents the dimension value to be normalized, the above normalization function is an odd function (symmetric about the origin), f(x) is monotonically increasing in the real number range, and f(x)∈(-1,1).
[0030] In this embodiment, the waste assessment neural network model adopts a GRU network, which is denoted as a GRU generation network. Figure 2 As shown. Assume that the current input t-th sample data is sent to the GRU generation network, The memory vector generated for the t-1th sample is the memory information passed down from the previous sample training; is the input vector of the tth sample; The memory vector output for the tth sample is used to pass it to the next sample as its memory information; is the output vector of the tth sample, that is, the predicted output vector.
[0031] The symbol is a vector concatenation operation, which concatenates two vectors into one vector, for example:
[0032]
[0033] "⊙" is the Hadamard product of vectors, that is, two vectors of the same dimension are multiplied in opposite positions to obtain a new vector, for example:
[0034]
[0035] The "+" symbol represents the addition of two vectors, that is, two vectors of the same dimension are added in opposite positions to obtain a new vector, for example:
[0036]
[0037]
[0038] There are four gates in the GRU generation network, namely the reset gate, update gate, hidden gate and output gate. Each gate receives a vector (i.e. the input vector corresponding to the gate) and outputs a vector (i.e. the output vector corresponding to the gate). Each gate contains a weight matrix, an activation function and a bias element. The gate input vector is multiplied by the first set of coefficients of the weight matrix (vector inner product) plus the bias element to obtain a value a'. The activation function is used to calculate a' to obtain a value a, which is the value of the first dimension of the gate output vector. The gate input vector is multiplied by the second set of coefficients of the weight matrix (vector inner product) plus the bias element to obtain a value b'. The activation function is used to calculate b' to obtain a value b, which is the value of the second dimension of the gate output vector; other analogies, for example:
[0039] Suppose the activation function of a reset gate is: The value of the bias element is 1, and the weight matrix is:
[0040]
[0041] The input vector of the reset gate is (0.24, 0.13), which is multiplied by the first set of coefficients of the weight matrix plus the bias element: 0.1*0.24+0.3*0.13+1=1.063, and then the activation function This vector is multiplied by the second set of coefficients of the weight matrix plus the bias element: 0.4*0.24+0.2*0.13+1=1.122, through the activation function This vector is multiplied by the third set of coefficients of the weight matrix plus the bias element: 0.1*0.24+0.6*0.13+1=1.102, and the activation function Then the output vector of the reset gate after operation on the input vector (0.24, 0.13) is (0.7433, 0.7543, 0.7506).
[0042] Figure 2 In, w r is the weight matrix of the reset gate, w z is the weight matrix of the update gate, w h is the weight matrix of the hidden gate, w y is the weight matrix of the output gate; a r Reset the activation function of the gate; a z is the activation function of the update gate, a h is the activation function of the hidden door, a y is the activation function of the output gate.
[0043] In this embodiment, refer to Figure 2, the process of generating a predicted output vector based on the input vector of the tth sample includes:
[0044] (1) The memory vector generated and passed down by the t-1th sample The input vector with the tth sample pass (concatenate) operation to concatenate and obtain a vector
[0045] (2) As the input vector of the reset gate, through the reset gate (w r is the weight matrix, a r is the activation function) to get the output vector, that is, the reset vector
[0046] (3) As the input vector of the update gate, through the update gate (w z is the weight matrix, a z is the activation function) to get the output vector, that is, the update vector
[0047] (4) and Perform the "⊙" (Hadamard product) operation to obtain a new vector with the same number of dimensions, and compare the new vector with pass (concatenate) operation to concatenate and obtain a vector
[0048] (5) is the input vector of the hidden gate, through the hidden gate (w h is the weight matrix, a h is the activation function) to obtain the output vector, that is, the hidden vector
[0049] (6) Calculate the memory vector of the tth sample. The calculation formula is:
[0050]
[0051] in, represents a vector with all dimension values 1, The larger the value of , the smaller the influence of the memory generated by the t-1th sample on the tth sample, and vice versa; As the memory vector of the t+1th sample (the next sample);
[0052] (7) is the input vector of the output gate, passing through the output gate (w y is the weight matrix, ay is the activation function) to get the output vector That is, the output vector generated by the GRU generation network is the prediction vector; the memory vector received by the first sample data during training Get from the database.
[0053] In the GRU generation network, the vector The number of dimensions is the same as that of the GRU generator network; the vector The number of dimensions is the number of memories of the GRU generator network and the input vector The sum of the number of dimensions.
[0054] In this embodiment, in step S23, the weight matrix parameters of the GRU generation network are adjusted, that is, the four weight matrices (w r 、w z 、w h 、w y ) parameters. At the beginning of iterative training, the four weight matrices are randomly generated. The GRU generator network and the discriminator form the GAN network architecture. The GAN network architecture is trained from the earliest transaction sample in the order of the transaction time dimension of the samples. The complete execution of steps S21 to S23 once is recorded as one iteration.
[0055] To facilitate subsequent calculations, during the execution of step S21, the memory vector generated by the input vector of each sample is It corresponds one-to-one with the sample data and is saved in memory so that the sample data can be used to calculate the gradient later.
[0056] In this embodiment, the input vectors of all samples are generated through the GRU network to generate predicted output vectors, and the discriminator of the GAN network calculates multiple error rates e according to the actual output vectors of each sample and the generated predicted output vectors. Let the variable v = max{e i' -e'}, e' represents the preset error rate threshold, e i' is the error rate between the predicted output vector of the i'th sample and its actual output vector calculated by the discriminator, and v is the maximum value of the k (sample) error rates minus e'; if v≤0, the GRU generation network is considered to have reached an ideal state and the iterative training is completed; if v>0, perform the following operations: select the sample data p corresponding to the v value (maximum error rate) as the sample data for adjusting the parameters of each weight matrix of the GRU generation network, and use the gradient descent algorithm to adjust the parameters of each weight matrix.
[0057] In a preferred embodiment, each gate includes a weight matrix, an activation function and a bias element. The weight matrix is updated and adjusted through the above-mentioned iterative training. The bias element of the reset gate, update gate, and hidden gate is preferably, but not limited to, set to 1; the bias element of the output gate is preferably, but not limited to, set to 0.
[0058] In this implementation, in order to facilitate the introduction of nonlinear change factors in each gate control, the reset gate, update gate, and output gate use the inverse cotangent function as the activation function, and the hidden gate uses the hyperbolic tangent function as the activation function. Specifically:
[0059] The activation function of the output gate is:
[0060]
[0061] The derivative function of the activation function of the output gate is:
[0062]
[0063] Among them, y' i It represents the i-th dimension value of the result y' obtained after the input vector of the output gate is processed by the output gate weight matrix and the output gate bias element. The weight coefficients of all dimensions of the input vector of the output gate constitute the output gate weight matrix.
[0064] The activation function of the hidden door is:
[0065]
[0066] The derivative function of the activation function of the hidden gate is:
[0067]
[0068] Among them, h' i The i-th dimension value of the result h' obtained after the input vector of the hidden gate is processed by the hidden gate weight matrix and the hidden gate bias element, and the weight coefficients of all dimensions of the input vector of the hidden gate constitute the hidden gate weight matrix.
[0069] The activation function of the reset gate is:
[0070]
[0071] The derivative of the activation function of the reset gate is:
[0072]
[0073] Among them, r' iRepresents the i-th dimension value of the result r' obtained after the input vector of the reset gate is processed by the reset gate weight matrix and the reset gate bias element, and the weight coefficients of all dimensions of the input vector of the reset gate constitute the reset gate weight matrix.
[0074] The activation function of the update gate is:
[0075]
[0076] The derivative function of the activation function of the update gate is:
[0077]
[0078] Among them, z' i Represents the i-th dimension value in the result z' obtained after the input vector of the update gate is processed by the update gate weight matrix and the update gate bias element. The weight coefficients of all dimensions of the input vector of the update gate constitute the update gate weight matrix.
[0079] In a preferred embodiment, the calculation formula for calculating the sample error rate using the logarithmic mean loss function is:
[0080]
[0081] Wherein, i represents the dimension index of the actual output vector / predicted output vector, and the actual output vector and the predicted output vector have the same number of dimensions; represents the loss function of the actual output vector and the predicted output vector in dimension i, n represents the number of dimensions of the actual output vector and the predicted output vector. n is 2, including the transaction price and the number of enterprises participating in the waste transaction. y i Represents the value of dimension i in the actual output vector, Represents the value of dimension i in the predicted output vector.
[0082] In this embodiment, the values of each dimension of the actual output vector and the predicted output vector are calculated using the loss function The value obtained by calculating the loss and summing it up is called the "error rate". During training, each sample data will get an error rate. The error between the predicted output vector generated by the sample input vector and the actual output vector of the sample is used to determine whether the GRU generation network needs to continue learning and training to adjust the weight matrix parameters. i and The closer, that is, y i and The smaller the error, The smaller the value of hour,
[0083] In this embodiment, preferably, the loss function right The partial derivative function is:
[0084]
[0085] In this embodiment, the logarithmic mean loss function is used to calculate the error between the predicted output vector and the actual output vector of the sample. By utilizing the characteristic that the larger the error of the logarithmic mean loss function, the faster the gradient descent, the faster the model convergence speed can be accelerated and the efficiency of model training can be improved.
[0086] In a preferred embodiment, the sample with the largest error rate is selected to adjust the weight matrix parameters of the GRU generation network through a gradient descent algorithm, including:
[0087] Step 1: Memory vectors generated during training of sample p with the maximum error rate and the previous sample p' of sample p Input the GRU generation network and record the intermediate parameters generated by the GRU generation network for calculating the gradient to obtain the loss function The partial derivative function value of each dimension of each gated input vector in the GRU generation network is the gradient function, where the gating of the GRU generation network includes the output gate, hidden gate, reset gate and update gate.
[0088] Step 2: Update the weight coefficient of each dimension of each gate input vector according to the following formula:
[0089]
[0090] Among them, w t+1 represents the weight coefficient of each dimension of each gate input vector in the t+1th iteration, w t It represents the weight coefficient of each dimension of each gated input vector in the tth iteration, and α represents the learning rate (LEARNING_RATE), which is the preset parameter of the GRU generation network.
[0091] Step 3: The weight coefficients of all dimensions of the input vectors of the output gate, hidden gate, reset gate, and update gate in the GRU generation network constitute the weight matrix parameters of the GRU generation network. Specifically, the weight coefficients of all dimensions of the input vector of the output gate constitute the output gate weight matrix parameters of the GRU generation network, the weight coefficients of all dimensions of the input vector of the hidden gate constitute the hidden gate weight matrix parameters of the GRU generation network, the weight coefficients of all dimensions of the input vector of the reset gate constitute the reset gate weight matrix parameters of the GRU generation network, and the weight coefficients of all dimensions of the input vector of the update gate constitute the update gate weight matrix parameters of the GRU generation network.
[0092] In this embodiment, when updating the weight coefficient of the jth dimension of the output gate input vector, the loss function The partial derivative value of the j-th dimension of the output gate input vector The calculation formula is:
[0093]
[0094] in, is the loss function; y i is the value of the i-th dimension of the actual output vector of sample data p; The value of the i-th dimension of the predicted output vector (also the output vector of the output gate) obtained by the GRU generation network; m j The value of the j-th dimension of the input vector of the output gate in the GRU generation network (i.e., m j is the input vector of the output gate The value of the jth dimension), let m j The weight coefficient at the output gate is w t ; is the loss function The partial derivative function value of a' y (y' i ) is the derivative function of the activation function of the output gate, y' i The value obtained by multiplying the input vector of the output gate by the i-th group of coefficients of the weight matrix of the output gate (vector inner product) plus the bias element; w yij is the current value of the i-th row and j-th column of the output gate's weight matrix.
[0095] When updating the weight coefficient of the jth dimension of the hidden gate input vector, the loss function The partial derivative value of the j-th dimension of the hidden gate input vector The calculation formula is:
[0096]
[0097] in, is the loss function; g j The value of the j-th dimension of the input vector of the hidden gate in the GRU generation network (i.e., g j is the input vector of the hidden gate The value of the jth dimension), let g j The weight coefficient of the hidden door is w t ; is the loss function The partial derivative function value of a' y (y' i ) is the derivative function of the activation function of the output gate, y' iis the value obtained by multiplying the input vector of the output gate by the i-th group of coefficients of the weight matrix of the output gate (vector inner product) plus the bias element; n is the number of memories of the GRU generation network (the number of dimensions of the memory vector); w yik is the value of the i-th row and k-th column of the weight matrix of the output gate; z k is the value of the kth dimension of the updated vector; a' h (h' k ) is the derivative function of the hidden gate activation function, h' k The value obtained by multiplying the input vector of the hidden gate by the kth group of coefficients of the weight matrix of the hidden gate (vector inner product) plus the bias element; w hkj is the value of the kth row and jth column of the weight matrix of the hidden gate.
[0098] When updating the weight coefficient of the jth dimension of the reset gate input vector, the loss function The partial derivative value of the j-th dimension of the reset gate input vector The calculation formula is:
[0099]
[0100] in, is the loss function; f j The value of the j-th dimension of the input vector that resets the gate in the GRU generation network (i.e., f j is the input vector of the reset gate The value of the jth dimension), let f j Reset the gate weight coefficient to w t ; is the loss function The partial derivative function value of a' y (y' i ) is the derivative function of the activation function of the output gate, y' i The value obtained by multiplying the input vector of the output gate by the i-th group of coefficients of the weight matrix of the output gate (vector inner product) plus the bias element; a' r (r' k ) is the derivative function of the hidden gate activation function, h' k is the value obtained by multiplying the input vector of the hidden gate by the kth group of coefficients of the weight matrix of the hidden gate (vector inner product) plus the bias element; n is the number of memories generated by the GRU network (the number of dimensions of the memory vector); m (t-1)k is the memory vector of the previous sample p' The value of the kth dimension; a' r (r' k ) is the derivative function of the reset gate, r' k The value obtained by multiplying the input vector of the reset gate by the kth group of coefficients of the weight matrix of the reset gate (vector inner product) plus the bias element; w rkjTo reset the value of the kth row and jth column of the gate weight matrix; z k To update the vector The value of the kth dimension; c is the dimension of the input vector of the GRU generation network (the input vector of the sample), and n+c is the dimension of the input vector of the hidden gate; w hik is the value of the i-th row and k-th column of the weight matrix of the hidden gate.
[0101] When updating the weight coefficient of the jth dimension of the update gate input vector, the loss function The partial derivative value of the j-th dimension of the update gate input vector The calculation formula is:
[0102]
[0103] in, is the loss function; f j Generate the value of the j-th dimension of the input vector of the update gate in the GRU network (i.e., f j is the input vector of the update gate The value of the jth dimension), let f j The weight coefficient in the update gate is w t ; is the loss function The partial derivative function value of a' y (y' i ) is the derivative function of the activation function of the output gate, y' i is the value obtained by multiplying the input vector of the output gate by the i-th group of coefficients of the weight matrix of the output gate (vector inner product) plus the bias element; n is the number of memories of the GRU generation network (the number of dimensions of the memory vector); w yik is the value of the i-th row and k-th column of the weight matrix of the output gate; h k is the hidden vector The value of the kth dimension; m (t-1)k is the memory vector of the previous sample p' The value of the kth dimension; a' z (z' k ) Update the derivative of the gate’s activation function, z’ k The value obtained by multiplying the input vector of the update gate by the kth group of coefficients of the weight matrix of the update gate (vector inner product) plus the bias element; w zkj is the value of the kth row and jth column of the weight matrix of the update gate.
[0104] The present invention also discloses a waste assessment neural network model training device, which is used to implement the above-mentioned waste assessment neural network model training method. In a preferred embodiment, it includes: a sample set acquisition module, which is used to acquire a sample set, wherein the sample set includes multiple input vectors and an actual output vector corresponding to each input vector, wherein the input vector includes the waste code, waste form, unit price expectation, transaction time and component quantity of the waste, and the actual output vector includes the transaction unit price of the waste and the number of enterprises participating in the waste transaction; an iterative training module, which performs iterative training: the sample input vectors are input into the GRU generation network in sequence according to the order of the sample transaction time in the sample set to generate a predicted output vector for each sample; a discriminant The device calculates the error rate of each sample using the logarithmic mean loss function, and selects the maximum error rate as the error rate of this iteration; wherein the logarithmic mean loss function is used to obtain the difference between the logarithmic value of the numerical mean of each dimension in the actual output vector of the sample and the predicted output vector and the mean of the logarithmic value of the numerical value; if the error rate of this iteration is less than or equal to the preset error rate threshold, the iteration is stopped, and the GRU generation network obtained in this iteration is used as the waste assessment neural network model, and the model parameters of the waste assessment neural network model are saved to the database. If the error rate of this iteration is greater than the preset error rate threshold, the sample with the largest error rate is selected to adjust the weight matrix parameters of the GRU generation network through the gradient descent algorithm to enter the next iteration.
[0105] In this embodiment, the sample set acquisition module and the iterative training module correspond one-to-one to step S1 and step S2 of the above-mentioned waste assessment neural network model training method, and will not be repeated here.
[0106] The present invention also discloses a computer program product, including a computer program / instruction, which, when executed by a processor, implements the steps of the above-mentioned waste assessment neural network model training method provided by the present invention. The computer program product should be understood as a software product that mainly implements its solution through a computer program, such as a program product integrated in the cloud or a software library.
[0107] The present invention also discloses an electronic device. In one embodiment, the electronic device includes at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute a waste assessment neural network model training method provided by the present invention.
[0108] like Figure 3, which is a schematic diagram of the structure of an electronic device for a waste assessment neural network model training method provided by an embodiment of the present invention. The electronic device may include a processor 10, a memory 11, a communication bus 12, and a communication interface 13, and may also include a computer program stored in the memory 11 and executable on the processor 10, such as a waste assessment neural network model training method program.
[0109] The present invention also discloses a distributed training system, including at least a management node, a database and at least one learning node. The management node and the learning node are preferably, but not limited to, personal computers and servers. The database is preferably, but not limited to, a server. The management node receives waste information and waste transaction information corresponding to the waste information in real time, and uses a data dictionary to convert the waste information and the corresponding waste transaction information into input feature vectors and output feature vectors corresponding to the input feature vectors, respectively, and stores the corresponding input feature vectors and output feature vectors into a sample in the database, and the database records the update time of the sample set of the waste type to which the sample belongs; the waste information includes the waste type. The database stores the sample in the sample set of the waste type according to the waste type to which the sample belongs, and stores the model parameters of the waste evaluation neural network model corresponding to the waste type one by one. The database also stores the hyperparameters of the GRU generation network, including the maximum error rate, the learning rate, the bias elements of each gate, and the initial memory vector used for learning node training. Each learning node is assigned to learn a waste assessment neural network model of at least one waste type. The learning node obtains a sample set of the assigned waste type from a database, obtains new model parameters of the waste assessment neural network model according to the above-mentioned waste assessment neural network model training method, and stores the new model parameters of the waste assessment neural network model in the database, which records the update time of the model parameters of the waste assessment neural network model of the waste type.
[0110] In this embodiment, the management node provides an interface for receiving sample data for external system calls, and is used to receive sample data (waste information and waste transaction information corresponding to the waste information) pushed by the external system in real time. The external system is preferably, but not limited to, a waste trading platform or a web page information collection component. The form of the sample data pushed by the external system received by the management node is defined as the first form; the management node converts the sample of the first form into the corresponding feature vector, and defines the form of the sample data that converts the sample data of the first form into the corresponding feature vector as the second form; the sample data of the second form is saved to the database, and the form of the sample data that saves the sample data of the second form to the database is defined as the third form of the sample data. The different forms of sample data are explained below:
[0111] (1) The input parameters (the first form of sample data) of the receiving sample data interface include:
[0112] Waste ID: unique identifier of waste;
[0113] Waste type: waste type code, for example, the code for "smelting waste slag" is "SW01", the code for "fly ash" is "SW02", and the code for "slag" is "SW03". This parameter is determined by the "waste code" parameter; this parameter determines which neural network model and learning node will be used to train the sample data;
[0114] Waste code: The code of the waste (the code comes from the data code table, which is stored in the database of the waste trading platform). The waste code is composed of numbers and the format is "waste production industry-waste sequence code-waste secondary classification code". Among them, the range of "waste production industry" is 1.00-9.99; the coding range of "waste sequence code" is 1-99; the coding range of "waste secondary classification code" is 1-99, for example, "blast furnace slag. In the process of smelting pig iron in a blast furnace, the ash and flux in the iron ore and coke and the impurities that cannot enter the pig iron form a slag floating on the molten iron, which is mainly composed of silicates and chloroaluminates. The main components are calcium oxide, silicon dioxide and aluminum oxide." The code is "3.11-2-1". The "waste code" and "waste type" are a one-to-many relationship, that is, the "waste type" is determined by determining the "waste code". When entering waste information on the waste trading platform, the seller of the waste selects or enters it on the page;
[0115] Country of origin of the waste: Use the three-letter code of the national standard GB / T 2659.3;
[0116] Bond status: bonded / non-bonded;
[0117] Waste type: general waste / hazardous waste / metal waste;
[0118] Waste quality: scraps / waste / defective products / by-products;
[0119] Waste form: liquid / mud / powder / granule / lump / spherical / strip
[0120] Transaction time: the time of the waste transaction. This parameter is filled in by the seller of the waste when the waste information is entered on the waste trading platform;
[0121] Composition and content: composition and content of the waste (only valuable components and content are required), in json format. For example, if a waste contains 0.03% copper, 0.01% cobalt and 3% iron, the value of this parameter is: [{"copper","0.03%"},{"cobalt","0.01%"},{"iron":"3%"}];
[0122] Transaction price: The transaction price of waste materials, converted into "RMB (cents) / kg";
[0123] Number of enterprises participating in the waste transaction: the number of enterprises participating in the waste transaction on the waste trading platform.
[0124] (2) The sample data table in the database (used to save the sample data in the second form to the database and convert it into sample data in the third form) contains the following fields (field codes are in brackets):
[0125] Sample ID (SAMPLE_ID): unique identifier of the sample;
[0126] Waste type (CATALOG): The waste type of the sample. This field is used to distinguish samples during learning node training. Neural network models with different waste types use sample data of different waste types.
[0127] Input vector (INPUT_TENSOR): input vector of sample data, stored in json format;
[0128] Output vector (OUTPUT_TENSOR): the output vector of the sample CNC, stored in json format;
[0129] Sample TRADE_TIME: The "trading time" parameter of the sample data of the first form.
[0130] The mapping relationship between the sample data of the second form and the sample data of the third form is shown in Table 1 below:
[0131] Table 1 Mapping relationship between the second form and the third form
[0132]
[0133] In this embodiment, the process of converting the feature vector of the sample data by the management node, that is, converting the sample data in the first form into the sample data in the second form, is as follows:
[0134] (1) The input vector contains three dimensions: macro dimension, micro dimension, and price dimension.
[0135] 1) The macro dimension is used to describe the macro environment (social environment, economic environment, etc.), and includes the following dimensions: social factors, economic factors, fiscal policy factors, and monetary policy factors. These dimensions are obtained from the data dictionary (macro dimension table) in the database according to the transaction time of the waste. The macro dimension table contains the following fields (field codes in brackets):
[0136] Creation time (CREATE_TIME): the creation time of the record;
[0137] Social factors (SOCIETY): the value of the social factor dimension, floating point number, accurate to 3 decimal places;
[0138] Economic factor (ECONOMY): the value of the economic factor dimension, a floating point number, accurate to 3 decimal places;
[0139] Fiscal policy factor (FINANCE): the value of the fiscal policy factor dimension, a floating point number, accurate to 3 decimal places;
[0140] Monetary policy factor (CURRENCY): The value of the monetary policy factor dimension, a floating point number, accurate to 3 decimal places.
[0141] Obtain the latest record from the "macro dimension table" whose "creation time (CREATE_TIME)" is less than or equal to the value of the "transaction time" parameter of the sample data in the first form. The values of the four fields of social factors, economic factors, fiscal policy factors, and monetary policy factors in this record are the values of the macro dimensions of the input vector of the sample data.
[0142] 2) The microscopic dimension is used to describe the specific conditions of the waste:
[0143] Waste code: corresponds to the value of the "waste code" parameter of the sample data of the first form. This code is converted into three dimensions according to the coding format: the industry that produces the waste, the sequence code of the waste, and the secondary classification code of the waste.
[0144] Waste source country: corresponds to the value of the "waste source country" parameter of the sample data of the first form, and obtains the dimension value from the data dictionary (source country dimension table) of the database based on this value, including the three dimensions of the waste source country: economic level, industrial level, and natural resources. The data dictionary (source country dimension table) contains the following fields (field codes in brackets):
[0145] Country of origin code (NATION_CODE): Use the 3-letter code of the national standard GB / T 2659.3;
[0146] Economic level (ECONOMY_LEVEL): used to describe the economic level of the country where the waste comes from, floating point number, accurate to 3 decimal places;
[0147] Industry level (INDUSTRY_LEVEL): A floating point number used to describe the industry level of the country of origin, accurate to 3 decimal places;
[0148] NATURAL_RESOURCES: A floating point number used to describe the natural resource situation of the country of origin, accurate to 3 decimal places;
[0149] Creation time (CREATE_TIME): The time when the record was created.
[0150] According to the values of the "waste source country" parameter and the "transaction time" parameter of the sample data of the first form, obtain the latest record of the corresponding waste source country whose "creation time (CREATE_TIME)" is less than or equal to the value of the "transaction time" parameter of the sample data of the first form. The values of the economic level, industrial level, and resource conditions of this record are the dimension values corresponding to the "waste source country" of the input vector of the sample data.
[0151] Bonded status: corresponding to the "Bonded status" parameter of the sample data of the first form, "Bonded" is converted to the dimension value "1.1" and "Non-Bonded" is converted to the latitude value "1.5".
[0152] Waste type: Corresponding to the "waste type" parameter of the first form of sample data, "ordinary waste" is converted to the dimension value "1.1", "hazardous waste" is converted to the dimension value "1.2", and "metal waste" is converted to the dimension value "1.5".
[0153] Scrap quality: Corresponding to the "scrap quality" parameter of the first form of sample data, "scraps" are converted to the latitude value "1.1", "scrap" is converted to the latitude value "1.2", "defective products" is converted to the latitude value "1.5", and "by-products" is converted to the latitude value "1.7".
[0154] Waste form: Corresponding to the "waste form" parameter of the sample data of the first form, "liquid" is converted to the dimension value "1.1", "mud" is converted to the dimension value "1.2", "powder" is converted to the dimension value "1.3", "granular" is converted to the dimension value "1.4", "lump" is converted to the dimension value "1.5", "spherical" is converted to the dimension value "1.6", and "strip" is converted to the dimension value "1.7".
[0155] Trading time: According to the "trading time" parameter of the sample data corresponding to the first form, the quarter of the year corresponding to the "trading time" is obtained. If it is the first quarter, the dimension value is "2.1", if it is the second quarter, the dimension value is "2.2", if it is the third quarter, the dimension value is "2.3", and if it is the fourth quarter, the dimension value is "2.4".
[0156] 3) The price dimension is used to describe the value of the components and content of the waste, and includes three dimensions: unit price expectation (used to describe the estimated value of the waste), unit price variance (used to describe the dispersion of components), and component quantity (used to describe the complexity of components).
[0157] The data dictionary (ingredient unit price table) contains the following fields:
[0158] COMPOSITION_NAME: component name, such as copper, cobalt, aluminum oxide, etc.
[0159] COMPOSITION_PRICE: the unit price of the component, in "RMB (cents) / kg";
[0160] Creation time (CREATE_TIME): The time when the record was created.
[0161] According to the "ingredients and content" parameters and "transaction time" parameters corresponding to the first form of sample data, the latest (the latest record that is less than or equal to the value of the "transaction time" parameter of the first form of sample data) price of each component of the waste is obtained from the data dictionary (component unit price table) in the database.
[0162] For example, the "Composition and Content" parameter of a certain waste is: [{"Neodymium Praseodymium Oxide","0.03%"},{"Scandium","0.02%"}], and the "Transaction Time" parameter is "2024-02-11 09:30:00". The database reference in the data dictionary (composition unit price table) Figure 4 shown.
[0163] The unit price of "praseodymium neodymium oxide" obtained is "38089", that is, 38089 points / kilogram; the unit value of "scandium" obtained is "40130", that is, 40130 points / kilogram.
[0164] According to the obtained unit price and content of each component, the expected unit price of the waste is calculated as E = ∑ (unit price * content) = 38089 * 0.03% + 40130 * 0.02% = 19.452 cents / kg, that is, the value of the unit price expectation dimension is 19.4527;
[0165] Calculate the variance of the unit price of scrap That is, the value of the unit price variance dimension is 97.4931;
[0166] This waste contains two valuable components (praseodymium neodymium oxide and scandium), that is, the value of the component quantity dimension is 2.
[0167] (2) The output vector contains two dimensions (two-dimensional vector): the transaction price (converted to "RMB (fen) / kg") and the number of companies participating in the waste transaction.
[0168] (3) The dimension number of the input vector is: macro dimension (4) + micro dimension (11) + price dimension (3) = 18; the dimension number of the output vector is 2.
[0169] The data of the database dictionary table (macro dimension table, country of origin dimension table, ingredient unit price table) can be imported in advance, and a management page can also be provided for management; the data of the ingredient unit price table can also be regularly obtained from relevant websites through the interface.
[0170] For example, a sample data of the first form pushed by the waste trading platform to the management node is shown in Table 2 below:
[0171] Table 2 Example of sample data of the first form
[0172]
[0173]
[0174] Data reference of data dictionary (macro dimension table) Figure 5 As shown in the figure, the corresponding macro-dimensional values obtained according to the "transaction time" are: 8.2, 7.8, 8, 8.8; the converted dimension value of the waste code (3.21-10-1) is: 3.21, 10, 1.
[0175] The data in the data dictionary (origin country dimension table) is as follows Figure 6 As shown:
[0176] The values of the dimension "waste source country" obtained based on "transaction time" are: 9, 8.7, 9.5;
[0177] Bonded status: "Non-bonded" is converted to dimension value 1.5;
[0178] Scrap type: "Metal Scrap" Metal Scrap is converted to dimension value 1.5;
[0179] Scrap quality: "Scrap" is converted to a latitude value of 1.2;
[0180] Waste form: "Block" is converted to dimension value 1.5;
[0181] Transaction time: "2024-02-1116:14:12" is the first quarter, converted to dimension value 2.1;
[0182] Ingredients and content: According to the above example, the converted dimension values are: 19.4527, 97.4931, 2;
[0183] Therefore, the input vector of the second form of sample data obtained after conversion is: (8.2, 7.8, 8, 8.8, 3.21, 10, 1, 9, 8.7, 9.5, 1.5, 1.5, 1.2, 1.5, 2.1, 19.4527, 97.4931, 2), and the output vector is: (21, 7). The second form of sample data is saved to the database as follows Figure 7 shown.
[0184] In this embodiment, the learning node is responsible for learning and training the sample data (the sample data of the third form) converted by the management node according to the set waste assessment neural network model, and saving the model parameters obtained by learning and training to the database. Different waste types can be set with different waste assessment neural network models (the models are saved in the database), and multiple waste assessment neural network models are learned and trained by multiple learning nodes. Each learning node is configured with a "learning node name" attribute. The waste assessment neural network model saved in the database has a "learning node name" field, which is used to identify the learning node with the corresponding name for learning and training. One waste type is learned and trained by one of the learning nodes, and one learning node is responsible for the learning and training of multiple waste types. Different waste assessment neural network models obtain different model parameters after learning and training.
[0185] In this embodiment, GRU (Gated Recurrent Neural Network) + GAN (Generative Adversarial Neural Network) is used for supervised learning training. Among them, the GRU network is used as the generator of the GAN neural network, denoted as the GRU generation network, to generate predicted output vector data. The loss function is used as the discriminator of the GAN neural network to compare the predicted output vector generated by the GRU generation network with the actual output vector (judgment error), and the gradient descent algorithm is used to adjust the weight matrix parameters of each gate of the GRU generation network according to the comparison result.
[0186] In this embodiment, the waste material assessment neural network model is stored in a database (needs to be pre-set and saved in the database). Preferably, the neural network model table stored in the database includes the following fields (field codes in brackets):
[0187] Waste type (CATALOG): used to identify the waste type for training and evaluation of this model;
[0188] Trainer: The name of the training node, used to identify which learning node is used to train the model;
[0189] Number of memories (MEMERY_SIZE): The number of dimensions of the reset vector, update vector, hidden vector, and memory vector of the GRU neural network, usually twice the number of "input vector dimensions";
[0190] Input vector dimension (INPUT_SIZE): The dimension of the GRU neural network input vector is consistent with the dimension of the input vector of the sample data;
[0191] Output vector dimension (OUTPUT_SIZE): The dimension of the output vector of the GRU neural network is consistent with the dimension of the output vector of the sample data;
[0192] Initial memory vector (MEMERY_TENSOR0): The memory vector of the first sample data input during GRU network training. The dimension of this parameter (vector) is the same as the "Number of memories". Usually, all dimension values of this parameter are set to 0. You can also set it as needed and store it in json format.
[0193] Learning rate (LEARNING_RATE): This parameter is used by the recursive formula of the learning node to adjust the weight coefficient of each dimension of each gate input vector, and is usually set to 0.01;
[0194] Maximum error rate (MAX_ERROR): The preset error rate threshold of the neural network model, usually set to 0.01;
[0195] Reset gate bias element (RESET_BIAS): Reset gate bias element, usually set to 1, but can be set as needed;
[0196] Reset gate matrix parameters (RESET_MATRIX): used to store the reset gate matrix parameters obtained after the learning node training is completed, stored in json format;
[0197] Update gate bias element (UPDATE_BIAS): Update gate bias element, usually set to 1, but can be set as needed;
[0198] Update gate matrix parameters (UPDATE_MATRIX): used to store the update gate matrix parameters obtained after the learning node training is completed, stored in json format;
[0199] Hidden door bias element (HIDDEN_BIAS): The bias element of the hidden door, usually set to 1, can also be set as needed;
[0200] Hidden gate matrix parameters (HIDDEN_MATRIX): used to store the hidden gate matrix parameters obtained after the learning node training is completed, stored in json format;
[0201] Output gate bias element (OUTPUT_BIAS): The output gate bias element is usually set to 0, but can be set as needed;
[0202] Output gate matrix parameters (OUTPUT_MATRIX): used to store the output gate matrix parameters obtained after the learning node training is completed, stored in json format;
[0203] The memory vector of the last sample (LAST_SAMPLE_MEMERY_TENSOR): used to store the memory vector generated by the last sample after the learning node is trained. The evaluation node uses this parameter as the memory vector and the normalized input vector to input into the GRU network for evaluation. This field is stored in json format.
[0204] Model update time (UPDATE_TIME): The learning node uses this field to compare with the most recent update time of the sample data to determine whether retraining is needed; the evaluation node uses this field to compare with the construction time of the GRU network in the evaluation node's memory to determine whether to rebuild the GRU network based on this model.
[0205] In a preferred embodiment, in order to achieve the automatic updating of the waste assessment neural network model, the learning node periodically executes the learning task. Each learning node is configured with a "learning node name" parameter. Each learning node starts a scheduled task, and the timing period is preferably but not limited to one day, two days, three days or one week. Figure 8 ,The process of learning nodes performing learning tasks regularly includes:
[0206] Step 1, obtaining from the database a set of waste assessment neural network models of the waste type to which the learning node is assigned, a sample set update time, and a model parameter update time of the waste assessment neural network model.
[0207] Specifically, refer to Figure 8 As shown, the learning node obtains the waste assessment neural network set A learned and trained by the learning node from the database according to the "learning node name", as well as the network parameter update time of each waste assessment network model in the waste assessment neural network set A and the update time of the corresponding sample set. The waste assessment neural network set A includes waste assessment neural network models corresponding to more than one waste type.
[0208] Step 2, traverse each waste assessment neural network model in the waste assessment neural network model set, if the model parameter update time is before the corresponding sample set update time (indicating that new sample data is generated), then obtain the sample set corresponding to the waste assessment model from the database, obtain new model parameters of the waste assessment neural network model according to one of the above-mentioned waste assessment neural network model training methods, and store the new model parameters of the waste assessment neural network model in the database, and the database records the model parameter update time of the waste assessment neural network model of the waste type; otherwise, wait for the next agreed time to execute the learning task.
[0209] refer to Figure 8 In step 2, when the model parameter update time is before the corresponding sample set update time, the specific execution process is:
[0210] Step 2.1: Construct a neural network based on the waste assessment neural network model;
[0211] Step 2.2: Obtain a set B of sample data (the “transaction time” field of the sample data is arranged in ascending order) from the database according to the “waste type” attribute of the waste assessment neural network model (corresponding to the “waste type” of the waste assessment neural network model table in the data);
[0212] Step 2.3: Use a normalization function to normalize the input vector and output vector of the sample data in the sample data set B to (-1, 1).
[0213] Step 2.4: The neural network is trained with supervised learning using the normalized sample data;
[0214] Step 2.5: Save the model parameters such as the weight matrix parameters of each gate of the GRU generation network obtained through learning and training and the memory vector of the last sample to the database, and update the model parameter update time of the waste evaluation neural network model to the current system time.
[0215] The present invention also discloses a waste material evaluation system. In a preferred embodiment, referring to Fig. 9 , including at least one evaluation node and the above-mentioned distributed training system.
[0216] In this embodiment, the management node is further configured to receive waste information to be evaluated, extract waste types from the waste information to be evaluated, convert the waste information to be evaluated into input vectors to be evaluated using a data dictionary, and send the waste types and the input vectors to be evaluated to any evaluation node.
[0217] An evaluation node that receives the waste type and the input vector to be evaluated, that is, receives the evaluation task, obtains the model parameters of the waste evaluation neural network model corresponding to the waste type from the database, builds the waste evaluation neural network model according to the obtained model parameters, inputs the input vector to be evaluated into the waste evaluation neural network model to obtain a predicted output vector, and returns the predicted output vector to the management node.
[0218] The management node converts the predicted output vector into expected transaction information based on the data dictionary and outputs it.
[0219] In this embodiment, the evaluation node constructs a neural network (only a GRU generation network with the same structure as the learning node) according to the set waste evaluation neural network model and the model parameters obtained by the learning node and saved to the database by the learning node. The constructed neural network corresponds to the type of waste. The evaluation node provides an evaluation interface C (the input parameters of this interface are the type of waste and the input feature vector, and the output parameter is the output feature vector) for the management node to call. When receiving the evaluation task of the management node, the corresponding neural network a is found according to the type of waste, the received input feature vector is normalized and passed to the neural network a for calculation and obtaining the output feature vector, and the output feature vector is denormalized and returned to the management node. The management node converts the normalized predicted output vector into expected transaction information according to the data dictionary and returns it to the external system.
[0220] This evaluation system distributes functions on different nodes, and each node is independent of each other, making the system more stable, scalable and capable. Establishing different neural network models according to the types of waste and conducting separate learning and training can reduce the complexity of the waste evaluation neural network model, avoid overfitting and underfitting of the neural network, and improve the efficiency of learning and training, saving resources.
[0221] The process diagram of the waste assessment system is as follows Fig.10 When the evaluation node is started, all waste evaluation neural network models (including model parameters) are loaded from the database and a waste evaluation neural network is constructed (only a GRU generation network with the same structure as the learning node). The specific process is as follows:
[0222] Step 1: Read the model parameters of all waste assessment neural network models from the database to obtain the waste assessment neural network model set A';
[0223] Step 2: Traverse the elements in the waste assessment neural network model set A' and build a waste assessment neural network (with the current system time as the neural network construction time).
[0224] Each evaluation node starts a scheduled task (executed once a day, every two days, every three days, or every week, etc.) to regularly load the model parameters of the waste evaluation neural network model in the database and build a neural network (the GRU generation network built here is only used to calculate the output vector based on the input vector). The content of this scheduled task is as follows:
[0225] Step 1: Read all waste assessment neural network models from the database to obtain the neural network model set A";
[0226] Step 2: Traverse the elements in the neural network model set A". If the update time of the neural network model is after the construction time of the corresponding neural network currently running on the evaluation node (using the "waste type" field or attribute corresponding) (indicating that the neural network running on the evaluation node is not the latest one), then rebuild the neural network according to the neural network model.
[0227] The management node provides a waste assessment interface to the external system. The input parameters of this interface include:
[0228] Waste type: waste type code, for example, the code for "smelting waste slag" is "SW01", the code for "fly ash" is "SW02", and the code for "slag" is "SW03". This parameter is determined by the "waste code" parameter; this parameter determines which neural network model is used to train the sample data;
[0229] Waste code: The code of the waste (the code comes from the data code table, which is stored in the database of the waste trading platform). The waste code is composed of numbers and the format is "waste production industry-waste sequence code-waste secondary classification code". Among them, the range of "waste production industry" is 1.00-9.99; the coding range of "waste sequence code" is 1-99; the coding range of "waste secondary classification code" is 1-99. For example, "blast furnace slag. In the process of smelting pig iron in a blast furnace, the ash and flux in the iron ore and coke and the impurities that cannot enter the pig iron form a slag floating on the molten iron, which is mainly composed of silicates and chloroaluminates. The main components are calcium oxide, silicon dioxide and aluminum oxide." The code is "3.11-2-1". The "waste code" and "waste type" are a one-to-many relationship, that is, the "waste type" is determined by determining the "waste code". When entering waste information on the waste trading platform, the seller of the waste selects it on the page;
[0230] Country of origin of the waste: Use the three-letter code of the national standard GB / T 2659.3;
[0231] Bond status: bonded / non-bonded;
[0232] Waste type: general waste / hazardous waste / metal waste;
[0233] Waste quality: scraps / waste / defective products / by-products;
[0234] Waste form: liquid / mud / powder / granule / lump / spherical / strip
[0235] Transaction time: the time of the waste transaction. This parameter is filled in by the seller of the waste when the waste information is entered on the waste trading platform;
[0236] Composition and content: composition and content of the waste (only valuable components and content are required), in json format. For example, if a waste contains 0.03% copper, 0.01% cobalt and 3% iron, the value of this parameter is: [{"copper","0.03%"},{"cobalt","0.01%"},{"iron":"3%"}];
[0237] When an external system calls the evaluation interface of the management node, the evaluation process is as follows:
[0238] Step 1: Convert the input parameter (waste information) of the evaluation interface into an input vector. The conversion process is the same as the conversion process of converting the first form of the sample data into the second form of the input vector.
[0239] Step 2: Use the input vector obtained in step 1 as the input parameter to call the evaluation interface C of the evaluation node, and the evaluation node will perform the evaluation. The evaluation process of the evaluation node is as follows:
[0240] Step 2.1: According to the “waste type”, obtain the corresponding neural network a from the set of neural networks constructed by the current evaluation node.
[0241] Step 2.2: Use the normalization function to normalize the received input vector. The normalization function is:
[0242]
[0243] Step 2.3: Pass the normalized input vector to the neural network a to calculate the output vector. The calculation process is the same as the process of "GRU network generating data", where the memory vector It is the "Memory vector of the last sample" field in the neural network model table (the value of this field is saved to the database after the learning node completes the training, and is cached to the memory when the evaluation node builds the neural network).
[0244] Step 2.4: The output vector obtained in step 2.3 is denormalized using the denormalization function. The expression of the denormalization function is:
[0245]
[0246] g(x) is an odd function, x here represents the dimension value in the output vector that needs to be denormalized, and it is monotonically increasing in the real number range. g(x) and f(x) are inverse functions of each other; the value of the output vector obtained in step 2.3 is the activation function after the output gate to, a y (y' i )∈(0,1), so the g(x) function can meet the requirements of inverse normalization.
[0247] Step 2.5: Return the output vector after the inverse normalization process in step 2.4 to the management node.
[0248] Step 3: The management node obtains the output vector returned by the evaluation node.
[0249] Step 4: Convert the output vector obtained in step 3 into expected transaction information: the first dimension value of the output vector is the expected transaction unit price, and the second dimension value of the output vector is the number of entrepreneurs expected to participate in the waste transaction.
[0250] Step 5: Return the expected transaction information obtained in step 4 to the external calling system.
[0251] Management nodes, learning nodes, and evaluation nodes access the same data source. Management nodes and learning nodes have query, update, and add operations on the data in the database, while evaluation nodes only have query operations on the data in the database. Databases such as Oracle and MySQL can be used.
[0252] The learning node does not interact with any other system or node and can be implemented in Python, which involves a large number of floating-point operations. Floating-point operations are completed using the GPU (the CPU can also be used, but with lower efficiency).
[0253] The management node provides an interface for external systems to call, and the evaluation node provides an interface for the management node to call. The management node and the evaluation node can be implemented using the Java language. The interface calls between nodes or systems can use RPC frameworks such as Dubbo, Spring-Cloud, etc.
Claims
1. A method for training a waste assessment neural network model, characterized in that: include: Acquire a sample set, the sample set comprising a plurality of input vectors and an actual output vector corresponding to each input vector, wherein the input vector comprises a waste type, a waste code, a waste form, a unit price expectation, a transaction time, and a component quantity of the waste, and the actual output vector comprises a transaction unit price of the waste and a number of enterprises participating in the waste transaction; Perform iterative training: Input the sample input vectors into the GRU generation network in the order of the sample transaction time in the sample set to generate the predicted output vector for each sample; The discriminator calculates the error rate of each sample using the logarithmic mean loss function, and selects the maximum error rate as the error rate of this iteration; wherein the logarithmic mean loss function is used to obtain the difference between the logarithmic value of the mean of the numerical value of each dimension in the actual output vector of the sample and the predicted output vector and the mean of the logarithmic value of the numerical value; If the error rate of this iteration is less than or equal to the preset error rate threshold, the iteration is stopped, and the GRU generation network obtained in this iteration is used as the waste assessment neural network model. The model parameters of the waste assessment neural network model are saved to the database. If the error rate of this iteration is greater than the preset error rate threshold, the sample with the largest error rate is selected to adjust the weight matrix parameters of the GRU generation network through the gradient descent algorithm to enter the next iteration; Among them, the calculation formula for calculating the sample error rate using the logarithmic mean loss function is: Among them, i represents the dimension index of the actual output vector / predicted output vector, represents the loss function of the actual output vector and the predicted output vector in dimension i, n represents the number of dimensions of the actual output vector and the predicted output vector, n is 2, and the actual output vector / predicted output vector includes two dimensions: the transaction unit price and the number of enterprises participating in the waste transaction; y i Represents the value of dimension i in the actual output vector, Represents the value of dimension i in the predicted output vector.
2. A method for training a waste material assessment neural network model as claimed in claim 1, characterized in that: The sample with the largest error rate is selected to adjust the weight matrix parameters of the GRU generation network through the gradient descent algorithm, including: Input the memory vector generated during the training of the sample p with the maximum error rate and the previous sample p′ of the sample p into the GRU generation network, and obtain the partial derivative function value of the loss function for each dimension of each gated input vector in the GRU generation network. Among them, the gating of the GRU generation network includes output gate, hidden gate, reset gate and update gate; Update the weight coefficient of each dimension of each gate input vector according to the following formula: Among them, w t+1 represents the weight coefficient of each dimension of each gate input vector in the t+1th iteration, w t represents the weight coefficient of each dimension of each gated input vector in the tth iteration, α represents the learning rate (LEARNING_RATE), which is the preset parameter of the GRU generation network; The weight coefficients of all dimensions of the input vectors of the output gate, hidden gate, reset gate, and update gate in the GRU generation network constitute the weight matrix parameters of the GRU generation network.
3. A method for training a waste material assessment neural network model as claimed in claim 2, characterized in that: The activation function of the output gate is: Among them, y′ i The i-th dimension value of the result y′ obtained after the input vector of the output gate is processed by the output gate weight matrix and the output gate bias element. The weight coefficients of all dimensions of the input vector of the output gate constitute the output gate weight matrix; The activation function of the hidden door is: Among them, h′ i The i-th dimension value of the result h′ obtained after the input vector of the hidden gate is processed by the hidden gate weight matrix and the hidden gate bias element. The weight coefficients of all dimensions of the input vector of the hidden gate constitute the hidden gate weight matrix; The activation function of the reset gate is: Among them, r′ i The i-th dimension value of the result r′ obtained after the input vector of the reset gate is processed by the reset gate weight matrix and the reset gate bias element, and the weight coefficients of all dimensions of the input vector of the reset gate constitute the reset gate weight matrix; The activation function of the update gate is: Among them, z′ i It represents the i-th dimension value in the result z′ obtained after the input vector of the update gate is processed by the update gate weight matrix and the update gate bias element. The weight coefficients of all dimensions of the input vector of the update gate constitute the update gate weight matrix.
4. A waste material evaluation neural network model training device, used to implement a waste material evaluation neural network model training method according to any one of claims 1 to 3, characterized in that: include: A sample set acquisition module, used to acquire a sample set, wherein the sample set includes a plurality of input vectors and an actual output vector corresponding to each input vector, wherein the input vector includes the waste type, waste code, waste form, unit price expectation, transaction time and component quantity of the waste, and the actual output vector includes the transaction unit price of the waste and the number of enterprises participating in the waste transaction; Iterative training module, performs iterative training: Input the sample input vectors into the GRU generation network in the order of the sample transaction time in the sample set to generate the predicted output vector for each sample; The discriminator calculates the error rate of each sample using the logarithmic mean loss function, and selects the maximum error rate as the error rate of this iteration; wherein the logarithmic mean loss function is used to obtain the difference between the logarithmic value of the numerical mean of each dimension in the actual output vector and the predicted output vector of the sample and the mean of the logarithmic value of the numerical value; If the error rate of this iteration is less than or equal to the preset error rate threshold, the iteration is stopped, and the GRU generation network obtained in this iteration is used as the waste assessment neural network model. The model parameters of the waste assessment neural network model are saved to the database. If the error rate of this iteration is greater than the preset error rate threshold, the sample with the largest error rate is selected to adjust the weight matrix parameters of the GRU generation network through the gradient descent algorithm to enter the next iteration.
5. A computer program product comprising a computer program / instructions, characterized in that When the computer program / instructions are executed by a processor, the steps of a waste assessment neural network model training method described in any one of claims 1-3 are implemented.
6. An electronic device, characterized in that: The electronic device comprises: at least one processor; and, A memory communicatively connected to the at least one processor; wherein the memory stores a computer program executable by the at least one processor, the computer program being executed by the at least one processor so that the at least one processor can execute a waste assessment neural network model training method as described in any one of claims 1 to 3.
7. A distributed training system, characterized in that: including at least one management node, a database and at least one learning node; The management node receives the waste information and the waste transaction information corresponding to the waste information in real time, converts the waste information and the corresponding waste transaction information into an input feature vector and an output feature vector corresponding to the input feature vector respectively by using a data dictionary, and stores the corresponding input feature vector and output feature vector into a sample in a database, and the database records the update time of the sample set of the waste type to which the sample belongs; the waste information includes the waste type; A database, storing the samples in a sample set of the waste type according to the waste type to which the samples belong, and storing model parameters of the waste assessment neural network model corresponding to the waste types one by one; Each learning node is assigned to learn a waste assessment neural network model for at least one waste type; The learning node performs the learning task: The learning node obtains a sample set of the assigned waste type from a database, obtains new model parameters of the waste assessment neural network model according to a waste assessment neural network model training method according to any one of claims 1 to 3, and stores the new model parameters of the waste assessment neural network model in the database, and the database records the model parameter update time of the waste assessment neural network model of the waste type; Alternatively, the learning node executes the learning task periodically: Obtaining from a database a set of waste assessment neural network models of waste types assigned to learning nodes, a sample set update time, and a model parameter update time of the waste assessment neural network model; Traverse each waste assessment neural network model in the waste assessment neural network model set, if the model parameter update time is before the corresponding sample set update time, obtain the sample set corresponding to the waste assessment model from the database, obtain new model parameters of the waste assessment neural network model according to a waste assessment neural network model training method according to one of claims 1-3, and store the new model parameters of the waste assessment neural network model in the database, the database records the model parameter update time of the waste assessment neural network model of the waste type; otherwise, wait for the next agreed time to execute the learning task.
8. A waste material evaluation system, characterized in that: comprising at least one evaluation node and the distributed training system of claim 7; The management node is further configured to receive waste information to be evaluated, extract waste types from the waste information to be evaluated, convert the waste information to be evaluated into input vectors to be evaluated using a data dictionary, and send the waste types and the input vectors to be evaluated to any evaluation node; The evaluation node receives the waste type and the input vector to be evaluated, obtains the model parameters of the waste evaluation neural network model corresponding to the waste type from the database, builds the waste evaluation neural network model according to the obtained model parameters, inputs the input vector to be evaluated into the waste evaluation neural network model to obtain a predicted output vector, and returns the predicted output vector to the management node; The management node converts the predicted output vector into expected transaction information based on the data dictionary and outputs it.
Citation Information
Patent Citations
Method for predicting residual life interval of mechanical equipment
CN115204362A
Method and system for determining optimized program parameters for a robot program
US20230311309A1