A near infrared model transfer method for hexamethylenetetramine-acetic acid solution
By establishing and migrating the near-infrared correction model of the Ulotropine-acetic acid solution between different near-infrared spectrometers, the problem of model sharing among different instruments is solved, the stable transfer of the model and reliability on different instruments is achieved, and resource waste is reduced.
Patent Information
- Application Number
- CN202311710355.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-12-13
- Publication Date
- 2025-04-25
- Estimated Expiration
- 2043-12-13
AI Technical Summary
It is difficult to achieve the sharing of the near-infrared model of the ulotropine-acetic acid solution between different near-infrared spectrometers, making it difficult to obtain a calibration model of consistency and reliability among different instruments.
By selecting and setting two near-infrared spectrometers as master and slave, chemical titration method is used to obtain the chemical truth value of Ulotropine concentration, data preprocessing and variable preferences are performed, and the calibration model is established using partial least squares method and 50-fold cross-validation method, and the model is migrated from master to slave.
The stable transfer of the near-infrared model of Ulotropine-acetic acid solution was achieved, reducing the waste of manpower, material resources and financial resources caused by repeated modeling, improving the adaptability of the model, and ensuring the reliability and robustness of the model on different instruments.
Smart Images

Figure CN117690520B_ABST
Abstract
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. Background Art
[0002] Near infrared spectroscopy technology has been widely used in the fields of medicine, chemical industry, food, etc. due to its advantages such as fast analysis speed, non-destructiveness, wide application range, and simultaneous measurement of multiple components. However, when establishing a calibration model, it is usually required to have a sufficient number of samples and obtain their chemical values. Therefore, high requirements are placed on the adaptability of the established calibration model, that is, to be able to share the model while meeting a wide range of predictions, and to reduce the waste of resources caused by repeated modeling and measurement of sample chemical values.
[0003] As one of the main raw materials for the production of the elemental explosive octogen, the stability of the concentration of hexamethylenetetramine-acetic acid solution is crucial to production safety and product quality. However, in practical applications, there is a challenge that the models established by different near-infrared spectrometers are difficult to share. This phenomenon may make it more difficult to obtain consistent and reliable calibration models between different instruments, which brings troubles to ensure the stability of monitoring the hexamethylenetetramine concentration in hexamethylenetetramine-acetic acid solution. At present, there is still a lack of an effective method for transferring the near-infrared model of hexamethylenetetramine-acetic acid solution between different instruments. Summary of the invention
[0004] The purpose of the present invention is to provide a near-infrared model transfer method for a urotropine-acetic acid solution, which can greatly reduce the waste of manpower, material resources and financial resources caused by repeated modeling through the stable transfer of the near-infrared correction model of the urotropine-acetic acid solution established based on different near-infrared spectrometers, improve the adaptability of the model, and ensure the reliability and robustness of the near-infrared model of the urotropine-acetic acid solution on different instruments.
[0005] To achieve the above object, the present invention provides a near infrared model transfer method of urotropine-acetic acid solution, the steps are as follows:
[0006] S1. Select and set two near-infrared spectrometers as the master and slave respectively;
[0007] S2. titrating the urotropine concentration in the urotropine-acetic acid solution by chemical titration to obtain the chemical true value of the urotropine concentration;
[0008] S3, randomly dividing the spectral matrix of the urotropine-acetic acid solution obtained by the host and the corresponding urotropine chemical true value concentration matrix to obtain calibration set samples and verification set samples; matching the spectral matrix of the urotropine-acetic acid solution obtained by the slave with the corresponding urotropine concentration chemical true value matrix to form a prediction set sample;
[0009] S4, performing Savitzky-Golay filtering and orthogonal signal correction preprocessing on the spectral matrices of the calibration set samples, the validation set samples and the prediction set samples in step S3;
[0010] S5, using an adaptive dung beetle hybrid algorithm to perform variable optimization on the spectral matrix of the calibration set samples, and applying the optimized variables to the spectral matrix preprocessed in step S4, to obtain the spectral matrices of the calibration set samples, the validation set samples, and the prediction set samples after variable optimization;
[0011] S6. 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 near-infrared spectrum calibration model. 2 The root mean square error (RMSE) was used to evaluate the prediction performance of the host near-infrared spectroscopy calibration model on the validation set samples;
[0012] S7, using the host near-infrared spectrum correction model established in step S6, 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.
[0013] Preferably, in step S4, the specific steps of Savitzky-Golay filtering are:
[0014] Sa1, select the appropriate window width w, polynomial degree p and derivative term d;
[0015] Sa2, for a given sample x in the calibration set sample spectrum matrix i , construct a design matrix X 1 , where each row corresponds to the near-infrared spectrum data of a given sample, and each column corresponds to different polynomial order terms and derivative terms:
[0016]
[0017] Where m is the number of data points, and its calculation formula is m = (w-1) / 2;
[0018] Sa3, use p-1 degree polynomial to fit the data in the window to the matrix X, which is expressed as:
[0019] Y (2m+1)×1 =X (2m+1)×p ·A k×1 +E (2m+1)×1 (2)
[0020] Where Y is the matrix to be solved, A is the fitting parameter matrix, and E is the error matrix;
[0021] Sa4. Calculate the filter coefficient A' using the least squares method:
[0022] A′=(X T X) -1 X T Y (3),
[0023] Sa5. For a given sample x i , use the filter coefficients A′ to calculate the output matrix Y′ for a given sample after filtering:
[0024] T′=XA (4);
[0025] Sa6, repeat steps Sa1 to Sa4 to obtain the calibration set sample spectrum matrix X after Savitzky-Golay filtering. 1 , validation set sample spectrum matrix X 2 And the prediction set sample spectrum matrix X 3 .
[0026] Preferably, in step S4, the specific steps of orthogonal signal correction are:
[0027] Sb1, let the chemical true value concentration matrix of the hexamethylenetetramine concentration of the calibration set samples be Y 1 , the chemical truth concentration matrix of the hexamethylenetetramine concentration of the validation set samples is Y 2 , the chemical truth concentration matrix of the hexamethylenetetramine concentration of the prediction set samples is Y 3 ;
[0028] Sb2, the calibration set sample spectrum matrix X 1 And the chemical truth concentration matrix Y of the hexamethylenetetramine concentration of the calibration set samples 1 Perform centralization to obtain the spectral matrix X c and the concentration matrix T c ;
[0029] Sb3, in each iteration, the spectral matrix X c Perform singular value decomposition:
[0030] X c =U∑V T (5)
[0031] Where U, Σ, and V are the spectral matrices X c The left singular vectors, singular value diagonals and right singular vectors of ;
[0032] Sb4, initialize the score vector tt: tt=U[:,0]σ 0 (6)
[0033] where σ 0is the maximum singular value;
[0034] Sb5, orthogonalized score vector t new :t new =(1-Y c (Y c T Y c ) -1 Y c T )·tt (7);
[0035] Sb6. Calculate the load vector ω:
[0036] Sb7, update score vector t 2 :t 2 =X c ×ω (9);
[0037] Sb8, calculate ||tt-t new || / ||tt|Calculate the convergence accuracy of tt. If it is not satisfied, go to step Sb4; if it is satisfied, proceed to the next step;
[0038] Sb9. Calculate the load vector P: P = X c T ×tt / (tt T ×tt) (10);
[0039] Sb10, from the spectrum matrix X c Subtract the correction from the matrix to get the new matrix E e :E e =X c -tt×P T (11);
[0040] Sb11, the new matrix E e As the next matrix X c , go to step S3 to recalculate tt, P and ω until the iteration is completed, and the final tt, P and ω are recorded as the score vector t e , load vector p e , loading vector ω e Continue to the next step;
[0041] Sb12, the spectrum matrix X c Projection to the score vector t e Upper: t e =X c ×ω e (12);
[0042] Sb13, from the spectrum matrix X cRemove the influence of the principal component and obtain the transformed spectral matrix X c_new :
[0043] X c_new =X c -t e ×p e T (13).
[0044] Preferably, in step S5, the specific steps of the adaptive dung beetle hybrid algorithm are as follows:
[0045] S5a, initialize the fitness function and define the fitness function as follows:
[0046]
[0047] where 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, n 1 is the number of samples;
[0048] S5b, initialize the relevant parameters of the adaptive dung beetle hybrid algorithm: set the maximum number of iterations M max , the number of individuals in the population is pop, and the mutation ratio is P p , initial mutation probability M p , maximum mutation probability M p_max , minimum mutation probability M p_min , mutation factor M f , in order to prevent the movement of dung beetles beyond the limit, the best foraging area of dung beetles is limited [lb, ub];
[0049] S5c, initialize the population: the position of each individual is randomly generated in the search space;
[0050] S5d, update the position x of each individual in the population through the behaviors of the rolling ball dung beetle, brood ball, small dung beetle and thief dung beetle i (t);
[0051] S5e, 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 ;
[0052] S5f, by P p Control, perform mutation operation on a certain percentage of individuals: if the random number is less than the initial mutation probability M p , then mutate and update the individual position; otherwise keep it as it is;
[0053] S5g, 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 ;
[0054] S5h, update the current global optimal position x according to the historical best solution i_best And the fitness value f of the best optimal position i_best ;
[0055] S5i, Dynamically adjust the mutation probability: If the fitness value f of the current optimal position i_best The fitness value f is smaller than the optimal position of the previous generation i-1_best , increase the initial mutation probability M p ; If the fitness value of the current optimal position is f i_best The fitness value f is greater than or equal to the optimal position of the previous generation i-1_best , reduce the initial mutation probability M p , adjust the initial mutation probability according to the following formula:
[0056]
[0057] Where t is the current iteration number;
[0058] S5j, repeat the above steps S5d to S5i until the maximum number of iterations is reached;
[0059] S5k, output the global optimal fitness value and its optimal position.
[0060] Preferably, in step S6, the determination coefficient R 2 The calculation formula is:
[0061]
[0062] In the formula is the average of the actual values;
[0063] The calculation formula of mean square error RMSE is:
[0064]
[0065] Therefore, the present invention adopts the above-mentioned near-infrared model transfer method of urotropine-acetic acid solution, and the beneficial effects are as follows:
[0066] (1) The present invention successfully solves the problem of transferring the near-infrared model of hexamethylenetetramine-acetic acid solution between different instruments by setting two near-infrared spectrometers as the host and the slave, respectively, and performing steps such as data preprocessing and variable optimization.
[0067] (2) The present invention preprocesses data by combining Savitzky-Golay filtering and orthogonal signal correction, which helps to improve the quality of spectral data, reduce noise, highlight key information, and thus improve the accuracy of modeling.
[0068] (3) Variable optimization modeling of the present invention: The adaptability of the adaptive dung beetle hybrid algorithm helps to dynamically adjust the mutation probability during the iteration process, making the algorithm more likely to converge to the global optimal solution, and helps to select the characteristic variables with the highest correlation with the urotropine concentration in the urotropine-acetic acid solution, thereby improving the efficiency and performance of modeling.
[0069] The technical solution of the present invention is further described in detail below through the accompanying drawings and embodiments. BRIEF DESCRIPTION OF THE DRAWINGS
[0070] Figure 1 The present invention is a flowchart of an embodiment of a near infrared model transfer method of a urotropine-acetic acid solution. DETAILED DESCRIPTION
[0071] The technical solution of the present invention is further described below through the accompanying drawings and embodiments.
[0072] 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.
[0073] As shown in the figure, a method for transferring a near infrared model of a hexamethylenetetramine-acetic acid solution is as follows:
[0074] S1. The host 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, each spectrum contained 1999 data points; the slave machine used the Antaris MX Fourier near-infrared spectrometer from Thermo Scientific, USA, with a spectral range of 4000-10000cm -1 , a single sample is scanned 16 times, and each spectrum contains 1557 data points; the master and slave are used to scan the urotropine-acetic acid solution sample respectively; the near-infrared spectrum data format of the urotropine-acetic acid solution obtained by the slave is adjusted to be consistent with that of the master, ensuring that the data of the master and the slave match on the horizontal axis;
[0075] S2. titrating the urotropine concentration in the urotropine-acetic acid solution by chemical titration to obtain the chemical true value of the urotropine concentration;
[0076] S3. Randomly divide the spectral matrix of the urotropine-acetic acid solution obtained by the host and the corresponding chemical truth matrix of the urotropine concentration to obtain calibration set samples and verification set samples, wherein the number of calibration set samples is 72 and the number of verification set samples is 47; match the spectral matrix of the urotropine-acetic acid solution obtained by the slave with the corresponding chemical truth matrix of the urotropine concentration to form a prediction set sample, wherein the number of prediction set samples is 96;
[0077] S4, performing Savitzky-Golay filtering and orthogonal signal correction preprocessing on the spectral matrices of the calibration set samples, the validation set samples and the prediction set samples in step S3;
[0078] The specific steps of Savitzky-Golay filtering are:
[0079] Sa1, select the appropriate window width w, polynomial degree p and derivative term d;
[0080] Sa2, for a given sample x in the calibration set sample spectrum matrix i , construct a design matrix X 1 , where each row corresponds to the near-infrared spectrum data of a given sample, and each column corresponds to different polynomial order terms and derivative terms:
[0081]
[0082] Where m is the number of data points, and the calculation formula is m = (w-1) / 2;
[0083] Sa3, use p-1 degree polynomial to fit the data in the window to the matrix X, which is expressed as:
[0084] Y (2m+1)×1 =X (2m+1)×p ·A k×1 +E (2m+1)×1 (2)
[0085] Where Y is the matrix to be solved, A is the fitting parameter matrix, and E is the error matrix;
[0086] Sa4. Calculate the filter coefficient A' using the least squares method:
[0087] A′=(X T X) -1 X T Y (3),
[0088] Sa5. For a given sample x i , use the filter coefficients A′ to calculate the output matrix Y′ for a given sample after filtering:
[0089] Y′=XA (4);
[0090] Sa6, repeat steps Sa1 to Sa4 to obtain the calibration set sample spectrum matrix X after Savitzky-Golay filtering. 1 , validation set sample spectrum matrix X 2 And the prediction set sample spectrum matrix X 3 When used specifically, the window width w, the polynomial degree p, and the derivative term d are set to 9, 5, and 1, respectively.
[0091] The specific steps of orthogonal signal correction are:
[0092] Sb1, let the chemical true value concentration matrix of the hexamethylenetetramine concentration of the calibration set samples be Y 1 , the chemical truth concentration matrix of the hexamethylenetetramine concentration of the validation set samples is Y 2 , the chemical truth concentration matrix of the hexamethylenetetramine concentration of the prediction set samples is Y 3 ;
[0093] Sb2, the calibration set sample spectrum matrix X 1 And the chemical truth concentration matrix Y of the hexamethylenetetramine concentration of the calibration set samples 1 Perform centralization to obtain the spectral matrix X c and the concentration matrix Y c ;
[0094] Sb3, in each iteration, the spectral matrix X c Perform singular value decomposition:
[0095] X c =U∑V T (5)
[0096] Where U, ∑, and V are the spectral matrices X c The left singular vectors, singular value diagonals and right singular vectors of ;
[0097] Sb4, initialize the score vector tt: tt = U[:, 0]σ 0 (6)
[0098] where σ 0 is the maximum singular value;
[0099] Sb5, orthogonalized score vector t new :t new =(1-Y c (Y c T Y c ) -1 Y c T ).tt (7);
[0100] Sb6. Calculate the load vector ω:
[0101] Sb7, update score vector t 2 :t 2 =X c ×ω (9);
[0102] Sb8, calculate ||tt-t new || / ||tt|Calculate the convergence accuracy of tt. If it is not satisfied, go to step Sb4; if it is satisfied, proceed to the next step;
[0103] Sb9. Calculate the load vector P: P = X c T ×tt / (tt T ×tt) (10);
[0104] Sb10, from the spectrum matrix X c Subtract the correction from the matrix to get the new matrix E e :E e =X c -tt×P T (11);
[0105] Sb11, the new matrix E e As the next matrix X c , go to step S3 to recalculate tt, P and ω until the iteration is completed, and the final tt, P and ω are recorded as the score vector t e , load vector p e , loading vector ω e Continue to the next step;
[0106] Sb12, the spectrum matrix X c Projection to the score vector t e Upper: t e =X c ×ω e (12);
[0107] Sb13, from the spectrum matrix X c Remove the influence of the principal component and obtain the transformed spectral matrix X c_new :
[0108] X c_new =X c -t e ×p e T (13).
[0109] S5, using an adaptive dung beetle hybrid algorithm to perform variable optimization on the spectral matrix of the calibration set samples, and then applying the optimized variables to the spectral matrix preprocessed in step S4 to obtain the spectral matrices of the calibration set samples, the validation set samples and the prediction set samples after variable optimization;
[0110] The specific steps of the adaptive dung beetle hybrid algorithm are as follows:
[0111] S5a, initialize the fitness function and define the fitness function as follows:
[0112]
[0113] where 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, n 1 is the number of samples;
[0114] S5b, initialize the relevant parameters of the adaptive dung beetle hybrid algorithm: set the maximum number of iterations M max , the number of individuals in the population is pop, and the mutation ratio is P p , initial mutation probability M p , maximum mutation probability M p_max , minimum mutation probability M p_min , mutation factor M f , in order to prevent the movement of dung beetles beyond the limit, the best foraging area of dung beetles is limited [lb, ub];
[0115] S5c, initialize the population: the position of each individual is randomly generated in the search space;
[0116] S5d, update the position x of each individual in the population through the behaviors of the rolling ball dung beetle, brood ball, small dung beetle and thief dung beetle i (t);
[0117] The rolling ball dung beetle position update method is:
[0118] x i (t+1)=x i (t)+α×0.1×x i (t-1)+0.3×|x i (t)-X w | (15),
[0119] 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, where α is a natural coefficient, indicating whether it deviates from the original direction, and is assigned to -1 or 1 according to the probability method;
[0120] 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:
[0121] x i (t+1)=x i (t)+tan(θ)|x i (t)-x i (t-1)| (16),
[0122] Where θ∈[0,π] represents the deflection angle. When θ is equal to 0, π / 2 or π, the position of the dung beetle will not be updated.
[0123] The brood ball uses a boundary selection strategy to simulate the oviposition area of female dung beetles. The oviposition area is defined as:
[0124] lb * =max(X B ×(1-R),lb) (17),
[0125] ub * =min(X B ×(1+R),ub) (18),
[0126] Where, X B represents the current local optimal position, 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;
[0127] During the iteration process, the position of the brooding ball changes dynamically and is defined as:
[0128] B i (t+1)=x B +b 1 ×(B i (t)-lb*)+b 2 ×(B i (t)-ub*) (19),
[0129] In the formula, B i (t) is the position information of the i-th brooding ball at the t-th iteration, b 1 and b 2 represents two independent random vectors of size 1×D, where D represents the dimension of the optimization problem.
[0130] 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:
[0131] lbb =max(X * ×(1-R),lb) (20),
[0132] ub b =min(X * ×(1+R),ub) (21),
[0133] Where, X * represents the current local optimal position, lb b andub b represent the lower and upper limits of the optimal foraging area, respectively;
[0134] The position of the dung beetle has been updated as follows:
[0135] x i (t+1)=x i (t)+C 1 ×(x i (t)-lb b )+C 2 ×(x i (t)-ub b ) (twenty two),
[0136] In the formula, C 1 represents a random number that follows a normal distribution, C 2 ∈(0,1) represents a random vector.
[0137] The position of the thief dung beetle is updated as follows:
[0138] x i (t+1)=X * +S×g×(|x i (t)-X B |+|x i (t)-X * | (23),
[0139] 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 the normal distribution, and S represents a constant value.
[0140] S5e, 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 ;
[0141] S5f, by P p Control, perform mutation operation on a certain percentage of individuals: if the random number is less than the initial mutation probability M p, then mutate and update the individual position; otherwise keep it as it is;
[0142] S5g, 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 ;
[0143] S5h, update the current global optimal position x according to the historical best solution i_best And the fitness value f of the best optimal position i_best ;
[0144] S5i, Dynamically adjust the mutation probability: If the fitness value f of the current optimal position i_best The fitness value f is smaller than the optimal position of the previous generation i-1_best , increase the initial mutation probability M p ; If the fitness value of the current optimal position is f i_best The fitness value f is greater than or equal to the optimal position of the previous generation i-1_best , reduce the initial mutation probability M p , the specific implementation method can be adjusted according to the following formula:
[0145]
[0146] S5j, repeat the above steps S5d to S5i until the maximum number of iterations is reached;
[0147] S5k, output the global optimal fitness value and its optimal position.
[0148] 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 initial mutation probability is 0.2, the maximum mutation probability is 0.8, the minimum mutation probability is 0.1, the mutation factor is 0.1, the constant value S is 0.5, and the optimal foraging area of the dung beetle is limited to [0, 1]. The number of variables is reduced from 1999 to 1176.
[0149] S6. 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 near-infrared spectrum calibration model. 2 The root mean square error (RMSE) was used to evaluate the prediction performance of the host near-infrared spectroscopy calibration model on the validation set samples;
[0150] Coefficient of determination R 2 The calculation formula is:
[0151]
[0152] In the formula is the average of the actual values;
[0153] The calculation formula of mean square error RMSE is:
[0154]
[0155] 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.99711, and the RMSE is 0.03405. On the validation set, the R 2 The RMSE is 0.05192 and 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 RMSE is small, which means that the model can accurately predict the concentration or properties of the sample.
[0156] Table 1 Prediction performance of calibration set and validation set samples
[0157]
[0158] S7, using the host near-infrared spectrum correction model established in step S6, 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.
[0159] Table 2 summarizes the effect evaluation of the host calibration set, host validation set, and slave prediction set before and after the model transfer. Before the model transfer, the host calibration set and validation set showed a high determination coefficient R 2 and a smaller root mean square error RMSE, while the performance of the slave prediction set is relatively poor, with a negative R 2 The large RMSE value shows that the prediction effect is poor. After the 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 significantly increased to 0.95426 and RMSE decreased to 0.14129.
[0160] Table 2 Evaluation of the effect of the slave prediction set before and after the model transfer of this method
[0161]
[0162] Therefore, the present invention adopts the above-mentioned hexamethylenetetramine-acetic acid solution near-infrared model transfer method, verifies the model established by the host on the slave machine, evaluates the migration performance of the model on different instruments, ensures the generalization ability and robustness of the model, and stably transfers the hexamethylenetetramine-acetic acid solution near-infrared correction model established based on different near-infrared spectrometers, thereby greatly reducing the waste of manpower, material resources and financial resources caused by repeated modeling, improving the adaptability of the model, and ensuring the reliability and robustness of the hexamethylenetetramine-acetic acid solution near-infrared model on different instruments.
[0163] 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 hexamethylenetetramine-acetic acid solution, characterized in that: Here are the steps: S1. Select and set two near-infrared spectrometers as the master and slave respectively; S2. titrating the urotropine concentration in the urotropine-acetic acid solution by chemical titration to obtain the chemical true value of the urotropine concentration; S3, randomly dividing the spectral matrix of the urotropine-acetic acid solution obtained by the host and the corresponding urotropine chemical true value concentration matrix to obtain calibration set samples and verification set samples; matching the spectral matrix of the urotropine-acetic acid solution obtained by the slave with the corresponding urotropine concentration chemical true value matrix to form a prediction set sample; S4, performing Savitzky-Golay filtering and orthogonal signal correction preprocessing on the spectral matrices of the calibration set samples, the validation set samples and the prediction set samples in step S3; S5, using an adaptive dung beetle hybrid algorithm to perform variable optimization on the spectral matrix of the calibration set samples, and applying the optimized variables to the spectral matrix preprocessed in step S4, to obtain the spectral matrices of the calibration set samples, the validation set samples, and the prediction set samples after variable optimization; S6. 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 near-infrared spectrum calibration model. 2 The root mean square error (RMSE) was used to evaluate the prediction performance of the host near-infrared spectroscopy calibration model on the validation set samples; S7, using the host near-infrared spectrum calibration model established in step S6, 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 S5, the specific steps of the adaptive dung beetle hybrid algorithm are as follows: S5a, initialize the fitness function and define the fitness function as follows: where 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; S5b, initialize the relevant parameters of the adaptive dung beetle hybrid algorithm: set the maximum number of iterations M max , the number of individuals in the population is pop, and the mutation ratio is P p , initial mutation probability M p , maximum mutation probability M p_max , minimum mutation probability M p_min , mutation factor M f , in order to prevent the movement of dung beetles beyond the limit, the best foraging area of dung beetles is limited [lb, ub]; S5c, initialize the population: the position of each individual is randomly generated in the search space; S5d, update the position x of each individual in the population through the behaviors of the rolling ball dung beetle, brood ball, small dung beetle and thief dung beetle i (t); S5e, 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 ; S5f, by P p Control, perform mutation operation on a certain percentage of individuals: if the random number is less than the initial mutation probability M p , then mutate and update the individual position; otherwise keep it as it is; S5g, 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 ; S5h, update the current global optimal position x according to the historical best solution i_best And the fitness value f of the best optimal position i_best ; S5i, Dynamically adjust the mutation probability: If the fitness value f of the current optimal position i_best The fitness value f is smaller than the optimal position of the previous generation i-1_best , increase the initial mutation probability M p ; If the fitness value of the current optimal position is f i_best The fitness value f is greater than or equal to the optimal position of the previous generation i-1_best , reduce the initial mutation probability M p , adjust the initial mutation probability according to the following formula: Where t is the current iteration number; S5j, repeat the above steps S5d to S5i until the maximum number of iterations is reached; S5k, output the global optimal fitness value and its optimal position.
2. The near-infrared model transfer method of a hexamethylenetetramine-acetic acid solution according to claim 1, characterized in that: In step S4, the specific steps of Savitzky-Golay filtering are: Sa1, select the appropriate window width w, polynomial degree p and derivative term d; Sa2, for a given sample x in the calibration set sample spectrum matrix i , construct a design matrix X1, where each row corresponds to the near-infrared spectrum data of a given sample, and each column corresponds to different polynomial degree terms and derivative terms: Where m is the number of data points, and its calculation formula is m = (w-1) / 2; Sa3, use p-1 degree polynomial to fit the data in the window to the matrix X, which is expressed as: AND (2m+1)×1 =x (2m+1)×p ·TO k×1 +E (2m+1)×1 (4), Where Y is the matrix to be solved, A is the fitting parameter matrix, and E is the error matrix; Sa4. Calculate the filter coefficient A' using the least squares method: A'=(X T X) -1 X T Y (5), Sa5, for a given sample x i , use the filter coefficients A' to calculate the output matrix Y' for a given sample after filtering: Y' = XA (6); Sa6. Repeat steps Sa1 to Sa4 to obtain the calibration set sample spectral matrix X1, the validation set sample spectral matrix X2 and the prediction set sample spectral matrix X3 after Savitzky-Golay filtering.
3. The near infrared model transfer method of a hexamethylenetetramine-acetic acid solution according to claim 1, characterized in that: In step S4, the specific steps of orthogonal signal correction are: Sb1, let the chemical true value concentration matrix of the urotropine concentration of the calibration set samples be Y1, the chemical true value concentration matrix of the urotropine concentration of the validation set samples be Y2, and the chemical true value concentration matrix of the urotropine concentration of the prediction set samples be Y3; Sb2, centralize the calibration set sample spectral matrix X1 and the calibration set sample urotropine concentration chemical true value concentration matrix Y1 to obtain the spectral matrix X c and the concentration matrix Y c ; Sb3, in each iteration, the spectral matrix X c Perform singular value decomposition: X c =U∑V T (7), Where U, Σ, and V are the spectral matrices X c The left singular vectors, singular value diagonals and right singular vectors of ; Sb4, initialize the score vector tt: tt = U[:,0]σ0 (8), Where σ0 is the largest singular value; Sb5, orthogonalized score vector t new :t new =(1-Y c (Y c T Y c ) -1 Y c T )·tt (9); Sb6. Calculate the load vector ω: Sb7. Update score vector t2: t2 = X c ×ω(11); Sb8, calculate ||tt-t new || / ||tt|Calculate the convergence accuracy of tt. If it is not satisfied, go to step Sb4; if it is satisfied, proceed to the next step; Sb9. Calculate the load vector P: P = X c T ×tt / (tt T ×tt)(12); Sb10, from the spectrum matrix X c Subtract the correction from the matrix to get the new matrix E e :E e =X c -tt×P T (13); Sb11, the new matrix E e As the next matrix X c , go to step S3 to recalculate tt, P and ω until the iteration is completed, and the final tt, P and ω are recorded as the score vector t e , load vector p e , loading vector ω e Continue to the next step; Sb12, the spectrum matrix X c Projection to the score vector t e Upper: t e =X c ×ω e (14); Sb13, from the spectrum matrix X c Remove the influence of the principal component and obtain the transformed spectral matrix X cnew : X c_new =X c -t e ×p e T (15)。 4. The near-infrared model transfer method of a hexamethylenetetramine-acetic acid solution according to claim 1, characterized in that: In step S6, the determination coefficient R 2 The calculation formula is: In the formula is the average of the actual values; The calculation formula of mean square error RMSE is:
Citation Information
Patent Citations
Method for transferring near infrared model of organic fertilizer product
CN101832922A
Method of analyzing content of urotropine in urotropine-acetic acid solution
CN105866065A