Improved dung beetle algorithm for near-infrared model transfer of hexamethylenetetramine-acetic acid solution

By improving the dung beetle algorithm and Kennard-Stone algorithm, combined with first-order derivative and wavelet transformation, the problem of no standard sample transfer between the near-infrared model of Ulotropine-acetic acid solution among different manufacturers and models is solved, and the explanatory nature of the model is improved. and predict performance, reducing cost and differential impact.

CN117690519BActive Publication Date: 2024-11-05BEIJING INST OF TECH +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202311710351.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-12-13
Publication Date
2024-11-05
Estimated Expiration
2043-12-13

AI Technical Summary

Technical Problem

There is difficulty in transferring standard samples between instruments without standard samples by the near-infrared model of Ulotropine-acetic acid solution from different manufacturers and different models. The existing methods require additional samples to be calculated, resulting in increased costs and reduced efficiency.

Method used

The variable optimization algorithm of the dung beetle algorithm is improved, combined with the Kennard-Stone algorithm and the first-order derivative and wavelet transformation, and through the five-fold cross-validation of the partial least squares method, a near-infrared spectral correction model is established to optimize the model transfer process.

Benefits of technology

It improves the explanatory and predictive performance of the model, reduces differences between instruments, reduces additional costs, and realizes the transfer of standard samples from different manufacturers and models, improving modeling efficiency and accuracy.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117690519B_ABST
    Figure CN117690519B_ABST
Patent Text Reader

Abstract

The present invention discloses a near-infrared model transfer method of urotropine-acetic acid solution of an improved dung beetle algorithm, comprising the following steps: S1, selecting and setting two near-infrared spectrometers, respectively as a host and a slave; S2, dividing the matrix into a calibration set sample and a validation set sample to form a prediction set sample; S3, performing a joint preprocessing of the first-order derivative and wavelet transform on the spectral matrix of the calibration set sample, the validation set sample and the prediction set sample; S4, using the improved dung beetle algorithm for variable optimization, establishing a five-fold cross-validation near-infrared model of the partial least squares method of the host according to the selected variables, and evaluating the migration performance of the model on different instruments. The present invention adopts the above-mentioned improved dung beetle algorithm urotropine-acetic acid solution near-infrared model transfer method, solves the defect of uneven initial population distribution in the original algorithm, helps to select the most informative variables from high-dimensional spectral data, and improves modeling efficiency and model interpretability.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to the technical field of model transfer, in particular to a near-infrared model transfer method of a urotropine-acetic acid solution for improving a dung beetle algorithm. Background Art

[0002] The rapid quantitative analysis of the hexamethylenetetramine concentration in hexamethylenetetramine-acetic acid solution using the near-infrared spectroscopy calibration model is of great significance for ensuring product quality and controlling production safety. This analytical method not only improves the analysis speed, but also reduces the analysis cost, providing a reliable and efficient solution for the quality monitoring of hexamethylenetetramine-acetic acid solution in the industrial production process of octogen, and providing strong support for the formulation of timely production adjustments and quality control measures.

[0003] However, in practical applications, due to slight differences, calibrations and configurations between instruments, the established correction models are difficult to be universal. This difference between instruments is one of the common challenges in near-infrared spectroscopy analysis. When solving the model sharing problem, two strategies are usually adopted: standard-free transfer and standard-based transfer. However, standard-based transfer requires additional standard samples to calculate the mathematical relationship between the master and slave instruments, and this process will result in additional costs. In contrast, standard-free model transfer does not require additional samples, can effectively correct the differences between the master and slave instrument spectra, and becomes a more economical and efficient option. At present, there is still a lack of an effective method for standard-free transfer of near-infrared models of urotropine-acetic acid solutions from different manufacturers and models. Summary of the invention

[0004] The purpose of the present invention is to provide a near-infrared model transfer method of a urotropine-acetic acid solution by improving a dung beetle algorithm. By improving the variable optimization algorithm of the dung beetle algorithm, the uneven distribution of the initial population existing in the original algorithm is solved, which is helpful to select the most informative variables from high-dimensional spectral data, improve the modeling efficiency and the interpretability of the model, thereby solving the problem of no standard sample transfer of near-infrared models of urotropine-acetic acid solutions of different manufacturers and models.

[0005] To achieve the above object, the present invention provides a method for transferring a near-infrared model of a urotropine-acetic acid solution by improving a dung beetle algorithm, comprising the following steps:

[0006] S1. Select and set two near-infrared spectrometers as the master and slave respectively;

[0007] S2. According to the Kennard-Stone algorithm, the spectral matrix of the urotropine-acetic acid solution obtained by the host and the corresponding chemical truth matrix of the urotropine concentration are divided into a calibration set sample and a verification set sample; the spectral matrix of the urotropine-acetic acid solution obtained by the slave is matched with the corresponding chemical truth matrix of the urotropine concentration to form a prediction set sample;

[0008] S3, performing joint preprocessing of first-order derivative and wavelet transform on the spectral matrices of the calibration set samples, the validation set samples and the prediction set samples;

[0009] S4, using the improved dung beetle algorithm to perform variable optimization on the spectral matrix of the calibration set samples, applying the selected variables to the validation set samples and the prediction set samples, and obtaining the spectral matrices of the calibration set samples, the validation set samples, and the prediction set samples after variable optimization;

[0010] S5. Using the calibration set sample spectrum matrix and the corresponding concentration matrix after variable optimization, the host near-infrared spectrum calibration model was established using the partial least squares five-fold cross-validation method; the validation set sample spectrum matrix after variable optimization was predicted, and the determination coefficient R was used to calculate the calibration model. 2 The prediction performance of the host near-infrared spectroscopy correction model on the validation set samples was evaluated by the mean absolute error (MAE);

[0011] S6. Using the host near-infrared spectrum correction model established in step S5, predict the prediction set sample spectrum matrix after variable optimization, and evaluate the prediction effect of the host near-infrared spectrum correction model on the slave.

[0012] Preferably, in step S2, the main steps of the Kennard-Stone algorithm are:

[0013] S21. Given a sample set, first calculate the distance between samples;

[0014] S22, selecting a sample pair with the greatest similarity from the sample set as the starting point of the calibration set;

[0015] S23, from the sample set that is removed as the starting point of the calibration set, continue to select the sample farthest from the calibration set and add it to the calibration set; repeat this step until the required calibration set size is reached;

[0016] S24. The remaining samples constitute a validation set.

[0017] Preferably, in step S3, the specific steps of first-order derivative and wavelet transform joint preprocessing are:

[0018] S31, perform first-order derivative calculation for each sample in the spectral matrix X to obtain the first-order derivative spectral matrix X 1st :

[0019]

[0020] In the formula, x i is the spectrum of the i-th sample in the spectrum matrix X, x i,1st is the first-order derivative spectrum matrix X1st The spectrum of the i-th sample in , g is the window width;

[0021] S32, for the first-order derivative spectrum matrix X 1st The spectrum x of the i-th sample in i,1st Perform a wavelet transform:

[0022]

[0023] Where f(t) is the first-order derivative spectrum matrix X 1st The spectrum x of the i-th sample in i,1st , is the wavelet basis function, a is the scale parameter, b is the displacement parameter, and C is the wavelet coefficient;

[0024] S33, reconstructing the obtained wavelet coefficients C to obtain a reconstructed spectrum matrix X 1st,resonstructed :

[0025]

[0026] Preferably, in step S4, the specific steps of improving the dung beetle algorithm are:

[0027] S41, initialize the relevant parameters of the improved dung beetle algorithm: set the maximum number of iterations M, the number of individuals in the population to p0, and the mutation ratio P p , maximum weight ω max , minimum weight ω min , first learning factor c1, second learning factor c2, dimension D;

[0028] S42, initialize the fitness function, and define the fitness function as follows:

[0029]

[0030] In the formula, y i is the chemical true value of the urotropine concentration of the i-th sample, is the predicted value of the urotropine concentration of the i-th sample, and n1 is the number of samples;

[0031] S43, Initialize the population: For each individual x in the number of individuals p0 in the population i =(x i1 ,x i2 ,x i3 ,…,x id ) According to the speed update rule of the particle swarm algorithm, calculate the speed v id and position x id , and update the fitness value f i , where the speed v and weight ω update rules are:

[0032] v id (t) = ω id (t)+c1r1(p id (t)-x id (t))+c2r2(p gd (t)-x id (t)) (5),

[0033] ω i (t) = ω max -(ω max -ω min )t / M (6),

[0034] Where t is the current iteration number, d = 1, 2, ..., D; i = 1, 2, ..., p0; r1 and r2 are random numbers distributed on [0, 1];

[0035] S44. Update the position x of each individual in the population through the behaviors of the ball-rolling dung beetle, the brooding ball, the small dung beetle, and the thief dung beetle. i (t);

[0036] S45. Calculate the fitness value f of each individual in the population i , find the current optimal individual position x best and the worst individual position x worse ;

[0037] S46. Perform mutation operation on a certain percentage of individuals: If the random number is less than the initial mutation probability M p , then mutation is performed and the individual position is updated, otherwise it remains the same;

[0038] S47, update the individuals in the entire population according to the mutation operation, and calculate the fitness value f of each individual in the new population i ;

[0039] S48, update the current global optimal position x according to the historical best solution i_best (t) and the fitness value f of the best optimal position i_best (t);

[0040] S49, repeat the above steps S43 to S48 until the maximum number of iterations is reached;

[0041] S410, output the global optimal fitness value f i_best and its optimal position x i_best .

[0042] Preferably, in step S5, the determination coefficient R 2 And the mean absolute error MAE is:

[0043] Coefficient of determination R2 The calculation formula is:

[0044]

[0045] In the formula is the average value of the chemical true value of the urotropine concentration in the urotropine-acetic acid solution samples;

[0046] The mean absolute error MAE represents the average absolute error between the model's predicted value and the actual observed value. Its calculation formula is:

[0047]

[0048] Preferably, in step S21, the distance between samples is calculated using a method of Euclidean distance or Mahalanobis distance.

[0049] Preferably, in step S21, the distance between samples is calculated using Euclidean distance.

[0050] Therefore, the present invention adopts the above-mentioned improved dung beetle algorithm of urotropine-acetic acid solution near infrared model transfer method, and the beneficial effects are as follows:

[0051] (1) The present invention uses the Kennard-Stone algorithm to divide the sample sets of the master and slave, which helps to ensure that the correction model has good generalization performance and can adapt to a wider range of sample situations.

[0052] (2) The present invention combines the first-order derivative and wavelet transform to preprocess the spectral matrix, which can extract richer information and help enhance the robustness and prediction performance of the model.

[0053] (3) The present invention improves the variable optimization of the dung beetle algorithm: a particle swarm algorithm with a nonlinear decreasing strategy for ω is used to initialize the dung beetle population, which solves the defect of uneven initial population distribution in the original algorithm, is conducive to selecting the most informative variables from high-dimensional spectral data, and improves modeling efficiency and model interpretability.

[0054] (4) The present invention determines the coefficient R 2 The performance of the evaluation model on the validation set is evaluated by the mean absolute error (MAE). These two indicators can comprehensively evaluate the model's fit and prediction accuracy.

[0055] The technical solution of the present invention is further described in detail below through the accompanying drawings and embodiments. BRIEF DESCRIPTION OF THE DRAWINGS

[0056] Figure 1 It is an overall flow chart of an embodiment of the near-infrared model transfer method of the urotropine-acetic acid solution of the improved dung beetle algorithm of the present invention. DETAILED DESCRIPTION

[0057] The technical solution of the present invention is further described below through the accompanying drawings and embodiments.

[0058] Unless otherwise defined, technical or scientific terms used in the present invention shall have the common meanings understood by one having ordinary skills in the field to which the present invention belongs.

[0059] like Figure 1 As shown, the near infrared model transfer method of urotropine-acetic acid solution based on the improved dung beetle algorithm includes the following steps:

[0060] S1. The main machine uses the MATRIX-F II near-infrared spectrometer from Bruker, Germany, with a spectral range of 4000 to 12000 cm -1 , a single sample was scanned 32 times, and each spectrum contained 1999 data points. The slave machine used the Antaris MX Fourier near-infrared spectrometer from ThermoScientific, USA, with a spectral range of 4000-10000cm -1 , a single sample is scanned 16 times, and each spectrum contains 1557 data points. When scanning the urotropine-acetic acid solution sample, ensure that the near-infrared spectrum data format obtained by the slave is consistent with the host. This includes adjusting the data format to match the host so that the data of the host and slave are consistent on the horizontal axis.

[0061] S2. According to the Kennard-Stone algorithm, the spectral matrix of the urotropine-acetic acid solution obtained by the host and the corresponding chemical truth matrix of the urotropine concentration are divided into calibration set samples and verification set samples, with a division ratio of 7:3, and 83 calibration set samples and 36 verification set samples are obtained; the spectral matrix of the urotropine-acetic acid solution obtained by the slave is matched with the corresponding chemical truth matrix of the urotropine concentration to form a prediction set sample, and the number of prediction set samples is 96;

[0062] The main steps of the Kennard-Stone algorithm are:

[0063] S21. For a given sample set, first calculate the distance between samples. The distance between samples is calculated by a method of Euclidean distance or Mahalanobis distance. In this embodiment, the distance between samples is calculated by Euclidean distance;

[0064] S22, selecting a sample pair with the greatest similarity from the sample set as the starting point of the calibration set;

[0065] S23, from the sample set that is removed as the starting point of the calibration set, continue to select the sample farthest from the calibration set and add it to the calibration set; repeat this step until the required calibration set size is reached;

[0066] S24. The remaining samples constitute a validation set.

[0067] S3, the spectral matrices of the calibration set samples, the validation set samples and the prediction set samples are preprocessed by first-order derivative and wavelet transform. Such a combination is unique and effective in data processing and can improve the quality and accuracy of spectral data;

[0068] The specific steps of the joint preprocessing of first-order derivative and wavelet transform are:

[0069] S31, perform first-order derivative calculation for each sample i in the spectrum matrix X to obtain the first-order derivative spectrum matrix X 1st :

[0070]

[0071] In the formula, x i is the spectrum of the i-th sample in the spectrum matrix X, x i,1st is the first-order derivative spectrum matrix X 1st The spectrum of the i-th sample in , g is the window width;

[0072] S32, for the first-order derivative spectrum matrix X 1st The spectrum x of the i-th sample in i,1st Perform a wavelet transform:

[0073]

[0074] Where f(t) is the first-order derivative spectrum matrix X 1st The spectrum x of the i-th sample in i,1st , is the wavelet basis function, a is the scale parameter, b is the displacement parameter, and C is the wavelet coefficient;

[0075] S33, reconstruct the obtained wavelet coefficients C to obtain a reconstructed spectrum matrix X 1st,resonstructed :

[0076]

[0077] Wherein, the wavelet basis function is db1, db2, db3, db4, db5, db6, db7 or db8, and the wavelet decomposition layer number is 2, 3, 4, 5, 6 or 7. The wavelet basis function in the present invention is db7, and the decomposition layer number is 6.

[0078] S4, using the improved dung beetle algorithm to perform variable optimization on the spectral matrix of the calibration set samples, applying the selected variables to the validation set samples and the prediction set samples, and obtaining the spectral matrices of the calibration set samples, the validation set samples, and the prediction set samples after variable optimization;

[0079] The specific steps of improving the dung beetle algorithm are:

[0080] S41, initialize the relevant parameters of the improved dung beetle algorithm: set the maximum number of iterations M, the number of individuals in the population to p0, and the mutation ratio P p , maximum weight ω max , minimum weight ω min , first learning factor c1, second learning factor c2, dimension D;

[0081] S42, initialize the fitness function, and define the fitness function as follows:

[0082]

[0083] In the formula, y i is the chemical true value of the urotropine concentration of the i-th sample, is the predicted value of the urotropine concentration of the i-th sample, and n1 is the number of samples;

[0084] S43, Initialize the population: For each individual x in the number of individuals p0 in the population i =(x i1 ,x i2 ,x i3 ,…,x id ) According to the speed update rule of the particle swarm algorithm, calculate the speed v id and position x id , and update the fitness value f i , where the speed and weight ω update rules are:

[0085] v id (t) = ω id (t)+c1r1(p id (t)-x id (t))+c2r2(p gd (t)-x id (t)) (5);

[0086] ω i (t) = ω max -(ω max -ω min )t / M (6),

[0087] Where t is the current iteration number, d = 1, 2, ..., D; i = 1, 2, ..., p0; r1 and r2 are random numbers distributed on [0, 1]. By initializing the dung beetle population with the particle swarm algorithm of the ω nonlinear decreasing strategy, some defects of the original algorithm are solved, which helps to improve the performance of the algorithm and make it more suitable for high-dimensional spectral data.

[0088] S44. Update the position x of each individual in the population through the behaviors of the ball-rolling dung beetle, the brooding ball, the small dung beetle, and the thief dung beetle. i (t):

[0089] The rolling ball dung beetle position update method is:

[0090] x i (t+1)=x i (t)+α×0.1×x i (t-1)+0.3×|x i (t)-X B | (7),

[0091] Where t represents the current iteration number, x i (t) represents the position information of the i-th dung beetle at the t-th iteration. α is a natural coefficient, indicating whether it deviates from the original direction. It is assigned to -1 or 1 according to the probability method. X B represents the current local optimal position;

[0092] When a dung beetle encounters an obstacle and cannot move forward, it needs to adjust its direction by dancing. The formula for the dung beetle to update its position by dancing is defined as follows:

[0093] x i (t+1)=x i (t)+tan(θ)|x i (t)-x i (t-1)| (8),

[0094] Where θ∈[0,π] represents the deflection angle. When θ is equal to 0, π / 2 or π, the position of the dung beetle will not be updated.

[0095] The brood ball uses a boundary selection strategy to simulate the oviposition area of ​​female dung beetles. The oviposition area is defined as:

[0096] lb * =max(X B ×(1-R),lb) (9);

[0097] ub * =min(X B ×(1+R),ub) (10),

[0098] Where lb * andub * Respectively represent the lower and upper limits of the spawning area, R = 1-t / M max , lb and ub represent the lower and upper bounds of the optimization problem, respectively;

[0099] During the iteration process, the position of the brooding ball changes dynamically and is defined as:

[0100] B i (t+1)=X B +b1×(B i (t)-lb*)+b2×(B i (t)-ub*) (11),

[0101] In the formula, B i (t) is the position information of the i-th brooding ball at the t-th iteration, b1 and b2 represent two independent random vectors of size 1×D, and D represents the dimension of the optimization problem;

[0102] Establish an optimal foraging area to guide dung beetle larvae to find food and simulate their foraging behavior, where the optimal foraging area is defined as:

[0103] lb b =max(X B ×(1-R),lb) (12);

[0104] ub b =min(X B ×(1+R),ub) (13);

[0105] In the formula, lb b andub b represent the lower and upper limits of the optimal foraging area, respectively;

[0106] The position of the dung beetle has been updated as follows:

[0107] x i (t+1)=x i (t)+C1×(x i (t)-lb b )+C2×(x i (t)-ub b ) (14),

[0108] In the formula, C1 represents a random number following a normal distribution, and C2∈(0,1) represents a random vector;

[0109] The position of the thief dung beetle is updated as follows:

[0110] x i (t+1)=X B +S×g×(|x i (t)-X B |+|x i (t)-X B | (15),

[0111] In the formula, x i(t) The position information of the i-th thief dung beetle at the t-th iteration, g represents a random vector of size 1×D that follows a normal distribution, and S represents a constant value.

[0112] S45. Calculate the fitness value f of each individual in the population i , find the current optimal individual position x best and the worst individual position x worse ;

[0113] S46. For a certain percentage of individuals (by P p Control) to perform mutation operation: If the random number is less than the initial mutation probability M p , then mutation is performed and the individual position is updated, otherwise it remains the same;

[0114] S47, update the individuals in the entire population according to the mutation operation, and calculate the fitness value f of each individual in the new population i ;

[0115] S48, update the current global optimal position x according to the historical best solution i_best (t) and the fitness value f of the best optimal position i_best (t);

[0116] S49, repeat the above steps S43 to S48 until the maximum number of iterations is reached;

[0117] S410, output the global optimal fitness value f i_best and its optimal position x i_best :

[0118] In specific use, the maximum number of iterations is set to 200, the number of individuals in the population is 30, the mutation ratio is 0.2, the maximum weight is 0.6, the minimum weight is 0.2, the learning factors c1 and c2 are 1.2 and 0.6 respectively, and the dimension is 1998. The number of variables is reduced from 1998 to 796.

[0119] S5. Using the calibration set sample spectrum matrix and the corresponding concentration matrix after variable optimization, the host near-infrared spectrum calibration model was established using the partial least squares five-fold cross-validation method. The validation set sample spectrum matrix after variable optimization was predicted, and the determination coefficient R 2 The mean absolute error (MAE) was used to evaluate the prediction performance of the host near-infrared spectroscopy calibration model on the validation set samples, providing a comprehensive quantitative evaluation of the model fit and prediction accuracy.

[0120] Coefficient of determination R 2 : R 2 The closer it is to 1, the better the prediction effect of the model. The calculation formula is:

[0121]

[0122] In the formula is the average value of the chemical true value of the urotropine concentration in the urotropine-acetic acid solution samples;

[0123] Mean absolute error (MAE): represents the average absolute error between the model's predicted value and the actual observed value. The smaller the MAE value, the closer the model's prediction is to the actual observed value. The calculation formula is:

[0124]

[0125] Table 1 shows the prediction results of the host near-infrared spectral calibration model for the calibration set and validation set sample spectral matrix. 2 is 0.97570, and MAE is 0.06841. On the validation set, the R 2 The average prediction performance of the host near-infrared spectroscopy calibration model on both the calibration set and the validation set is 0.97556 and the MAE is 0.07919. These indicators show that the host near-infrared spectroscopy calibration model has good prediction performance on both the calibration set and the validation set. 2 When it is close to 1, the MAE is small, which means that the model can accurately predict the concentration or properties of the sample.

[0126] Table 1 Prediction performance of calibration set and validation set samples

[0127]

[0128] S6. Using the host near-infrared spectrum correction model established in step S5, predict the prediction set sample spectrum matrix after variable optimization, and evaluate the prediction effect of the host near-infrared spectrum correction model on the slave.

[0129] Table 2 summarizes the effect evaluation of the host calibration set, host validation set and slave prediction set before and after the model transfer of the present invention. Before the model transfer, the host calibration set and validation set showed a high determination coefficient R 2 and a smaller mean absolute error (MAE), while the performance of the slave prediction set is relatively poor, with a negative R 2 The large MAE and the large value indicate poor prediction results. After model transfer, the performance of the slave prediction set that did not go through the S4 step improved, but R 2 The value is still low, and after step S4, the R 2 It increased significantly to 0.83826 and MAE decreased to 0.19573.

[0130] Table 2 Evaluation of the effect of the slave prediction set before and after the model transfer of this method

[0131]

[0132] Therefore, the present invention adopts the above-mentioned improved dung beetle algorithm hexamethylenetetramine-acetic acid solution near-infrared model transfer method, and uses a particle swarm algorithm that reduces the ω nonlinear decreasing strategy to initialize the dung beetle population, which solves the defect of uneven initial population distribution in the original algorithm, helps to select the most informative variables from high-dimensional spectral data, and improves modeling efficiency and model interpretability; through the determination coefficient R 2 The performance of the evaluation model on the validation set is evaluated by the mean absolute error (MAE). These two indicators can comprehensively evaluate the model's fit and prediction accuracy.

[0133] Finally, it should be noted that the above embodiments are only used to illustrate the technical solution of the present invention rather than to limit it. Although the present invention has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that they can still modify or replace the technical solution of the present invention with equivalents, and these modifications or equivalent replacements cannot cause the modified technical solution to deviate from the spirit and scope of the technical solution of the present invention.

Claims

1. A near-infrared model transfer method of urotropine-acetic acid solution based on an improved dung beetle algorithm, characterized in that: The following steps are involved: S1. Select and set two near-infrared spectrometers as the master and slave respectively; S2. According to the Kennard-Stone algorithm, the spectral matrix of the urotropine-acetic acid solution obtained by the host and the corresponding chemical truth matrix of the urotropine concentration are divided into a calibration set sample and a verification set sample; the spectral matrix of the urotropine-acetic acid solution obtained by the slave is matched with the corresponding chemical truth matrix of the urotropine concentration to form a prediction set sample; S3, performing joint preprocessing of first-order derivative and wavelet transform on the spectral matrices of the calibration set samples, the validation set samples and the prediction set samples; S4, using the improved dung beetle algorithm to perform variable optimization on the spectral matrix of the calibration set samples, applying the selected variables to the validation set samples and the prediction set samples, and obtaining the spectral matrices of the calibration set samples, the validation set samples, and the prediction set samples after variable optimization; S5. Using the calibration set sample spectrum matrix and the corresponding concentration matrix after variable optimization, the host near-infrared spectrum calibration model was established using the partial least squares five-fold cross-validation method; the validation set sample spectrum matrix after variable optimization was predicted, and the determination coefficient R was used to calculate the calibration model. 2 The prediction performance of the host near-infrared spectroscopy correction model on the validation set samples was evaluated by the mean absolute error (MAE); S6, using the host near-infrared spectrum calibration model established in step S5, predicting the prediction set sample spectrum matrix after variable optimization, and evaluating the prediction effect of the host near-infrared spectrum calibration model on the slave; In step S4, the specific steps of improving the dung beetle algorithm are: S41, initialize the relevant parameters of the improved dung beetle algorithm: set the maximum number of iterations M, the number of individuals in the population to p0, and the mutation ratio P p , maximum weight ω max , minimum weight ω min , first learning factor c1, second learning factor c2, dimension D; S42, initialize the fitness function, and define the fitness function as follows: In the formula, y i is the chemical true value of the urotropine concentration of the i-th sample, is the predicted value of the urotropine concentration of the i-th sample, and n1 is the number of samples; S43, Initialize the population: For each individual x in the number of individuals p0 in the population i =(x i1 ,x i2 ,x i3 ,…,x id ) According to the speed update rule of the particle swarm algorithm, calculate the speed v id and position x id , and update the fitness value f i , where the speed v and weight ω update rules are: v id (t)=ω id (t)+c1r1(p id (t)-x id (t))+c2r2(p gd (t)-x id (t)) (2), oh i (t)=ω max -(oh max -oh min )t / M (3), Where t is the current iteration number, d = 1, 2, ..., D; i = 1, 2, ..., p0; r1 and r2 are random numbers distributed on [0, 1]; S44. Update the position x of each individual in the population through the behaviors of the ball-rolling dung beetle, the brooding ball, the small dung beetle, and the thief dung beetle. i (t); S45. Calculate the fitness value f of each individual in the population i , find the current optimal individual position x best and the worst individual position x worse ; S46. Perform mutation operation on a certain percentage of individuals: If the random number is less than the initial mutation probability M p , then mutation is performed and the individual position is updated, otherwise it remains the same; S47, update the individuals in the entire population according to the mutation operation, and calculate the fitness value f of each individual in the new population i ; S48, update the current global optimal position x according to the historical best solution i_best (t) and the fitness value f of the best optimal position i_best (t); S49, repeat the above steps S43 to S48 until the maximum number of iterations is reached; S410, output the global optimal fitness value f i_best and its optimal position x i_best .

2. The method for transferring the near-infrared model of the urotropine-acetic acid solution of the improved dung beetle algorithm according to claim 1, characterized in that: In step S2, the main steps of the Kennard-Stone algorithm are: S21. Given a sample set, first calculate the distance between samples; S22, selecting a sample pair with the greatest similarity from the sample set as the starting point of the calibration set; S23, from the sample set that is removed as the starting point of the calibration set, continue to select the sample farthest from the calibration set and add it to the calibration set; repeat this step until the required calibration set size is reached; S24. The remaining samples constitute a validation set.

3. The method for transferring the near-infrared model of the urotropine-acetic acid solution of the improved dung beetle algorithm according to claim 1, characterized in that: In step S3, the specific steps of the first-order derivative and wavelet transform joint preprocessing are: S31, perform first-order derivative calculation for each sample in the spectral matrix X to obtain the first-order derivative spectral matrix X 1st : In the formula, x i is the spectrum of the i-th sample in the spectrum matrix X, x i,1st is the first-order derivative spectrum matrix X 1st The spectrum of the i-th sample in , g is the window width; S32, for the first-order derivative spectrum matrix X 1st The spectrum x of the i-th sample in i,1st Perform a wavelet transform: Where f(t) is the first-order derivative spectrum matrix X 1st The spectrum x of the i-th sample in i,1st , is the wavelet basis function, a is the scale parameter, b is the displacement parameter, and C is the wavelet coefficient; S33, reconstructing the obtained wavelet coefficients C to obtain a reconstructed spectrum matrix X 1st,resonstructed :

4. The method for transferring the near-infrared model of the urotropine-acetic acid solution of the improved dung beetle algorithm according to claim 1, characterized in that: In step S5, the determination coefficient R 2 And the mean absolute error MAE is: Coefficient of determination R 2 The calculation formula is: In the formula is the average value of the chemical true value of the urotropine concentration in the urotropine-acetic acid solution samples; The mean absolute error MAE represents the average absolute error between the model's predicted value and the actual observed value. Its calculation formula is:

5. The method for transferring the near-infrared model of the urotropine-acetic acid solution of the improved dung beetle algorithm according to claim 2, characterized in that: In step S21, the distance between samples is calculated using a method of Euclidean distance or Mahalanobis distance.

6. The method for transferring the near-infrared model of the urotropine-acetic acid solution of the improved dung beetle algorithm according to claim 5, characterized in that: In step S21, the distance between samples is calculated using the Euclidean distance.