Waste evaluation neural network model training method and waste evaluation system
By using the logarithmic mean loss function and the gradient descent algorithm to adjust the weight matrix parameters in the waste assessment neural network model, the problem of long training time in the existing technology is solved, and faster model convergence and timeliness of prediction information are achieved.
Patent Information
- Application Number
- CN202410716811.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-04
- Publication Date
- 2024-09-27
- Estimated Expiration
- 2044-06-04
AI Technical Summary
The training time of the existing waste assessment neural network model is too long and cannot meet the timeliness requirements of waste prediction. Moreover, the calculation error of the mean square loss function is large, resulting in slow gradient descent and slow convergence.
The logarithmic mean loss function is used to calculate the error rate of the sample, and the weight matrix parameters of the GRU generation network are adjusted through the gradient descent algorithm. Iterative training is performed in the order of sample transaction time, and the sample with the largest error rate is selected for adjustment to speed up the model. convergence.
It improves the convergence speed of the model, shortens the training time, meets the needs of the scrap trading platform for timely updates, and ensures the effectiveness of the prediction information.
Smart Images

Figure CN118709741A
Abstract
Description
Technical Field
[0001] This invention relates to the field of artificial intelligence technology, and in particular to a method for training a neural network model for waste assessment and a waste assessment system. Background Technology
[0002] In the process of processing and production, various waste materials are inevitably generated, such as metal scrap, fly ash, smelting slag, and furnace slag. Buyers and sellers can comprehensively and efficiently trade waste materials through a waste trading platform, realizing waste reuse. On the waste trading platform, after the seller enters waste information, the platform needs to provide timely feedback to the buyer, including predicted information such as the selling price and the number of potential buyers. Obtaining such predicted information manually through the statistical analysis of massive amounts of data would be time-consuming and difficult.
[0003] Currently, deep learning models based on GRU neural networks have replaced manual methods for obtaining waste prediction information. These models use waste information and historical transaction data as training samples for the GRU neural network, enabling it to quickly output relatively good prediction results. Because waste trading platforms continuously complete new transactions daily, historical transaction data is constantly updated, requiring timely training and updates of the GRU neural network to ensure the effectiveness of the predictions. This places a demand on minimizing the training time of the GRU neural network. However, in the iterative training process of existing waste GRU neural networks, the discriminator uses the mean squared loss function to calculate the error rate of the samples. The mean squared loss function can exhibit a pattern where larger errors lead to slower gradient descent and slower convergence, resulting in longer training times. Furthermore, in the iterative training process of existing waste GRU neural networks, each iteration typically randomly selects a training sample and adjusts the weight matrix parameters of the GRU neural network using the gradient descent algorithm. The slow gradient descent results in slow model convergence, hindering the improvement of model training efficiency. Summary of the Invention
[0004] The present invention aims to solve the technical problem that the training time of the existing waste assessment neural network model is too long and cannot meet the timeliness of waste prediction. The present invention 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] To achieve the above-mentioned objectives of the present invention, according to a first aspect of the present invention, the present invention provides a method for training a neural network model for waste assessment, comprising: acquiring a sample set, the sample set including multiple input vectors and an actual output vector corresponding to each input vector, wherein the input vectors include the waste type, waste code, waste form, expected unit price, transaction time, and component quantity of the waste, and the actual output vectors include the transaction unit price of the waste and the number of enterprises participating in the waste transaction; performing iterative training: sequentially inputting the input vectors of the samples into a GRU generator network according to the chronological order of the transaction time of the samples in the sample set, generating a predicted output vector for each sample; and a discriminator using a log-mean loss function. Calculate the error rate for each sample and select the highest error rate as the error rate for this iteration. The log-mean loss function is used to calculate the difference between the logarithmic mean of the mean values of each dimension in the actual output vector and the mean of the logarithmic mean values of the predicted output vector. If the error rate for this iteration is less than or equal to a preset error rate threshold, the iteration stops, and the GRU generator network obtained in this iteration is used as the waste evaluation neural network model. The model parameters of the waste evaluation neural network model are saved to the database. If the error rate for this iteration is greater than the preset error rate threshold, the sample with the highest error rate is selected, and the weight matrix parameters of the GRU generator network are adjusted using the gradient descent algorithm before proceeding to the next iteration.
[0006] To achieve the above-mentioned objectives of the present invention, according to a second aspect of the present invention, the present invention provides a waste assessment neural network model training device for implementing the waste assessment neural network model training method described in the first aspect of the present invention, comprising: a sample set acquisition module for acquiring a sample set, the sample set including multiple input vectors and an actual output vector corresponding to each input vector, wherein the input vectors include the waste code, waste form, expected unit price, transaction time, and component quantity of the waste, and the actual output vectors include the transaction unit price of the waste and the number of enterprises participating in the waste transaction; and an iterative training module for performing iterative training: sequentially inputting the input vectors of the samples into a GRU generator network according to the chronological order of the transaction time of the samples in the sample set, generating each The sample's predicted output vector; the discriminator calculates the error rate for each sample using the log-mean loss function, and selects the largest error rate as the error rate for this iteration; wherein, the log-mean loss function is used to calculate the difference between the logarithm of the mean of the numerical values in each dimension of the actual output vector and the mean of the logarithm of the numerical values in the predicted output vector; if the error rate for this iteration is less than or equal to a preset error rate threshold, the iteration stops, and the GRU generation network obtained in this iteration is used as the waste evaluation neural network model, and the model parameters of the waste evaluation neural network model are saved to the database; if the error rate for this iteration is greater than the preset error rate threshold, the sample with the largest error rate is selected and the weight matrix parameters of the GRU generation network are adjusted through the gradient descent algorithm, and the next iteration begins.
[0007] To achieve the above-mentioned objectives of the present invention, according to a third aspect of the present invention, the present invention provides a computer program product comprising a computer program / instructions that, when executed by a processor, implement the steps of a waste assessment neural network model training method as described in the first aspect of the present invention.
[0008] To achieve the above-mentioned objectives of the present invention, according to a fourth aspect of the present invention, an electronic device is provided, 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, the computer program being executed by the at least one processor to enable the at least one processor to perform a waste assessment neural network model training method as described in the first aspect of the invention.
[0010] The waste assessment neural network model training method, device, computer program product, and electronic device provided in the first to fourth aspects of this invention, during the training process of the waste assessment neural network model, the discriminator calculates the error rate of each sample using the log-mean loss function, selects the largest error rate as the error rate of this iteration, and in each iteration, the sample with the largest error rate is selected to adjust the weight matrix parameters of the GRU generator network through the gradient descent algorithm, instead of randomly selecting samples as in the prior art. This increases the gradient descent speed, accelerates model convergence, and shortens training time. The inventors proposed the log-mean loss function, which obtains the error rate by calculating the difference between the logarithm of the mean of the values of each dimension in the actual output vector and the mean of the logarithm of the values in the predicted output vector. Utilizing the characteristic that the larger the error of the log-mean loss function, the faster the gradient descent, the faster the model convergence speed is accelerated, thereby efficiently completing the training of the waste assessment neural network model, shortening the training time, meeting the needs of waste trading platforms that continuously update waste trading information daily, and requiring timely training and updating of the waste assessment neural network model, thus ensuring the effectiveness of the prediction information.
[0011] To achieve the above-mentioned objectives of the present invention, according to a fifth aspect of the present invention, a distributed training system is provided, 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, 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 as a sample in the database, the database recording the update time of the sample set of the waste type to which the sample belongs; the waste information includes waste types; the database stores samples 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 evaluation neural network model corresponding one-to-one with the waste type; each learning node is assigned to learn at least one waste evaluation neural network model for waste type, the learning node obtains the sample set of the assigned waste type from the database, obtains new model parameters of the waste evaluation neural network model according to the waste evaluation neural network model training method described in the first aspect of the present invention, and stores the new model parameters of the waste evaluation neural network model in the database, the database recording the update time of the model parameters of the waste evaluation neural network model for that waste type.
[0012] To achieve the above-mentioned objectives of the present invention, according to a sixth aspect of the present invention, a waste assessment system is provided, characterized in that it includes at least one assessment node and the distributed training system described in the fifth aspect of the present invention; the management node is further configured to receive waste information to be assessed, extract waste types from the waste information to be assessed, convert the waste information to be assessed into an input vector to be assessed using a data dictionary, and send the waste type and the input vector to be assessed to any assessment node; the assessment node receiving the waste type and the input vector to be assessed obtains the model parameters of the waste assessment neural network model corresponding to the waste type from the database, constructs a waste assessment neural network model according to the obtained model parameters, inputs the input vector to be assessed into the constructed waste assessment 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 in this application distribute functions across different nodes, each independent and unaffected by the others. This enhances the system's stability, scalability, and processing capabilities. Establishing different waste assessment neural network models based on waste type and training them separately reduces the complexity of the neural network models and avoids overfitting and underfitting, while also improving training efficiency and saving resources. The waste assessment neural network models for each waste type are updated regularly, and the sample set is continuously updated, increasing the reference value of waste assessment. Attached Figure Description
[0014] Figure 1 This is a flowchart illustrating the training method for a neural network model for waste assessment in a preferred embodiment of the present invention.
[0015] Figure 2 This is the neural network structure of the waste assessment neural network model in a preferred embodiment of the present invention;
[0016] Figure 3 This is a schematic diagram of the structure of an electronic device in a preferred embodiment of the present invention;
[0017] Figure 4 This is a partial schematic diagram of a data dictionary in a preferred embodiment of the present invention;
[0018] Figure 5 This is another partial schematic diagram of the data dictionary in a preferred embodiment of the present invention;
[0019] Figure 6 This is another partial schematic diagram of a data dictionary in a preferred embodiment of the present invention;
[0020] Figure 7 This is a schematic diagram of a sample in the database according to a preferred embodiment of the present invention;
[0021] Figure 8 This is a flowchart of a distributed training system in a preferred embodiment of the present invention;
[0022] Figure 9 This is a structural block diagram of a waste assessment system according to a preferred embodiment of the present invention;
[0023] Figure 10 This is a flowchart illustrating a waste assessment system in a preferred embodiment of the present invention. Detailed Implementation
[0024] This invention discloses a method for training a neural network model for waste assessment. In a preferred embodiment, such as... Figure 1As shown, the process includes: Step S1, obtaining a sample set, which includes multiple input vectors and the actual output vector corresponding to each input vector. The input vectors include the waste type, waste code, waste form, expected unit price, transaction time, and component quantity of the waste. The actual output vectors include the transaction unit price of the waste and the number of enterprises participating in the waste transaction.
[0025] The sample set is derived from historical data. The input vector originates from waste information in the historical data. This waste information encompasses multiple dimensions; therefore, the input vector also has multiple dimensions, including digital representations of waste type, waste code, waste form, expected unit price, transaction time, and component quantity. To more accurately describe the waste, the input vector preferably includes macroeconomic, microeconomic, and price dimensions. Macroeconomic dimensions include social factors, economic factors, fiscal policy factors, and monetary policy factors. Microeconomic dimensions include waste code, country of origin, country of origin code, economic level, waste quality, waste form, and transaction time. The price dimension includes expected unit price (describing the estimated value of the waste), unit price variance (describing the dispersion of components), and component quantity. The actual output vector originates from the waste transaction information in the historical data, including digital representations of the transaction unit price and the number of companies participating in the waste transaction.
[0026] Step S2, perform supervised learning iterative training: Step S21, input the sample input vectors into the GRU generator network sequentially according to the transaction time of the samples in the sample set to generate the predicted output vector for each sample; Step S22, the discriminator calculates the error rate of each sample using the log-mean loss function, and selects the largest error rate as the error rate for this iteration; wherein, the log-mean loss function is used to calculate the difference between the logarithm of the mean of the values of each dimension in the actual output vector and the mean of the logarithms of the values in the predicted output vector; Step S23, if the error rate of this iteration is less than or equal to the preset error rate threshold, the iteration stops, the iterative training is completed, the GRU generator network obtained in this iteration is used as the waste evaluation neural network model, and the model parameters of the waste evaluation 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 generator network through the gradient descent algorithm, and the next iteration is entered, and step S21 is executed. The preferred, but not limited, model parameters of the waste evaluation neural network model include the weight matrix parameters and the memory vector generated by the last sample.
[0027] In this embodiment, preferably, to improve processing speed, both the input vector and the actual output vector in the sample set are normalized to (-1, 1) before iterative training in step S2 is performed. The normalization function for each dimension of the input vector and the actual output vector is preferably, but not limited to, the following:
[0028]
[0029] Where 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, denoted as the GRU generation network, and refers to... Figure 2 As shown. Suppose that the current input is the t-th sample data to the GRU generator network, The memory vector generated for the (t-1)th sample is the memory information passed down from the previous sample. Let be the input vector for the t-th sample; The memory vector output for the t-th sample is used to pass to the next sample as its memory information; Let t be the output vector of the t-th sample, which is the predicted output vector.
[0031] The symbol represents the vector concatenation operation, which combines two vectors into a single vector. For example:
[0032]
[0033] "⊙" represents the Hadamard product of vectors, which is the product of two vectors of the same dimension, multiplied digit by digit to obtain a new vector. For example:
[0034]
[0035] The "+" symbol indicates the addition of two vectors, that is, adding two vectors of the same dimension side by side to obtain a new vector. For example:
[0036]
[0037]
[0038] The GRU generative network has four gates: reset gate, update gate, hidden gate, and output gate. Each gate receives a vector (the input vector corresponding to that gate) and outputs a vector (the output vector corresponding to that gate). Each gate contains a weight matrix, an activation function, and a bias element. The input vector of the gate is multiplied by the first set of coefficients of the weight matrix (vector dot product), and the bias element is added to obtain a value a'. The activation function is then applied to a' to obtain the value a, which is the value of the first dimension of the gate's output vector. The input vector of the gate is multiplied by the second set of coefficients of the weight matrix (vector dot product), and the bias element is added to obtain a value b'. The activation function is then applied to b' to obtain the value b, which is the value of the second dimension of the gate's output vector; and so on.
[0039] Let the activation function of a certain reset gate be: The bias element has a value of 1, and the weight matrix is:
[0040]
[0041] The input vector to the reset gate is (0.24, 0.13). This vector is multiplied by the first set of coefficients of the weight matrix and then added to the bias element: 0.1*0.24 + 0.3*0.13 + 1 = 1.063. This result is then passed through the activation function. The vector is multiplied by the second set of coefficients of the weight matrix, and then the bias element is added: 0.4*0.24 + 0.2*0.13 + 1 = 1.122. This result is then passed through the activation function. The vector, multiplied by the third set of coefficients in the weight matrix and then added to the bias element, equals 0.1*0.24 + 0.6*0.13 + 1 = 1.102. This result is then processed by the activation function. The reset gate outputs a vector of (0.7433, 0.7543, 0.7506) after processing the input vector (0.24, 0.13).
[0042] Figure 2 In the middle, w r To reset the weight matrix of the gate, w z To update the gate weight matrix, w h Let w be the weight matrix of the hidden gate. y Here is the weight matrix of the output gate; a r Reset the activation function of the gate; a z To update the activation function of the gate, a h The activation function for the hidden door, a y This is the activation function for the output gate.
[0043] In this embodiment, refer to Figure 2The process of generating the predicted output vector based on the input vector of the t-th sample includes:
[0044] (1) The memory vector generated and passed down from the (t-1)th sample The input vector of the t-th sample pass The concatenate operation is used to concatenate the vectors.
[0045] (2) with As the input vector to the reset gate, it passes through the reset gate (w) r Let a be the weight matrix. r The activation function yields the output vector, which is the reset vector.
[0046] (3) with As the input vector to the update gate, it is passed through the update gate (w) z Let a be the weight matrix. z The activation function yields the output vector, i.e., the update vector.
[0047] (4) and Performing the "⊙" (Hadamard product) operation yields a new vector with the same number of dimensions. Then, the resulting new vector is combined with... pass The concatenate operation is used to concatenate the vectors.
[0048] (5) with Given the input vector of the hidden gate, pass through the hidden gate (w) h Let a be the weight matrix. h The activation function yields the output vector, which is the hidden vector.
[0049] (6) Calculate the memory vector of the t-th sample using the following formula:
[0050]
[0051] in, This represents a vector whose values are all 1. A larger value indicates that the memory generated by the (t-1)th sample has a smaller impact on the tth sample, and vice versa; As the memory vector for the (t+1)th sample (the next sample);
[0052] (7) The input vector to the output gate is the output vector, which is then passed through the output gate (w). y Let a be the weight matrix.y (The activation function) yields the output vector. This refers to the output vector generated by the GRU generative network, which is also the predicted vector; the memory vector received from the first sample data during training. Retrieved from the database.
[0053] In the GRU generative network, vectors The number of dimensions is the same, and this number of dimensions is defined as the number of memories in the GRU generator network; vector The dimension number is the sum of the number of memories in the GRU generator network and the number of input vectors. The sum of the number of dimensions.
[0054] In this embodiment, in step S23, the weight matrix parameters of the GRU generator network are adjusted, that is, the four weight matrices (w, w) of the GRU generator network are adjusted. r w z w h w y The parameters are as follows. At the start 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 starting with the earliest transaction sample, following the chronological order of the transaction time dimension. One complete execution of steps S21 to S23 is recorded as one iteration.
[0055] To facilitate subsequent calculations, during step S21, the memory vector generated from the input vector of each sample is... Each sample data point is individually mapped to a specific sample data point and stored in memory for subsequent gradient calculations.
[0056] In this embodiment, the input vectors of all samples are used to generate predicted output vectors through a GRU generator network. The discriminator of the GAN network calculates multiple error rates e based on the actual output vectors of each sample and the generated predicted output vectors. Let the variable v = max{e} i' -e'}, where e' represents the preset error rate threshold, e i' Let v be the error rate calculated by the discriminator between the predicted output vector and the actual output vector of the i'th sample, and let v be the maximum value of the error rates of k (samples) minus e'. If v ≤ 0, the GRU generator network is considered to have reached the ideal state, and the iterative training is completed. If v > 0, the following operation is performed: select the sample data p corresponding to the v value (maximum error rate) as the sample data to adjust the parameters of each weight matrix of the GRU generator 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 iterative training described above. The bias elements of the reset gate, update gate, and hidden gate are 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 embodiment, to facilitate the introduction of nonlinear variation factors in each gate, the reset gate, update gate, and output gate use the inverse cotangent function as the activation function, while the hidden gate uses the hyperbolic tangent function as the activation function. Specifically:
[0059] The activation function for the output gate is:
[0060]
[0061] The derivative of the activation function of the output gate is:
[0062]
[0063] Among them, y' i The i-th dimension value of the result y' obtained after processing the input vector of the output gate through the output gate weight matrix and the output gate bias element is represented by the weight coefficients of all dimensions of the input vector of the output gate.
[0064] The activation function for the hidden door is:
[0065]
[0066] The derivative of the activation function for the hidden door is:
[0067]
[0068] Among them, h' i The value of the i-th dimension of the result h' obtained after processing the input vector of the hidden gate through the hidden gate weight matrix and the hidden gate bias elements is represented by the weight coefficients of all dimensions of the input vector of the hidden gate.
[0069] The activation function for resetting the door is:
[0070]
[0071] The derivative of the activation function for the reset gate is:
[0072]
[0073] Where, r' iThe value of r' represents the i-th dimension of the result obtained after processing the input vector of the reset gate through the reset gate weight matrix and the reset gate bias element. The weight coefficients of all dimensions of the input vector of the reset gate constitute the reset gate weight matrix.
[0074] The activation function for the updated gate is:
[0075]
[0076] The derivative of the activation function of the update gate is:
[0077]
[0078] Among them, z' i The value of the i-th dimension in the result z' obtained after processing the input vector of the update gate through the update gate weight matrix and the update gate bias element is represented by the weight coefficients of all dimensions of the input vector of the update gate, which together form the update gate weight matrix.
[0079] In a preferred embodiment, the formula for calculating the sample error rate using the log-mean loss function is as follows:
[0080]
[0081] Where 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; Let i represent the loss function between 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 two dimensions: the transaction price and the number of companies participating in the waste transaction; y i This represents the value of dimension i in the actual output vector. This represents the value of dimension i in the predicted output vector.
[0082] In this implementation, the values of each dimension of the actual output vector and the predicted output vector are used with a loss function. The value obtained by calculating the loss and summing it is called the "error rate". During training, an error rate is obtained for each sample data. The error between the predicted output vector generated from the input vector of the sample and the actual output vector of the sample determines whether the GRU generative network needs to continue learning and training to adjust the weight matrix parameters. When y i and The closer, that is, y i and The smaller the error, The smaller the value, the more... hour,
[0083] In this embodiment, preferably, the loss function right The partial derivatives are:
[0084]
[0085] In this embodiment, the log-mean loss function is used to calculate the error between the predicted output vector and the actual output vector of the sample. Taking advantage of the characteristic that the larger the error of the log-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 highest error rate is selected, and the weight matrix parameters of the GRU generator network are adjusted using a gradient descent algorithm, including:
[0087] Step 1: Combine the memory vector generated during training from the sample p with the highest error rate and the previous sample p' of sample p. Input the GRU generator network and record the intermediate parameters generated by the GRU generator network for calculating the gradient to obtain the loss function. The partial derivative values of each dimension of the gated input vector in the GRU generative network Let be the gradient function, where the gating of the GRU generator network includes the output gate, the hidden gate, the reset gate, and the update gate.
[0088] Step 2: Update the weight coefficients of each dimension of each gated input vector according to the following formula:
[0089]
[0090] Among them, w t+1 w represents the weight coefficient of each dimension of each gated input vector in the (t+1)th iteration. t α represents the weight coefficient of each dimension of each gated input vector in the t-th iteration, and α represents the learning rate (LEARNING_RATE), which is a preset parameter for the GRU generative network.
[0091] Step 3: The weight coefficients of all dimensions of the input vectors for the output gate, hidden gate, reset gate, and update gate in the GRU generator network are used to form the weight matrix parameters of the GRU generator network. Specifically, the weight coefficients of all dimensions of the input vectors for the output gate form the output gate weight matrix parameters of the GRU generator network; the weight coefficients of all dimensions of the input vectors for the hidden gate form the hidden gate weight matrix parameters; the weight coefficients of all dimensions of the input vectors for the reset gate form the reset gate weight matrix parameters; and the weight coefficients of all dimensions of the input vectors for the update gate form the update gate weight matrix parameters.
[0092] In this implementation, when updating the weight coefficients of the j-th dimension of the output gate input vector, the loss function... The value of the partial derivative function with respect to the j-th dimension of the input vector of the output gate The calculation formula is:
[0093]
[0094] in, Here is the loss function; y i The value of the i-th dimension of the actual output vector of sample data p; m is the value of the i-th dimension of the predicted output vector (also the output vector of the output gate) obtained by the GRU generator network; j To generate the j-th dimension (i.e., m) of the input vector to the output gate in the GRU network. j The input vector of the output gate (value of the j-th dimension), let m j The weighting coefficient of the output gate is w t ; For loss function pairs The partial derivative values; a' y (y' i y' is the derivative of the activation function of the output gate. i The value obtained by multiplying the input vector of the output gate by the i-th set of coefficients of the weight matrix of the output gate (vector dot product) and adding the bias element; w yij This represents the current value in the i-th row and j-th column of the weight matrix of the output gate.
[0095] When updating the weight coefficients of the j-th dimension of the hidden gate input vector, the loss function... The value of the partial derivative function with respect to the j-th dimension of the hidden gate input vector The calculation formula is:
[0096]
[0097] in, The loss function; g j Generate the j-th dimension value (i.e., g) of the input vector of the hidden gate in the GRU network. j The input vector for the hidden door Let g be the value of the j-th dimension. j The weight coefficient of the hidden door is w t ; For loss function pairs The partial derivative values; a' y (y' i y' is the derivative of the activation function of the output gate. iThe value is obtained by multiplying the input vector of the output gate by the coefficients of the i-th group of the weight matrix of the output gate (vector dot product) and adding the bias element; n is the number of memory cells in the GRU generator network (the dimension of the memory vector); w yik z represents the value in the i-th row and k-th column of the weight matrix of the output gate; k To update the value of the k-th dimension of the vector; a' h (h' k h' is the derivative of the hidden gate activation function. k The value is obtained by multiplying the input vector of the hidden gate by the k-th group of coefficients of the weight matrix of the hidden gate (vector dot product) and adding the bias element; w hkj Let be the value in the k-th row and j-th column of the weight matrix of the hidden gate.
[0098] When updating the weight coefficients of the j-th dimension of the reset gate input vector, the loss function... The value of the partial derivative function with respect to the j-th dimension of the reset gate input vector The calculation formula is:
[0099]
[0100] in, f is the loss function; j To generate the value of the j-th dimension of the input vector of the reset gate in the GRU network (i.e., f). j To reset the input vector of the gate Let f be the value of the j-th dimension. j The weighting coefficient for the reset door is w. t ; For loss function pairs The partial derivative values; a' y (y' i y' is the derivative of the activation function of the output gate. i The value obtained by multiplying the input vector of the output gate by the i-th set of coefficients of the weight matrix of the output gate (vector dot product) and adding the bias element; a' r (r' k h' is the derivative of the hidden gate activation function. k The value is obtained by multiplying the input vector of the hidden gate by the coefficients of the k-th group of the weight matrix of the hidden gate (vector dot product) and adding the bias element; n is the number of memory cells in the GRU generator network (the dimension of the memory vector); m (t-1)k The memory vector of the previous sample p' The value of the k-th dimension; a' r (r' k ) is the derivative of the reset gate, r' k The value obtained by multiplying the input vector of the reset gate by the k-th group of coefficients of the reset gate's weight matrix (vector dot product) and adding the bias element; w rkjTo reset the value of the gate weight matrix in row k and column j; z k To update vector The value of the k-th dimension; c is the dimension of the input vector (sample input vector) of the GRU generator network, and n+c is the dimension of the input vector of the hidden gate; w hik Let be the value in the i-th row and k-th column of the weight matrix of the hidden gate.
[0101] When updating the weight coefficients of the j-th dimension of the gate input vector, the loss function... The value of the partial derivative function with respect to the j-th dimension of the update gate input vector The calculation formula is:
[0102]
[0103] in, f is the loss function; j To generate the value of the j-th dimension of the input vector of the update gate in the GRU network (i.e., f) j To update the input vector of the gate Let f be the value of the j-th dimension. j The weight coefficient of the updated gate is w t ; For loss function pairs The partial derivative values; a' y (y' i y' is the derivative of the activation function of the output gate. i The value is obtained by multiplying the input vector of the output gate by the coefficients of the i-th group of the weight matrix of the output gate (vector dot product) and adding the bias element; n is the number of memory cells in the GRU generator network (the dimension of the memory vector); w yik h represents the value in the i-th row and k-th column of the weight matrix of the output gate; k Hidden vector The value of the k-th dimension; m (t-1)k The memory vector of the previous sample p' The value of the k-th dimension; a' z (z' k Update the derivative of the activation function of the gate, z' k The value obtained by multiplying the input vector of the update gate by the k-th group of coefficients of the weight matrix of the update gate (vector dot product) and adding the bias element; w zkj To update the value of the weight matrix of the gate in row k and column j.
[0104] This invention also discloses a waste assessment neural network model training device for implementing the aforementioned waste assessment neural network model training method. In a preferred embodiment, it includes: a sample set acquisition module for acquiring a sample set, wherein the sample set includes multiple input vectors and an actual output vector corresponding to each input vector, wherein the input vectors include the waste code, waste form, expected unit price, transaction time, and component quantity of the waste, and the actual output vectors include the transaction unit price of the waste and the number of enterprises participating in the waste transaction; an iterative training module for performing iterative training: sequentially inputting the input vectors of the samples into a GRU generator network according to the order of the transaction time of the samples in the sample set to generate a predicted output vector for each sample; and a discrimination module. The algorithm calculates the error rate for each sample using the log-mean loss function and selects the highest error rate as the error rate for this iteration. The log-mean loss function is used to calculate the difference between the logarithmic mean of the numerical mean and the mean of the logarithmic mean of the numerical mean in each dimension of the actual output vector and the predicted output vector. If the error rate for this iteration is less than or equal to a preset error rate threshold, the iteration stops, and the GRU generator network obtained in this iteration is used as the waste evaluation neural network model. The model parameters of the waste evaluation neural network model are saved to the database. If the error rate for this iteration is greater than the preset error rate threshold, the sample with the highest error rate is selected, and the weight matrix parameters of the GRU generator network are adjusted using the gradient descent algorithm before proceeding to the next iteration.
[0105] In this embodiment, the sample set acquisition module and the iterative training module correspond one-to-one with steps S1 and S2 of the above-described waste assessment neural network model training method, and will not be described again 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-described 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 of which 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, the computer program being executed by the at least one processor to enable the at least one processor to execute a waste assessment neural network model training method provided by the present invention.
[0108] like Figure 3The diagram shown is a schematic representation of an electronic device for a waste assessment neural network model training method according to 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. It may also include a computer program, such as a waste assessment neural network model training method program, stored in the memory 11 and executable on the processor 10.
[0109] This 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 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 corresponding waste transaction information in real time. Using a data dictionary, it converts the waste information and corresponding waste transaction information into input feature vectors and corresponding output feature vectors, respectively. The corresponding input and output feature vectors are combined to form a sample and stored in the database. The database records the update time of the sample set for each waste type to which the sample belongs; the waste information includes waste types. The database stores samples according to their waste type within the sample set of that waste type, and stores model parameters of a waste evaluation neural network model corresponding one-to-one with each waste type. The database also stores hyperparameters of the GRU generator network, including the maximum error rate, learning rate, bias elements of each gate, and initial memory vectors used for training the learning nodes. Each learning node is assigned to learn a waste assessment neural network model for at least one type of waste. The learning node obtains a sample set of the assigned waste type from the 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. The database records the update time of the model parameters of the waste assessment neural network model for that type of waste.
[0110] In this embodiment, the management node provides an interface for receiving sample data for external systems to call, used to receive sample data (waste information and corresponding waste transaction information) pushed by external systems in real time. The external system is preferably, but not limited to, a waste trading platform or a web information collection component. The format of the sample data received by the management node from the external system is defined as the first format; the management node converts the sample data of the first format into corresponding feature vectors, defining the format of the sample data converted from the first format to the corresponding feature vectors as the second format; the sample data of the second format is saved to the database, defining the format of the sample data saved to the database as the third format of the sample data. The different formats of the sample data are described below:
[0111] (1) The input parameters (sample data in the first form) of the sample data receiving interface include:
[0112] Waste ID: A unique identifier for waste materials;
[0113] Waste type: Waste type code, for example: "Smelting slag" is coded as "SW01", "fly ash" is coded as "SW02", and "furnace slag" is coded as "SW03"; this parameter is determined by the "waste code" parameter; this parameter determines which neural network model and learning node is used to train the sample data;
[0114] Scrap Code: The scrap code (derived from a data coding table stored in the scrap trading platform's database) consists of numbers and follows the format "Scrap Generating Industry - Scrap Sequence Code - Scrap Secondary Classification Code". The "Scrap Generating Industry" ranges from 1.00 to 9.99; the "Scrap Sequence Code" ranges from 1 to 99; and the "Scrap Secondary Classification Code" ranges from 1 to 99. For example, "Blast furnace slag. In the process of blast furnace pig iron smelting, ash from iron ore and coke, flux, and impurities that cannot enter the pig iron form slag mainly composed of silicates and aluminochlorides floating on the molten iron, with the main components being calcium oxide, silicon dioxide, and aluminum oxide" is coded as "3.11-2-1". The "Scrap Code" and "Scrap Type" have a one-to-many relationship; that is, determining the "Scrap Code" determines the "Scrap Type". When entering scrap information on the scrap trading platform, the scrap seller selects or enters the information on the page.
[0115] Country of origin of waste: Use the 3-letter code of national standard GB / T 2659.3;
[0116] Bonded status: Bonded / Non-bonded;
[0117] Waste types: general waste / hazardous waste / metal waste;
[0118] Waste quality: scraps / waste / defective products / by-products;
[0119] Waste form: liquid / sludge / powder / granules / lumps / balls / strips
[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 into the waste trading platform.
[0121] Composition and content: The composition and content of the waste (only the valuable components and their 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 unit price: The transaction unit price for waste materials is converted to "RMB (fen) / kg";
[0123] Number of companies participating in the waste transaction: The number of companies 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 of the second form to the database and transform it into sample data of the third form) contains the following fields (field codes are in parentheses):
[0125] Sample ID (SAMPLE_ID): A unique identifier for a sample;
[0126] Waste type (CATALOG): The type of waste in the sample. This field is used to distinguish samples during training of learning nodes. Neural network models with different waste types use sample data of different waste types.
[0127] Input vector (INPUT_TENSOR): The input vector of the sample data, stored in JSON format;
[0128] Output vector (OUTPUT_TENSOR): The output vector of the sample CNC, stored in JSON format;
[0129] TRADE_TIME: The "trading time" parameter for the sample data in 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 Second and Third Forms
[0132]
[0133] In this embodiment, the process of the management node transforming the feature vector of the sample data, that is, transforming 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) Macro dimensions are used to describe the overall environment (social environment, economic environment, etc.), and include 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 based on the transaction time of waste materials. The macro dimension table contains the following fields (field codes are in parentheses):
[0136] Creation time (CREATE_TIME): The time the record was created;
[0137] Social Factors: The value of the social factors dimension, a floating-point number, accurate to 3 decimal places;
[0138] Economic Factors: Values for the Economic Factors dimension, floating-point numbers, accurate to 3 decimal places;
[0139] Fiscal Policy Factors (FINANCE): Values for the fiscal policy factors dimension, floating-point numbers, accurate to 3 decimal places;
[0140] Monetary Policy Factors (CURRENCY): Values for the monetary policy factors dimension, floating-point numbers, accurate to 3 decimal places.
[0141] Retrieve the latest record from the "Macro Dimension Table" whose "Creation Time (CREATE_TIME)" is less than or equal to 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 dimension of the input vector of the sample data.
[0142] 2) The microscopic dimension is used to describe the specific situation of the waste:
[0143] Waste code: The value of the "waste code" parameter corresponding to the sample data of the first form is converted into three dimensions according to the coding format: the industry that generated the waste, the sequence code of the waste, and the secondary classification code of the waste.
[0144] Country of origin for waste: This corresponds to the value of the "Country of origin for waste" parameter in the first type of sample data. Based on this value, dimension values are retrieved from the database's data dictionary (country of origin dimension table), including three dimensions: economic level, industrial level, and natural resources. The data dictionary (country of origin dimension table) contains the following fields (field codes are in parentheses):
[0145] Country of origin code (NATION_CODE): using the 3-letter code of national standard GB / T 2659.3;
[0146] Economic Level (ECONOMY_LEVEL): Used to describe the economic level of the country from which the waste originates. It is a 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 (NATURAL_RESOURCES): A floating-point number describing the natural resources of the country of origin, accurate to 3 decimal places;
[0149] Creation time (CREATE_TIME): The time when the record was created.
[0150] Based on the values of the "country of origin of waste" and "transaction time" parameters of the sample data in the first form, obtain the latest record for the corresponding country of origin of waste 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 economic level, industrial level, and resource status of this record are the dimension values corresponding to "country of origin of waste" in the input vector of the sample data.
[0151] Bonded status: The "bonded status" parameter for the sample data in the first form is converted to a dimension value of "1.1" for "bonded" and "non-bonded" for "1.5".
[0152] Waste type: For the "Waste type" parameter corresponding to the first type of sample data, "Ordinary waste" is converted to a dimension value of "1.1", "Hazardous waste" is converted to a dimension value of "1.2", and "Metal waste" is converted to a dimension value of "1.5".
[0153] Waste quality: The "waste quality" parameter corresponding to the sample data of the first form is converted to the latitude value "1.1" for "scrap", "waste" to the latitude value "1.2" for "defective products" to the latitude value "1.5" for "by-products" to the latitude value "1.7".
[0154] Waste morphology: For the sample data corresponding to the first morphology, the "waste morphology" parameter is converted to dimension value "1.1", "mud-like" to dimension value "1.2", "powder" to dimension value "1.3", "granules" to dimension value "1.4", "blocks" to dimension value "1.5", "spheres" to dimension value "1.6", and "strips" to dimension value "1.7".
[0155] Transaction Time: Based on the “Transaction Time” parameter of the sample data corresponding to the first form, obtain the quarter of the year corresponding to the “Transaction Time”. If it is the first quarter, the value of this dimension is “2.1”; if it is the second quarter, the value of this dimension is “2.2”; if it is the third quarter, the value of this dimension is “2.3”; if it is the fourth quarter, the value of this dimension is “2.4”.
[0156] 3) The price dimension is used to describe the value of the components and content of waste, and includes three dimensions: expected unit price (used to describe the estimated value of waste), variance of unit price (used to describe the dispersion of components), and number of components (used to describe the complexity of components).
[0157] The data dictionary (ingredient unit price table) contains the following fields:
[0158] Composition Name: The name of the component, such as copper, cobalt, aluminum oxide, etc.
[0159] Composition Price (COMPOSITION_PRICE): The unit price of the component, expressed in RMB (cents) per kilogram;
[0160] Creation time (CREATE_TIME): The time when the record was created.
[0161] Based on the "composition and content" and "transaction time" parameters of the sample data corresponding to the first form, the latest (latest record of the value of the "transaction time" parameter less than or equal to that of the sample data of the first form) 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 material is: [{"Praseodymium Neodymium 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) is... Figure 4 As shown.
[0163] The unit price of the obtained "praseodymium-neodymium oxide" is "38089", which is 38089 cents / kg; the unit price of the obtained "scandium" is "40130", which is 40130 cents / kg.
[0164] Based on the 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 expected unit price dimension is 19.4527.
[0165] Calculate the variance of the unit price of waste materials. That is, the value of the unit price variance dimension is 97.4931;
[0166] This waste contains two valuable components (praseodymium oxide and neodymium, scandium), meaning the component quantity dimension has a value of 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 number of dimensions of the input vector is: macro dimension (4) + micro dimension (11) + price dimension (3) = 18; the number of dimensions of the output vector is 2.
[0169] Data in the database dictionary tables (macro-dimensional table, country of origin table, and component unit price table) can be pre-imported or managed through a management page; data in the component unit price table can also be periodically retrieved from relevant websites via an API.
[0170] For example, a sample data point of the first type pushed by the waste trading platform to the management node is shown in Table 2 below:
[0171] Table 2. Sample data examples for the first morphology.
[0172]
[0173]
[0174] Data reference in the data dictionary (macro-dimensional table) Figure 5 As shown. The values obtained from the "transaction time" are: 8.2, 7.8, 8, 8.8; the values of the waste code (3.21-10-1) are: 3.21, 10, 1.
[0175] Data from the data dictionary (country of origin table) such as Figure 6 As shown:
[0176] The values for the "Country of Origin of Waste" dimension obtained based on "Transaction Time" are: 9, 8.7, 9.5;
[0177] Bonded status: "Non-bonded" is changed to a dimension value of 1.5;
[0178] Scrap type: "Metal scrap" Metal scrap is converted to a dimension value of 1.5;
[0179] Waste quality: "Waste" is converted to a latitude value of 1.2;
[0180] Waste form: "blocky" changed to a dimension value of 1.5;
[0181] Transaction time: "2024-02-11 16:14:12" corresponds to the first quarter, and is converted to dimension value 2.1;
[0182] Ingredients and content: Based on the above example, the converted dimension values are: 19.4527, 97.4931, 2;
[0183] Therefore, the input vector of the second-form sample data obtained after transformation 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 sample data is then saved to a database as follows: Figure 7 As shown.
[0184] In this implementation, the learning node is responsible for training the sample data (third-form sample data) transformed by the management node according to the set waste assessment neural network model, and saving the model parameters obtained from the training to the database. Different waste types can be set with different waste assessment neural network models (the models are stored in the database). Multiple waste assessment neural network models are trained by multiple learning nodes. Each learning node is configured with a "learning node name" attribute. The waste assessment neural network model stored in the database has a "learning node name" field, which is used to identify the learning node with the corresponding name. One waste type is trained by one learning node, and one learning node is responsible for training multiple waste types. Different waste assessment neural network models obtain different model parameters after training.
[0185] In this embodiment, supervised learning training is performed using GRU (Gated Recurrent Neural Network) + GAN (Generative Adversarial Network). The GRU network, denoted as the GRU generator, acts as the generator for the GAN, generating predicted output vector data. A loss function is used as the discriminator for the GAN, comparing the predicted output vector generated by the GRU generator with the actual output vector (judging the error). Based on the comparison result, a gradient descent algorithm is used to adjust the weight matrix parameters of each gate in the GRU generator.
[0186] In this embodiment, the waste assessment neural network model is stored in a database (which needs to be pre-set and saved to the database). Preferably, the neural network model table stored in the database contains the following fields (field codes are in parentheses):
[0187] Scrap Type (CATALOG): Used to identify the types of scrap used in training and evaluation of this model;
[0188] Trainer: The name of the learning node used to identify which learning node is used to train this model;
[0189] Number of memory units (MEMERY_SIZE): The number of dimensions of the reset vector, update vector, hidden vector, and memory vector in a GRU neural network, usually twice the number of dimensions of the input vector;
[0190] Input vector dimension (INPUT_SIZE): The dimension of the input vector of the GRU neural network, which 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, which is consistent with the dimension of the output vector of the sample data;
[0192] Initial memory vector (MEMERY_TENSOR0): The memory vector input when training the GRU network with the first sample data. The number of dimensions of this parameter (vector) is the same as the number of memory cells. Usually, all dimensions of this parameter are set to 0, but it can also be set as needed. It is stored in JSON format.
[0193] Learning rate (LEARNING_RATE): The recursive formula for adjusting the weight coefficients of each dimension of the gating input vector at each learning node uses this parameter, which is usually set to 0.01;
[0194] Maximum error rate (MAX_ERROR): The preset error rate threshold for the neural network model, usually set to 0.01;
[0195] Reset door bias element (RESET_BIAS): Resets the door bias element, usually set to 1, but can also be set as needed;
[0196] The matrix parameter of the reset gate (RESET_MATRIX): is used to store the matrix parameter of the reset gate obtained after the learning node has been trained, and is stored in JSON format;
[0197] Update the door's bias element (UPDATE_BIAS): Updates the door's bias element, usually set to 1, but can also be set as needed;
[0198] Update gate matrix parameters (UPDATE_MATRIX): Used to store the update gate matrix parameters obtained after the learning nodes have been trained, stored in JSON format;
[0199] Hidden door bias element (HIDDEN_BIAS): The bias element of the hidden door, usually set to 1, but 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 nodes have been trained, stored in JSON format;
[0201] Output gate bias element (OUTPUT_BIAS): The bias element of the output gate, usually set to 0, but can also be set as needed;
[0202] Output gate matrix parameters (OUTPUT_MATRIX): Used to store the output gate matrix parameters obtained after the learning nodes have been trained, stored in JSON format;
[0203] The memory vector of the last sample (LAST_SAMPLE_MEMERY_TENSOR): This is used to store the memory vector generated by the last sample after the learning node has been trained. The evaluation node uses this parameter as the memory vector and inputs it together with the normalized input vector 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 time when the evaluation node built the GRU network in memory to determine whether to rebuild the GRU network based on this model.
[0205] In a preferred embodiment, to achieve automatic timed updates to the waste assessment neural network model, learning nodes periodically execute learning tasks. Each learning node is configured with a "learning node name" parameter. Each learning node initiates a timed task, with a preferred, but not limited to, period of one day, two days, three days, or one week. (See reference...) Figure 8 The process of regularly executing learning tasks at learning nodes includes:
[0206] Step 1: Obtain from the database the waste assessment neural network model set, sample set update time, and model parameter update time of the waste assessment neural network model for the waste types assigned to the learning nodes.
[0207] Specifically, refer to Figure 8 As shown, the learning node obtains the waste assessment neural network set A trained by this learning node from the database according to the "learning node name", as well as the network parameter update time and the corresponding sample set update time of each waste assessment neural network model in the waste assessment neural network set A. The waste assessment neural network set A includes waste assessment neural network models corresponding to more than one type of waste.
[0208] Step 2: Iterate through 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 has been generated), retrieve the sample set corresponding to the waste assessment model from the database, obtain the new model parameters of the waste assessment neural network model according to the above-mentioned waste assessment neural network model training method, 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 for this type of waste. 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 as follows:
[0210] Step 2.1: Construct a neural network based on the waste assessment neural network model;
[0211] Step 2.2: Obtain sample data set B (sample data sorted in ascending order by the "Transaction Time" field) from the database based on the "Waste Type" attribute of the waste assessment neural network model (corresponding to the "Waste Type" in the waste assessment neural network model table in the data);
[0212] Step 2.3: Normalize the input and output vectors of the sample data in sample dataset B to (-1, 1) using a normalization function.
[0213] Step 2.4: The neural network is trained using the normalized sample data through supervised learning.
[0214] Step 2.5: Save the weight matrix parameters of each gate and the memory vector of the last sample of the GRU generator network obtained from the training 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 assessment system, in a preferred embodiment, referring to Figure 9 It includes at least one evaluation node and the aforementioned distributed training system.
[0216] In this embodiment, 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 an input vector to be evaluated using a data dictionary, and send the waste types and the input vector to be evaluated to any evaluation node.
[0217] The evaluation node receives the waste type and the input vector to be evaluated, i.e., it receives the evaluation task. It retrieves the model parameters of the waste evaluation neural network model corresponding to the waste type from the database, constructs the waste evaluation neural network model based on the retrieved model parameters, inputs the input vector to be evaluated into the waste evaluation neural network model to obtain the 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 then outputs it.
[0219] In this embodiment, the evaluation node constructs a neural network (a GRU-generated network with the same structure as the learning node) based on a pre-defined waste evaluation neural network model and model parameters saved in the database by the learning node. The constructed neural network corresponds one-to-one with each type of waste. The evaluation node provides an evaluation interface C (the input parameters of this interface are the waste type and the input feature vector, and the output parameter is the output feature vector) for the management node to call. When receiving an evaluation task from the management node, the node finds the corresponding neural network a based on the waste type, normalizes the received input feature vector, passes it to neural network a for calculation to obtain the output feature vector, performs inverse normalization on the output feature vector, and returns it to the management node. The management node converts the normalized predicted output vector into expected transaction information based on the data dictionary and returns it to the external system.
[0220] This evaluation system distributes its functions across different nodes, each independent and unaffected by the others, resulting in enhanced stability, scalability, and processing power. Establishing different neural network models based on waste type and training them separately reduces the complexity of the waste evaluation neural network model, avoids overfitting and underfitting, improves training efficiency, and saves resources.
[0221] A flowchart of the waste assessment system is shown below. Figure 10 As shown. When the evaluation node starts, it loads all waste evaluation neural network models (including model parameters) from the database and constructs the waste evaluation neural network (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 construct the waste assessment neural network (using the current system time as the construction time of the neural network).
[0224] Each evaluation node initiates a scheduled task (executed daily, every two days, every three days, or weekly, etc.) to periodically load the model parameters of the waste evaluation neural network model from the database and construct the neural network (the GRU generator network constructed 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 evaluation neural network models from the database to obtain the neural network model set A”;
[0226] Step 2: Iterate through 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), it means that the neural network running on the evaluation node is not the latest. Then rebuild the neural network according to the neural network model.
[0227] The management node provides a waste assessment interface to external systems. The input parameters of this interface include:
[0228] Waste type: Waste type code, for example: "Smelting slag" is coded as "SW01", "fly ash" is coded as "SW02", and "furnace slag" is coded as "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] Scrap Code: The scrap code (derived from a data coding table stored in the scrap trading platform's database) consists of numbers and follows the format "Scrap Generating Industry - Scrap Sequence Code - Scrap Secondary Classification Code". The "Scrap Generating Industry" ranges from 1.00 to 9.99; the "Scrap Sequence Code" ranges from 1 to 99; and the "Scrap Secondary Classification Code" ranges from 1 to 99. For example, "Blast Furnace Slag. In the process of blast furnace pig iron smelting, ash from iron ore and coke, flux, and impurities that cannot enter the pig iron form slag mainly composed of silicates and aluminochlorides floating on the molten iron, with the main components being calcium oxide, silicon dioxide, and aluminum oxide" is coded as "3.11-2-1". The "Scrap Code" and "Scrap Type" have a one-to-many relationship; that is, determining the "Scrap Code" determines the "Scrap Type," which is selected by the scrap seller on the page when entering scrap information on the scrap trading platform.
[0230] Country of origin of waste: Use the 3-letter code of national standard GB / T 2659.3;
[0231] Bonded status: Bonded / Non-bonded;
[0232] Waste types: general waste / hazardous waste / metal waste;
[0233] Waste quality: scraps / waste / defective products / by-products;
[0234] Waste form: liquid / sludge / powder / granules / lumps / balls / strips
[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 into the waste trading platform.
[0236] Composition and content: The composition and content of the waste (only the valuable components and their 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 management node's evaluation interface, the evaluation process is as follows:
[0238] Step 1: Convert the input parameters (waste information) of the evaluation interface into an input vector. The conversion process is the same as the conversion process of the first form of the sample data into the second form of the input vector.
[0239] Step 2: Using the input vector obtained in Step 1 as input parameters, call the evaluation interface C of the evaluation node. The evaluation node performs the evaluation, and the evaluation process is as follows:
[0240] Step 2.1: Obtain the corresponding neural network a from the set of neural networks already built at the current evaluation node according to the "waste type".
[0241] Step 2.2: Normalize the received input vector using a normalization function, which 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 "GRU network generates data" process, where the memory vector... This 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 has finished learning and training, and is cached in memory when the evaluation node builds the neural network).
[0244] Step 2.4: Perform inverse normalization on the output vector obtained in Step 2.3 using the inverse normalization function. The expression for the inverse normalization function is:
[0245]
[0246] g(x) is an odd function, where x represents the dimension of the output vector that needs to be inversely normalized, and it is monotonically increasing in the real number range. g(x) and f(x) are inverse functions of each other. The output vector value obtained in step 2.3 is the activation function after passing through the output gate. a y (y' i Since )∈(0,1), the function g(x) can satisfy the requirement of inverse normalization.
[0247] Step 2.5: Return the output vector after inverse normalization in step 2.4 to the management node.
[0248] Step 3: The management node receives 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 of the output vector is the expected transaction unit price, and the second dimension of the output vector is the expected number of entrepreneurs participating in the waste transaction.
[0250] Step 5: Return the expected transaction information obtained in Step 4 to the external calling system.
[0251] The management node, learning node, and evaluation node all access the same data source. The management node and learning node perform query, update, and insert operations on the data in the database, while the evaluation node only performs 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. It can be implemented using the Python language, which involves a large number of floating-point operations. These floating-point operations are performed using the GPU (or the CPU, but at a 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, and 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.
2. A method for training a waste material assessment neural network model as claimed in claim 1, characterized in that: The 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, y i Represents the value of dimension i in the actual output vector, Represents the value of dimension i in the predicted output vector.
3. A method for training a waste assessment neural network model as claimed in claim 2, 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 to obtain the partial derivative function value of each dimension of each gate 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.
4. A method for training a waste assessment neural network model as claimed in claim 3, 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 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.
5. 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 4, 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 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 includes a transaction unit price of the waste and a 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.
6. 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-4 are implemented.
7. 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 4.
8. 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 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 one of claims 1 to 4, and stores the new model parameters of the waste assessment neural network model in a database, which records the model parameter update time of the waste assessment neural network model for the waste type.
9. A distributed training system as claimed in claim 8, characterized in that: The learning node performs learning tasks regularly: 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 to 4, 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.
10. A waste material evaluation system, characterized in that: comprising at least one evaluation node and the distributed training system of claim 8 or 9; 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
Charge level prediction method based on recurrent neural network
CN114021446A
Method for predicting residual life interval of mechanical equipment
CN115204362A
Method and system for determining optimized program parameters for a robot program
US20230311309A1
Simulation training
WO2023129508A1
