CN117146954A - Weighing compensation method and device based on improved WOA-BP neural network - Google Patents
Weighing compensation method and device based on improved WOA-BP neural network Download PDFInfo
- Publication number
- CN117146954A CN117146954A CN202311052357.XA CN202311052357A CN117146954A CN 117146954 A CN117146954 A CN 117146954A CN 202311052357 A CN202311052357 A CN 202311052357A CN 117146954 A CN117146954 A CN 117146954A
- Authority
- CN
- China
- Prior art keywords
- neural network
- woa
- weighing
- improved
- population
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
- 238000013528 artificial neural network Methods 0.000 title claims abstract description 65
- 238000005303 weighing Methods 0.000 title claims abstract description 56
- 238000000034 method Methods 0.000 title claims abstract description 46
- 238000004422 calculation algorithm Methods 0.000 claims abstract description 42
- 238000012549 training Methods 0.000 claims abstract description 19
- 241000283153 Cetacea Species 0.000 claims description 29
- 241000251468 Actinopterygii Species 0.000 claims description 10
- 230000008569 process Effects 0.000 claims description 10
- 238000004590 computer program Methods 0.000 claims description 9
- 238000010606 normalization Methods 0.000 claims description 6
- 230000007423 decrease Effects 0.000 claims description 4
- 238000009396 hybridization Methods 0.000 claims description 4
- NAWXUBYGYWOOIX-SFHVURJKSA-N (2s)-2-[[4-[2-(2,4-diaminoquinazolin-6-yl)ethyl]benzoyl]amino]-4-methylidenepentanedioic acid Chemical compound C1=CC2=NC(N)=NC(N)=C2C=C1CCC1=CC=C(C(=O)N[C@@H](CC(=C)C(O)=O)C(O)=O)C=C1 NAWXUBYGYWOOIX-SFHVURJKSA-N 0.000 claims description 3
- 238000004364 calculation method Methods 0.000 claims description 3
- 238000009924 canning Methods 0.000 abstract description 2
- 239000003814 drug Substances 0.000 abstract description 2
- 239000000126 substance Substances 0.000 abstract description 2
- 230000007613 environmental effect Effects 0.000 abstract 1
- 238000005457 optimization Methods 0.000 description 7
- 239000003795 chemical substances by application Substances 0.000 description 6
- 230000008859 change Effects 0.000 description 4
- 230000006870 function Effects 0.000 description 3
- 230000007246 mechanism Effects 0.000 description 3
- 230000009286 beneficial effect Effects 0.000 description 2
- 230000019637 foraging behavior Effects 0.000 description 2
- 238000013507 mapping Methods 0.000 description 2
- 230000002028 premature Effects 0.000 description 2
- 238000013459 approach Methods 0.000 description 1
- 238000009530 blood pressure measurement Methods 0.000 description 1
- 238000004891 communication Methods 0.000 description 1
- 230000007547 defect Effects 0.000 description 1
- 238000010586 diagram Methods 0.000 description 1
- 230000000694 effects Effects 0.000 description 1
- 230000009191 jumping Effects 0.000 description 1
- 238000013178 mathematical model Methods 0.000 description 1
- 230000001537 neural effect Effects 0.000 description 1
- 238000003062 neural network model Methods 0.000 description 1
- 238000007781 pre-processing Methods 0.000 description 1
- 238000011160 research Methods 0.000 description 1
- 230000035945 sensitivity Effects 0.000 description 1
- 230000009182 swimming Effects 0.000 description 1
- 238000012360 testing method Methods 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F18/00—Pattern recognition
- G06F18/20—Analysing
- G06F18/21—Design or setup of recognition systems or techniques; Extraction of features in feature space; Blind source separation
- G06F18/214—Generating training patterns; Bootstrap methods, e.g. bagging or boosting
-
- G—PHYSICS
- G01—MEASURING; TESTING
- G01G—WEIGHING
- G01G23/00—Auxiliary devices for weighing apparatus
- G01G23/01—Testing or calibrating of weighing apparatus
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F17/00—Digital computing or data processing equipment or methods, specially adapted for specific functions
- G06F17/10—Complex mathematical operations
- G06F17/11—Complex mathematical operations for solving equations, e.g. nonlinear equations, general mathematical optimization problems
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N3/00—Computing arrangements based on biological models
- G06N3/02—Neural networks
- G06N3/04—Architecture, e.g. interconnection topology
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N3/00—Computing arrangements based on biological models
- G06N3/02—Neural networks
- G06N3/08—Learning methods
- G06N3/084—Backpropagation, e.g. using gradient descent
Landscapes
- Engineering & Computer Science (AREA)
- Physics & Mathematics (AREA)
- Theoretical Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Data Mining & Analysis (AREA)
- Mathematical Physics (AREA)
- General Engineering & Computer Science (AREA)
- Life Sciences & Earth Sciences (AREA)
- Artificial Intelligence (AREA)
- Software Systems (AREA)
- Evolutionary Computation (AREA)
- Mathematical Analysis (AREA)
- Health & Medical Sciences (AREA)
- Computational Mathematics (AREA)
- Computing Systems (AREA)
- Mathematical Optimization (AREA)
- Molecular Biology (AREA)
- General Health & Medical Sciences (AREA)
- Pure & Applied Mathematics (AREA)
- Computational Linguistics (AREA)
- Biophysics (AREA)
- Biomedical Technology (AREA)
- Bioinformatics & Computational Biology (AREA)
- Bioinformatics & Cheminformatics (AREA)
- Databases & Information Systems (AREA)
- Algebra (AREA)
- Operations Research (AREA)
- Evolutionary Biology (AREA)
- Computer Vision & Pattern Recognition (AREA)
- Feedback Control In General (AREA)
Abstract
The invention discloses a weighing compensation method and a device based on an improved WOA-BP neural network, which are used for acquiring weighing data under various different measuring ranges to be compensated and corresponding environmental temperatures in advance; initializing a BP neural network, and determining an input and output structure, an initial connection weight and a threshold value of the BP neural network; optimizing an initial weight and a threshold value of the BP neural network by utilizing the improved WOA algorithm, taking a training error of the BP neural network as an individual fitness value, and selecting the optimal initial weight and threshold value of the BP neural network; assigning values to initial weights and threshold values of the BP neural network structure according to the optimized optimal individuals; and repeatedly training through training samples to obtain an improved WOA-BP weighing data compensation model, and compensating weighing data under different measuring ranges. The invention can accurately predict various weighing data in the fields of chemical industry, automatic canning, traditional Chinese medicine grabbing and the like, has wide application range and stable and accurate result.
Description
Technical Field
The invention relates to the technical field of weighing metering application, in particular to a weighing compensation method and device based on an improved WOA-BP neural network.
Background
The load cell is a force sensor that converts a force applied to the load cell into a measurable electrical signal. The strength of the signal varies with the proportion of the applied force. In the actual use process, the pressure measurement value of the weighing sensor can generate nonlinear errors along with the change of temperature, and the temperature compensation is needed. The various coefficients of each weighing sensor are different, such as nonlinearity and sensitivity, and are required to be compensated, and the communication mode of the weighing system also affects the data precision.
The influence on weighing data is caused by the combination of a plurality of factors, so that the prediction of the weighing data belongs to the complex nonlinear mapping problem of the influence of a plurality of factors, and the BP neural network algorithm can just solve the problem. However, the conventional BP neural algorithm has a series of problems of poor stability, slow convergence speed, low prediction accuracy and the like due to inaccurate initial weight and threshold value. Compared with other algorithms, the WOA algorithm is simple to operate, strong in ability of jumping out of local optimum and few in adjustment parameters. This algorithm is often combined with other algorithms to solve the problem of optimizing in the computational problem.
In the prior art, WOA-BP-based pressure transmitter temperature compensation research aims at generating nonlinear errors of pressure transmitters which are easily affected by temperature, and provides a WOA-BP temperature compensation model for optimizing BP neural network based on whale algorithm. The weight and the threshold of the traditional BP neural network are optimized through a whale algorithm, an optimized compensation model is obtained and is used for fitting the nonlinear relation between the pressure and the temperature of the pressure transmitter, and therefore compensated data are obtained. The WOA is used as a newer intelligent group optimization algorithm, has strong global searching capability, has the advantages of simple structure, few parameters to be adjusted and the like, but the WOA algorithm still cannot avoid the problems of easy sinking into local optimal solution, slow convergence speed and the like when facing complex optimization problems. In order to solve the problems, the invention provides a weighing compensation method and a weighing compensation device based on an improved WOA-BP algorithm, wherein the WOA algorithm is improved by a population evolution mechanism and a mode of using a nonlinear convergence factor and introducing self-adaptive weight, so that population diversity is increased, the algorithm is prevented from being sunk into local optimum prematurely, and the local searching capability is improved.
Disclosure of Invention
The invention aims to: the invention provides a weighing compensation method and device based on an improved WOA-BP neural network, which have higher prediction precision and stability by improving the defects of premature WOA convergence and poor population diversity.
The technical scheme is as follows: the invention relates to a weighing compensation method based on an improved WOA-BP neural network, which specifically comprises the following steps:
(1) The method comprises the steps of obtaining weighing data under various different measuring ranges to be compensated and corresponding environment temperatures of the weighing data in advance;
(2) Initializing a BP neural network, and determining an input and output structure, an initial connection weight and a threshold value of the BP neural network;
(3) Optimizing an initial weight and a threshold value of the BP neural network by utilizing the improved WOA algorithm, taking a training error of the BP neural network as an individual fitness value, and selecting the optimal initial weight and threshold value of the BP neural network;
(4) Assigning values to initial weights and threshold values of the BP neural network structure according to the optimized optimal individuals; and repeatedly training through training samples, taking the mean square error as a training index, and storing the weight, the threshold and the network structure parameter obtained by training to obtain an improved WOA-BP weighing data compensation model, so as to compensate the weighing data under different measuring ranges.
Further, the implementation process of the step (1) is as follows:
the nonlinear and temperature 2 factors of the weighing sensor with the greatest influence on the weighing data are selected as influence variables, the acquired data samples are subjected to normalization pretreatment by adopting a maximum and minimum method so as to eliminate the order-of-magnitude difference among the data of each dimension, and the adopted normalization method is a maximum and minimum formula method:
(X)=(X-X min )/(X max -X min )(1)
wherein X is a certain value, X min Is the minimum value of the data set, X max Is the maximum value of the dataset.
Further, the implementation process of the step (2) is as follows:
the BP neural network adopts a three-layer network topological structure input layer, an hidden layer and an output layer, and two factors of temperature and nonlinearity of the weighing sensor are selected as influencing variables to serve as input quantity of the BP neural network input layer; the number of nodes of the input layer and the output layer is determined by the types of the input data and the output data, and the hidden layer is determined by the following formula:
where k is the number of hidden layer nodes, m is the number of input layer nodes, n is the number of output layer nodes, and α is a constant between 1 and 10.
Further, the implementation process of the step (3) is as follows:
(31) Initializing a population: determining WOA initialization parameters including population scale, maximum iteration times and probability values;
(32) Individual fitness value: calculating the fitness value of each individual, and recording the current optimal fitness value and the corresponding position as X * (t);
(33) Population evolution: selecting the population X with the worst fitness 1 (t) matching it to an optimal population X according to equation (3) * (t) artificial hybridization to obtain an optimized artificial fish group P (t); the implementation of the population evolution formula is as follows:
wherein B (t) represents a binary number,representing a binary number opposite to B (t);
(34) Generating a random number p at 0-1, and obtaining a coefficient vector A according to a formula (4):
A=2ar-a (4)
wherein r is a random number between [0,1], and a is an improved nonlinear convergence factor; the nonlinear convergence factor calculation formula is:
wherein t represents the current iteration number; t (T) max The maximum iteration number;
(35) When the random number p is more than or equal to 0.5, spiral predation is carried out through a position updating formula after the self-adaptive weight factor omega is introduced; the formula is:
X(t+1)=w(t)X * (t)+D′e bl cos(2πl) (6)
D′=|X * (t)-X(t)| (7)
wherein X (t) and X (t) respectively represent the current whale position and the optimal solution for each iteration, D' represents the optimal predation position of the ith whale, b is a constant defining the spiral shape, l is a random number of [ -1,1], and t represents the number of iterations;
(36) When the random number p is less than 0.5 and A is more than or equal to 1, updating the position according to the formula (8):
X(t+1)=w(t)X rand (t)-AD”' (8)
D”'=|2r 1 P rand1 (t)-P rand2 (t)| (9)
wherein r is 1 Is [0,1]]Random number, X between rand (t) is a randomly selected position vector from the current whale group, which contains a feasible solution, P rand1 (t) and P rand2 (t) represents a random fish population of the fish populations after population evolution;
(37) When the random number p <0.5 and a <1, the position is updated according to formula (10):
X(t+1)=w(t)X * (t)-AD" (10)
D"=|2r 1 X * (t)-P rand (t)| (11)
wherein P is rand (t) is a randomly selected position vector after population evolution;
(39) Judging whether a cycle end condition is reached, if so, ending the algorithm, and outputting an optimal solution, namely realizing the compensation of the weight data; otherwise, return to step (32).
Further, the output layer is set to 1.
Further, the determining WOA initialization parameters in step (31) is:
D=|CX * (t)-X(t)| (13)
wherein a=2ar_a, c=2r, r is a random number between [0,1 ]; x (t) and X (t) represent the current whale position and the optimal solution for each iteration, D' represents the optimal predation position for the ith whale, b is a constant defining the spiral shape, l is a random number of [ -1,1], t represents the number of iterations, a is a linear decrease during the iteration, and A and C are coefficients.
Based on the same inventive concept, the apparatus device of the present invention comprises a memory and a processor, wherein:
a memory for storing a computer program capable of running on the processor;
a processor for performing the steps of the weighing compensation method based on the improved WOA-BP neural network as described above when running the computer program.
Based on the same inventive concept, a storage medium according to the present invention has stored thereon a computer program which, when executed by at least one processor, implements the steps of a weighing compensation method based on an improved WOA-BP neural network as described above.
The beneficial effects are that: compared with the prior art, the invention has the beneficial effects that: according to the invention, the initial weight and the threshold value of the BP neural network are optimized by using the improved whale algorithm with global searching capability, so that the convergence speed and the stability of the BP neural network can be improved, the prediction result is more accurate, and the performance of the BP neural network is greatly improved; the invention can carry out weighing compensation in real time and rapidly; the method can accurately predict various weighing data in the fields of chemical industry, automatic canning, traditional Chinese medicine grabbing and the like, and has the advantages of wide application range and stable and accurate result.
Drawings
FIG. 1 is a flow chart of a method of weigh compensation based on a modified WOA-BP neural network;
FIG. 2 is a flow chart of optimizing training of BP neural network model using a modified whale algorithm;
FIG. 3 is a schematic diagram of a BP neural network topology according to the present invention;
fig. 4 is a graph showing the comparison between the predicted result and the true value of the improved WOA-BP symmetry weight compensation according to the embodiment of the present invention.
Detailed Description
The invention is described in further detail below with reference to the accompanying drawings.
As shown in fig. 1, the invention provides a weighing compensation method based on an improved WOA-BP neural network, which comprises the following steps:
step 1: and acquiring weighing data under various different measuring ranges to be compensated and corresponding environment temperatures thereof through a weighing system.
Specifically, a weighing sensor with the largest influence on weighing data is selected as an influence variable, 2 factors of nonlinearity and temperature of the weighing sensor are adopted, a maximum and minimum method is adopted to perform normalization preprocessing on collected data samples so as to eliminate the order-of-magnitude difference between the data of each dimension, and the adopted normalization method is a maximum and minimum formula method:
(X)=(X-X min )/(X max -X min )(1)
wherein X is a certain value, X min Is the minimum value of the data set, X max Is the maximum value of the dataset.
Step 2: initializing a BP neural network, and determining an input and output structure, an initial connection weight and a threshold value of the BP neural network.
Through network training, the weight and the threshold of the network are continuously adjusted by adopting the counter propagation of errors, the errors are reduced, and the nonlinear mapping and data association functions of complex variables are realized. As shown in fig. 3, the BP neural network adopts three network topology input layers, hidden layers and output layers, and selects two factors of temperature and nonlinearity of the weighing sensor as influencing variables to serve as input quantity of the BP neural network input layers; the output layer is set to be 1 because the output layer is weighing data; the number of nodes of the input layer and the output layer is determined by the types of the input data and the output data, and the hidden layer is determined by the following formula:
where k is the number of hidden layer nodes, m is the number of input layer nodes, n is the number of output layer nodes, and α is a constant between 1 and 10.
Step 3: as shown in fig. 2, under the BP neural network structure, the method for optimizing the BP neural network structure by using the improved whale algorithm specifically comprises the following steps: and optimizing the initial weight and the threshold of the BP neural network by using the improved WOA algorithm, taking the training error of the BP neural network as the fitness value of the individual, and selecting the optimal initial weight and threshold of the BP neural network.
A specific training process of the compensation model, comprising:
(31) Initializing a population: determining WOA initialization parameters including population scale, maximum iteration times and probability values;
(32) Individual fitness value: calculating the fitness value of each individual, and recording the current optimal fitness value and the corresponding position as X * (t);
(33) Population evolution: selecting the population X with the worst fitness 1 (t) matching it to an optimal population X according to equation (3) * (t) artificial hybridization to obtain an optimized artificial fish group P (t); the implementation of the population evolution formula is as follows:
wherein B (t) represents a binary number,representing a binary number opposite to B (t);
(34) Generating a random number p at 0-1, and obtaining a coefficient vector A according to a formula (4):
A=2ar-a (4)
wherein r is a random number between [0,1], and a is an improved nonlinear convergence factor; the nonlinear convergence factor calculation formula is:
wherein t represents the current iteration number; t (T) max The maximum iteration number;
(35) When the random number p is more than or equal to 0.5, spiral predation is carried out through a position updating formula after the self-adaptive weight factor omega is introduced; the formula is:
X(t+1)=w(t)X * (t)+D′e bl cos(2πl) (6)
D′=|X * (t)-X(t)| (7)
wherein X (t) and X (t) respectively represent the current whale position and the optimal solution for each iteration, D' represents the optimal predation position of the ith whale, b is a constant defining the spiral shape, l is a random number of [ -1,1], and t represents the number of iterations;
(36) When the random number p is less than 0.5 and A is more than or equal to 1, updating the position according to the formula (8):
X(t+1)=w(t)X rand (t)-AD”' (8)
D”'=|2r 1 P rand1 (t)-P rand2 (t)| (9)
wherein r is 1 Is [0,1]]Random number, X between rand (t) is a randomly selected position vector from the current whale group, which contains a feasible solution, P rand1 (t) and P rand2 (t) represents a random fish population of the fish populations after population evolution;
(37) When the random number p <0.5 and a <1, the position is updated according to formula (10):
X(t+1)=w(t)X * (t)-AD" (10)
D"=|2r 1 X * (t)-P rand (t)| (11)
wherein P is rand (t) is a randomly selected position vector after population evolution;
(38) Judging whether a cycle end condition is reached, if so, ending the algorithm and outputting an optimal solution; otherwise, return to step (32).
The improved WOA optimization BP neural network takes the weight and the threshold value of the BP neural network as optimization variables of an improved whale algorithm, and the mean square error of training and testing samples is taken as a fitness function; the smaller the obtained fitness function value is, the more accurate the training is, and the prediction accuracy of the model is also higher; the optimized BP neural network can more accurately compensate weighing data; elements of the improved whale algorithm to optimize BP neural network include: the selection of improved algorithm, whale position, random operator and position updating mode.
The BP neural network is optimized by adopting the improved WOA, and theoretical models of random search predation, surrounding predation, bubble network predation and the like are constructed by simulating the foraging behavior of the whale in the seat, so that the optimization solution of the target problem is realized, and the method has the advantages of high stability, few adjustment parameters and the like.
The initial WOA equation specifically includes:
D′=|X * (t)-X(t)| (7)
D=|CX * (t)-X(t)| (13)
wherein a=2ar_a, c=2r, r is a random number between [0,1 ]; x (t) and X (t) represent the current whale position and the optimal solution for each iteration, D' represents the optimal predation position for the ith whale, b is a constant defining the spiral shape, l is a random number of [ -1,1], t represents the number of iterations, a is a linear decrease during the iteration, and A and C are coefficients.
The first equation of equation (12) simulates the containment mechanism and the second equation simulates the bubble net hunting technique. The variable p switches between these 2 parts with equal probability. In the whale algorithm, each whale involved in hunting activities represents a viable solution. In each generation of swimming, whales randomly choose 3 foraging behaviors to catch a prey at the optimal position or update the position by surrounding shrinkage, and continuously approach the target prey until the optimal solution is found.
Population evolution selection of the worst fitness population X in the initial population size 1 (t) matching it to an optimal population X according to equation (3) * (t) artificial hybridization to obtain the preferred artificial fish group P (t). The population evolution mechanism allows a whale group with poor fitness to be hybridized with an optimal whale group into a new population so as to improve population diversity.
The larger convergence factor can provide powerful global searching capability, so that the algorithm is prevented from entering a local optimal solution too early to form premature; the smaller convergence factor ensures that the algorithm has stronger local exploration capability, can accelerate the convergence speed of the algorithm and improves the algorithm efficiency. In the conventional WOA algorithm, the convergence factor decreases recursively with the number of iterations, which tends to result in an algorithm convergence speed that is too slow. In order to solve the problem, on the premise of not changing the change trend of the convergence factor, a nonlinear adjustment strategy is adopted, so that on one hand, the global searching capability and the local searching capability of the algorithm can be ensured, and on the other hand, the convergence speed of the algorithm can be accelerated.
As shown in the formula (5), the invention can ensure that a larger parameter A is generated in the early stage of algorithm iteration so as to ensure global searching capability and accelerate algorithm convergence speed; at the later stage of iteration, a smaller parameter A is generated so as to improve the local exploration capacity of the algorithm.
The inertial weight has great influence on the algorithm convergence speed and the global optimizing capability. However, as the WOA algorithm is nonlinear in the optimization process, the linear dropping strategy of the inertia weight cannot be implemented in the actual optimization process, and meanwhile, the difference of the states of all search agents is considered, the invention utilizes a nonlinear self-adaptive weight strategy based on the current state of the search agent, and the mathematical model is as shown in a formula (14):
wherein w is i (T) is the weight of the ith search agent at the T-th iteration, T max Represents the maximum number of iterations, W 1 For initial minimum weight, W 2 F is the initial maximum weight avg (t) represents the average fitness value of the population after the current t-th iteration, f min (t) and f max And (t) represents the minimum fitness value and the maximum fitness value after the t-th iteration respectively.
As can be seen from equation (15), when the fitness value of the search agent is smaller than the average fitness value, the weight w is smaller, which ensures fine search in the space around the optimal solution; when the fitness value is greater than the average fitness value, the weight w is greater, which allows the search agent to be optimized over a larger range of space. w can adaptively change along with the average fitness value of the current population and the fitness value of the individual search agent, so that the convergence speed and the convergence precision of the WOA algorithm are effectively improved. The self-adaptive weight strategy can effectively avoid the phenomenon that WOA enters early maturing in advance, so that the algorithm can keep the diversity of the population and can jump out of local optimum in time.
The improved location update formula includes:
based on the same inventive concept, the present invention also provides an apparatus device comprising a memory and a processor, wherein: a memory for storing a computer program capable of running on the processor; a processor for performing the steps of the weighing compensation method based on the improved WOA-BP neural network as described above when running the computer program.
Based on the same inventive concept, the present invention also provides a computer program stored on a storage medium, which when executed by at least one processor, implements the steps of the weighing compensation method based on the improved WOA-BP neural network as described above.
As shown in fig. 4, the predicted value of the weighing data compensated by the method is closer to the true value, and the error between the predicted value of the weighing data and the true value detected by the conventional BP method and the WOA method is larger. As can be seen from fig. 4, the difference between the value obtained when the prediction was performed using only the BP neural network and the true value was large, whereas the value obtained when the prediction was performed using the WOA-BP neural network was closer to the true value than the BP neural network. However, compared with the two models, the change trend and the accuracy of the value obtained by the improved WOA-BP model are obviously closer to the true value.
Claims (8)
1. The weighing compensation method based on the improved WOA-BP neural network is characterized by comprising the following steps of:
(1) The method comprises the steps of obtaining weighing data under various different measuring ranges to be compensated and corresponding environment temperatures of the weighing data in advance;
(2) Initializing a BP neural network, and determining an input and output structure, an initial connection weight and a threshold value of the BP neural network;
(3) Optimizing an initial weight and a threshold value of the BP neural network by utilizing the improved WOA algorithm, taking a training error of the BP neural network as an individual fitness value, and selecting the optimal initial weight and threshold value of the BP neural network;
(4) Assigning values to initial weights and threshold values of the BP neural network structure according to the optimized optimal individuals; and repeatedly training through training samples, taking the mean square error as a training index, and storing the weight, the threshold and the network structure parameter obtained by training to obtain an improved WOA-BP weighing data compensation model, so as to compensate the weighing data under different measuring ranges.
2. The weighing compensation method based on the improved WOA-BP neural network according to claim 1, wherein the implementation process of the step (1) is as follows:
the nonlinear and temperature 2 factors of the weighing sensor with the greatest influence on the weighing data are selected as influence variables, the acquired data samples are subjected to normalization pretreatment by adopting a maximum and minimum method so as to eliminate the order-of-magnitude difference among the data of each dimension, and the adopted normalization method is a maximum and minimum formula method:
X=(X-X min )/(X max -X min ) (1)
wherein X is a certain value, X min Is the minimum value of the data set, X max Is the maximum value of the dataset.
3. The weighing compensation method based on the improved WOA-BP neural network according to claim 1, wherein the implementation process of the step (2) is as follows:
the BP neural network adopts a three-layer network topological structure input layer, an hidden layer and an output layer, and two factors of temperature and nonlinearity of the weighing sensor are selected as influencing variables to serve as input quantity of the BP neural network input layer; the number of nodes of the input layer and the output layer is determined by the types of the input data and the output data, and the hidden layer is determined by the following formula:
where k is the number of hidden layer nodes, m is the number of input layer nodes, n is the number of output layer nodes, and α is a constant between 1 and 10.
4. The weighing compensation method based on the improved WOA-BP neural network according to claim 1, wherein the implementation process of the step (3) is as follows:
(31) Initializing a population: determining WOA initialization parameters including population scale, maximum iteration times and probability values;
(32) Individual fitness value: calculating the fitness value of each individual, and recording the current optimal fitness value and the corresponding position as X * (t);
(33) Population evolution: selecting the population X with the worst fitness 1 (t) matching it to an optimal population X according to equation (3) * (t) Artificial hybridization to obtain the optimized artificial fish group P (t); the implementation of the population evolution formula is as follows:
wherein B (t) represents a binary number,representing a binary number opposite to B (t);
(34) Generating a random number p at 0-1, and obtaining a coefficient vector A according to a formula (4):
A=2ar-a (4)
wherein r is a random number between [0,1], and a is an improved nonlinear convergence factor; the nonlinear convergence factor calculation formula is:
wherein t represents the current iteration number; t (T) max The maximum iteration number;
(35) When the random number p is more than or equal to 0.5, spiral predation is carried out through a position updating formula after the self-adaptive weight factor omega is introduced; the formula is:
X(t+1)=w(t)X * (t)+D′e bl cos(2πl) (6)
D′=|X * (t)-X(t)| (7)
wherein X (t) and X (t) respectively represent the current whale position and the optimal solution for each iteration, D' represents the optimal predation position of the ith whale, b is a constant defining the spiral shape, l is a random number of [ -1,1], and t represents the number of iterations;
(36) When the random number p is less than 0.5 and A is more than or equal to 1, updating the position according to the formula (8):
X(t+1)=w(t)X rand (t)-AD”' (8)
D”'=|2r 1 P rand1 (t)-P rand2 (t)| (9)
wherein r is 1 Is [0,1]]Random number, X between rand (t) is a randomly selected position vector from the current whale group, which contains a feasible solution, P rand1 (t) and P rand2 (t) represents a random fish population of the fish populations after population evolution;
(37) When the random number p <0.5 and a <1, the position is updated according to formula (10):
X(t+1)=w(t)X * (t)-AD" (10)
D"=|2r 1 X * (t)-P rand (t)| (11)
wherein P is rand (t) is a randomly selected position vector after population evolution;
(38) Judging whether a cycle end condition is reached, if so, ending the algorithm, and outputting an optimal solution, namely realizing the compensation of the weight data; otherwise, return to step (32).
5. A weighing compensation method based on a modified WOA-BP neural network according to claim 3, characterized in that the output layer is set to 1.
6. The method of claim 4, wherein the determining WOA initialization parameters in step (31) are:
D=|CX * (t)-X(t)| (13)
wherein a=2ar_a, c=2r, r is a random number between [0,1 ]; x (t) and X (t) represent the current whale position and the optimal solution for each iteration, D' represents the optimal predation position for the ith whale, b is a constant defining the spiral shape, l is a random number of [ -1,1], t represents the number of iterations, a is a linear decrease during the iteration, and A and C are coefficients.
7. An apparatus device comprising a memory and a processor, wherein:
a memory for storing a computer program capable of running on the processor;
a processor for performing the steps of the weighing compensation method based on the improved WOA-BP neural network according to any one of claims 1-6 when said computer program is run.
8. A storage medium having stored thereon a computer program which, when executed by at least one processor, implements the steps of the weighing compensation method based on the modified WOA-BP neural network of any one of claims 1 to 6.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202311052357.XA CN117146954A (en) | 2023-08-18 | 2023-08-18 | Weighing compensation method and device based on improved WOA-BP neural network |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202311052357.XA CN117146954A (en) | 2023-08-18 | 2023-08-18 | Weighing compensation method and device based on improved WOA-BP neural network |
Publications (1)
Publication Number | Publication Date |
---|---|
CN117146954A true CN117146954A (en) | 2023-12-01 |
Family
ID=88899864
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202311052357.XA Pending CN117146954A (en) | 2023-08-18 | 2023-08-18 | Weighing compensation method and device based on improved WOA-BP neural network |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN117146954A (en) |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN117828272A (en) * | 2024-01-05 | 2024-04-05 | 山东金凤林电子科技有限公司 | Multi-correction compensation method and system for weighing sensor |
CN117903824A (en) * | 2024-03-13 | 2024-04-19 | 北京大学 | Organic matter waste material carbomorphism processing system based on wisdom management |
-
2023
- 2023-08-18 CN CN202311052357.XA patent/CN117146954A/en active Pending
Cited By (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN117828272A (en) * | 2024-01-05 | 2024-04-05 | 山东金凤林电子科技有限公司 | Multi-correction compensation method and system for weighing sensor |
CN117828272B (en) * | 2024-01-05 | 2024-06-21 | 山东金凤林电子科技有限公司 | Multi-correction compensation method and system for weighing sensor |
CN117903824A (en) * | 2024-03-13 | 2024-04-19 | 北京大学 | Organic matter waste material carbomorphism processing system based on wisdom management |
CN117903824B (en) * | 2024-03-13 | 2024-05-28 | 北京大学 | Organic matter waste material carbomorphism processing system based on wisdom management |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN117146954A (en) | Weighing compensation method and device based on improved WOA-BP neural network | |
CN106815782A (en) | A kind of real estate estimation method and system based on neutral net statistical models | |
CN111144552B (en) | Multi-index grain quality prediction method and device | |
CN111416797A (en) | Intrusion detection method for optimizing regularization extreme learning machine by improving longicorn herd algorithm | |
CN110738362A (en) | method for constructing prediction model based on improved multivariate cosmic algorithm | |
CN112365033B (en) | Wind power interval prediction method, system and storage medium | |
CN114912673A (en) | Water level prediction method based on whale optimization algorithm and long-term and short-term memory network | |
CN116861957A (en) | Operator automatic tuning method and related device based on reinforcement learning | |
CN116681945A (en) | Small sample class increment recognition method based on reinforcement learning | |
CN111563203A (en) | Intelligent household user-service interest degree personalized prediction device and method based on rapid non-negative implicit characteristic analysis | |
CN117241376B (en) | WSN node positioning method for multi-strategy improved BP neural network | |
CN113742178A (en) | Network node health state monitoring method based on LSTM | |
CN111539508B (en) | Generator excitation system parameter identification algorithm based on improved gray wolf algorithm | |
CN116680969A (en) | Filler evaluation parameter prediction method and device for PSO-BP algorithm | |
CN114330135B (en) | Classification model construction method and device, storage medium and electronic equipment | |
CN113537461B (en) | Network key node discovery method and system based on SIR value learning | |
CN117784615B (en) | Fire control system fault prediction method based on IMPA-RF | |
Gharehchopogh et al. | A new hybrid whale optimization algorithm and golden jackal optimization for data clustering | |
US20230351146A1 (en) | Device and computer-implemented method for a neural architecture search | |
Iacob et al. | Delay-Sensitive Local Plasticity in Echo State Networks | |
CN113868113B (en) | Class integrated test sequence generation method based on Actor-Critic algorithm | |
CN113712511B (en) | Stable mode discrimination method for brain imaging fusion characteristics | |
CN115952728B (en) | Soft measurement prediction method for nitrite nitrogen concentration | |
CN113035363B (en) | Probability density weighted genetic metabolic disease screening data mixed sampling method | |
CN114255234B (en) | Method for training model for identifying cardiovascular and cerebrovascular risks based on fundus images and related product |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination |