An automatic modeling method for near infrared spectroscopy quantitative analysis

Through automatic modeling methods, including sample classification, spectral preprocessing and wavelength optimization, combined with integrated learning strategies, the problem of difficulty in adjusting the number of singular samples and hidden variables in quantitative analysis of near-infrared spectra is solved, and efficient and accurate model predictions are achieved. Simplifies user operations and is suitable for analysis of complex samples.

CN113607683BActive Publication Date: 2024-09-06TIANJIN JIUGUANG TECH DEV CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202110908214.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-08-09
Publication Date
2024-09-06
Estimated Expiration
2041-08-09

Smart Images

  • Figure CN113607683B
    Figure CN113607683B
Patent Text Reader

Abstract

The present invention provides a chemometric modeling technology in the field of analytical chemistry, and in particular, relates to an automatic modeling method for near-infrared spectral quantitative analysis, collects a certain amount of tested samples, adopts partial least squares regression as a basic multivariate correction method, and utilizes model cluster analysis to eliminate abnormal samples; adopts a sampling algorithm to be divided into a number of training subsets and validation subsets, performs spectral preprocessing for each training subset and validation subset, and optimizes the wavelength using a wavelength quantitative screening algorithm; by establishing a primary candidate model library and a secondary candidate model library, the sub-model is selected to be the best integrated final model library. The beneficial effects of the present invention are that a four-integrated modeling method is adopted, and the user does not need to have a chemometrics knowledge background, there are no parameter items, and it is convenient and simple to start; the prediction model data is accurate and suitable for quantitative analysis of various complex samples.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention belongs to the chemometric modeling technology in the field of analytical chemistry, and in particular relates to an automatic modeling method for near-infrared spectral quantitative analysis. Background Art

[0002] In recent years, near-infrared spectroscopy technology has received attention from the agriculture, petroleum, feed, food, tobacco, pharmaceutical and other industries due to its green, rapid, efficient and suitable for online analysis characteristics, and has been successfully applied to quality analysis and quality control in these industries.

[0003] Near infrared spectroscopy quantitative analysis modeling uses multivariate correction technology, including multivariate linear regression (MLR), principal component regression (PCR), partial least squares regression (PLS), artificial neural network (ANN), support vector regression (SVR) and other methods. Traditional multivariate correction technology usually adopts a one-time modeling strategy, that is, a series of regression models are established using a certain training set, and a model with the best prediction effect is selected from them using cross-validation or other evaluation methods, and then the model is used to predict unknown samples. Among them, PLS, as a classic linear correction technology, is currently the most widely used.

[0004] The common modeling process based on the PLS regression method includes four elements: samples, number of latent variables, spectral preprocessing methods, and wavelength variable screening.

[0005] Samples include two concepts: spectrum and reference value, which can be further refined into spectrum quality, representative sample selection, reference value accuracy and the identification of singular samples derived therefrom. The number of calibration sets in multivariate calibration is not the more the better, but their representativeness is the priority. The construction of a stable chemical model mainly depends on the training set data samples. If the training set data includes some singular samples far away from the main body of the data, they will destroy the entire data structure, thereby affecting the establishment and prediction of the model. Therefore, the diagnosis of singular samples is also a key step in stable chemical modeling.

[0006] For PLS regression, if the number of latent variables is too small, the model will be underfitted, and the deviation of the model will be large; on the contrary, if there are too many latent variables in the model, that is, the model is too complex, overfitting will occur. Although the model fits well, the prediction error will become larger. In order to find a balance point, model verification is particularly important. In the process of establishing a PLS model, the appropriate number of latent variables is crucial to the prediction performance of the model.

[0007] Near-infrared spectral analysis is to extract weak information from a complex background. In addition to the sample's own information, the spectrum collected by the near-infrared spectrometer often contains interference from factors that are irrelevant to the properties of the sample to be tested, such as the state of the sample, light scattering, electrical noise and stray light. These interfering data will cause baseline drift and non-repetitiveness of the near-infrared spectrum.

[0008] Near-infrared spectroscopy reflects the absorption of the harmonics and summed frequencies of the fundamental vibration of molecules. The spectral information is complex, the spectral peaks are wide and overlap seriously. The use of appropriate wavelength variable screening methods can simplify the model and eliminate irrelevant or nonlinear variables, thereby obtaining a more predictive and robust correction model. However, variable selection is an NP problem. As the number of variables increases, the variable space increases exponentially, and finding an optimal variable combination is very challenging.

[0009] For complex analytical systems, when the number of near-infrared spectroscopy modeling samples is small, the modeling of these samples is often only partial samples obtained from the overall sampling of the actual problem. The collected samples are not enough to express the overall information, which can easily lead to overfitting or inaccuracy of the obtained model. Ensemble learning can effectively improve the generalization ability of the model. However, to obtain a good ensemble, the member models should be good and different, that is, the member models should have a certain degree of accuracy and diversity. For homogeneous ensembles, the method to enhance the diversity of member models is generally to introduce randomness in the learning process. The common practice is to perturb data samples, input attributes, output representations, and algorithm parameters.

[0010] At present, popular modeling software in the field of near-infrared spectroscopy requires users to have certain knowledge of chemometrics, and users are required to make various adjustments and optimizations for the above four factors and their combinations. The entire modeling process is time-consuming and labor-intensive, and it is not easy to build a reliable, robust, and high-quality model. Although some chemometrics software has added parameter optimization options to reduce the user's labor intensity, users still face complex parameter selection, abnormal sample elimination, and other issues. These problems have hindered the popularization and promotion of near-infrared spectroscopy analysis technology to a certain extent. Summary of the invention

[0011] In order to solve the above technical problems, the present invention provides a chemometric modeling technology in the field of analytical chemistry, and in particular relates to an automatic modeling method for near-infrared spectroscopy quantitative analysis.

[0012] The technical solution adopted by the present invention is: an automatic modeling method for near infrared spectroscopy quantitative analysis, characterized by comprising the steps of:

[0013] Sample spectrum collection, reference value determination and model cluster analysis;

[0014] Sample classification, spectral preprocessing and wavelength optimization;

[0015] Establish a quantitative sub-model and determine the optimal number of factors in the sub-model;

[0016] Establish a model and add it to the first-level candidate model, select the most preferred model among the first-level candidate models and add it to the second-level candidate model, integrate the preferred models among the second-level candidate models into the final prediction model; predict unknown samples and calculate the final test results.

[0017] Preferably, it is characterized in that: the model cluster analysis removes extremely abnormal samples to obtain clean data.

[0018] Preferably, the sample classification uses Bootstrap or Monte Carlo algorithm to divide it into multiple groups of training subsets and validation subsets.

[0019] Preferably, the spectral preprocessing adopts spectral preprocessing algorithms and combinations thereof.

[0020] Preferably, wavelength variable screening algorithms such as BIPLS, UVE, MCUVE, CARS, RandomFrog, and combinations thereof are used for the wavelength optimization.

[0021] Preferably, partial least squares regression is used as the basic multivariate correction algorithm.

[0022] Preferably, a validation set validation method is used to determine the optimal number of factors for the sub-model. The validation set validation method calculates the prediction residual sum of squares (PRESS, denoted as p) corresponding to each number of factors. i ), find the smallest PRESS (denoted as p min ), calculate the p corresponding to each factor number i / p min (denoted as fvalue i ), calculate the F probability through the F test, find the first F probability less than 0.75, and the corresponding number of factors is the best.

[0023] Preferably, for each sub-model established for each training subset, wavelength combination, and preprocessing method, sub-models corresponding to several different factor numbers adjacent to the optimal factor number are added to the first-level candidate model library.

[0024] Preferably, the first-level candidate model library is sorted from small to large according to RMSRP, and the best sub-models are selected to be added to the second-level candidate model library; the second-level candidate model library is sorted from small to large according to RMSRP, and the best models are selected for integration to establish the final prediction model.

[0025] Preferably, the spectral preprocessing algorithm selects smoothing, derivation, multivariate scattering correction, vector normalization, standard normal variable transformation, mean centering, standardization, etc. and combinations thereof.

[0026] The advantages and positive effects of the present invention are:

[0027] In view of the shortcomings of traditional modeling methods and modeling software, such as many parameters and high requirements for users, an automatic modeling method based on ensemble learning strategy for near-infrared spectroscopy quantitative analysis is proposed. Model cluster analysis is used to eliminate extreme abnormal samples, and Bootstrap or Monte Carlo sampling algorithms are used to divide them into multiple training subsets and validation subsets. Different spectral preprocessing methods are used, and wavelength variable screening methods are used to select wavelengths. Sub-models with different numbers of factors are used as candidate models. The sub-models are perturbed in four aspects, including training samples, preprocessing methods, wavelength variables, and number of factors, to obtain several sub-models, which are sorted from small to large according to RMSEP, and the best sub-models are selected for integration. The results of each model are simply averaged to obtain the final prediction result.

[0028] The four-integrated modeling method does not require users to have a chemometrics knowledge background, does not have any parameters, and is easy to use; the prediction model data is accurate and suitable for quantitative analysis of various complex samples. BRIEF DESCRIPTION OF THE DRAWINGS

[0029] Figure 1 It is a schematic diagram of the process of the present invention;

[0030] Figure 2 is a data graph of the experimental prediction of the cephradine content of the present invention;

[0031] Figure 3 It is a data diagram of the experimental prediction of saline-alkali content of the present invention. DETAILED DESCRIPTION

[0032] The embodiments of the present invention are described below with reference to the accompanying drawings.

[0033] like Figure 1 As shown, the technical solution provided for implementing the present invention includes the following steps:

[0034] 1. Collect a certain number of samples to be tested, collect the near-infrared spectra of the samples, and use conventional methods to determine the reference values ​​of their components or properties;

[0035] 2. Use partial least squares regression as the basic multivariate correction algorithm;

[0036] 3. Use model cluster analysis to remove extreme abnormal samples and obtain clean data;

[0037] 4. Depending on the number of samples, use Bootstrap or Monte Carlo sampling algorithm to divide them into multiple training subsets and validation subsets;

[0038] 5. For each set of training subsets and validation subsets, use different spectral preprocessing algorithms to preprocess the spectra one by one;

[0039] 6. Use wavelength variable screening algorithms such as BIPLS, UVE, MCUVE, CARS, RandomFrog, etc. to optimize the wavelength;

[0040] 7. Using different wavelength combinations in the optimization process, the number of partial least squares factors ranges from 0 to 30 to establish quantitative sub-models;

[0041] 8. Use the validation set validation method to determine the optimal number of factors for the sub-model;

[0042] 9. For each sub-model established for each training subset, each wavelength combination, and each pre-processing method, add the sub-model corresponding to the j factors adjacent to the optimal factor number to the first-level candidate model library;

[0043] 10. Sort the aforementioned first-level candidate models from small to large according to RMSEP, and select the best p models to add to the second-level candidate model library;

[0044]

[0045] m is the number of samples, is the predicted value of the i-th sample, y i is the reference value of the ith sample.

[0046] 11. Sort the RMSEP of the aforementioned secondary candidate models from small to large, select the best k models for integration, and obtain the final prediction model;

[0047] 12. When predicting unknown samples, simply average the prediction results of k models to get the final prediction result.

[0048] The embodiments of the present invention are described in conjunction with the accompanying drawings. Embodiment 1:

[0049] This example uses near infrared spectroscopy data analysis to quickly determine the content of cefradine in cefradine granules. The data set contains 96 samples, and 70% are selected as a training set (68 samples) using the Xu Tong sampling method, and the remaining 30% are used as a test set (28 samples). The specific steps are as follows:

[0050] S1: Model cluster analysis is used to remove extreme abnormal samples, whose serial numbers are: 64, 93.

[0051] S2: Using the Bootstrap sampling method, the training set after removing abnormal samples is divided into 200 corresponding training subsets and validation subsets.

[0052] S3: The spectra were preprocessed by mean centering, first order + mean centering, multivariate scattering correction + mean centering, vector normalization + mean centering, standard normal variable transformation + mean centering, elimination of constant offset + mean centering, subtracting a straight line + mean centering, detrending + mean centering, maximum and minimum normalization + mean centering, standard normal variable transformation + detrending + mean centering, first order derivative + multivariate scattering correction + mean centering, first order derivative + standard normal variable transformation + mean centering, first order derivative + subtracting a straight line + mean centering, first order derivative + vector normalization + mean centering.

[0053] S4: BiPLS algorithm is used to optimize the wavelength; different wavelength combinations are used in the optimization process, and the number of partial least squares factors ranges from 0 to 30 to establish quantitative sub-models;

[0054] S5: Use the validation set validation method to determine the optimal number of factors for the sub-model; for the sub-models established for each training subset, various wavelength combinations, and various pre-processing methods, add the sub-models corresponding to the 5 different numbers of factors that are adjacent to the optimal number of factors to the first-level candidate model library;

[0055] S6: Sort the aforementioned first-level candidate models from small to large according to RMSEP, and select the best 50 models to add to the second-level candidate model library;

[0056] S7: Sort the aforementioned secondary candidate models RMSEP from small to large, select the best 100 models for integration, and obtain the final prediction model;

[0057] S8: Predict the aforementioned 28 test samples and simply average the prediction results of the 100 models to obtain the final prediction result.

[0058] The R2 of the prediction result of this embodiment is 0.99164, and the RMSEP is 0.25099.

[0059] For comparison, we adopted the conventional PLS modeling method, applied different spectral preprocessing methods, selected competitive adaptive reweighted sampling (CARS) as the spectral wavelength variable screening method, established the corresponding model for the training set, used ten-fold cross validation to determine the optimal number of factors, and manually removed obviously abnormal samples. The model was used to predict the above test set, and the prediction results were as follows: Figure 2 shown.

[0060] Embodiment 2:

[0061] This example uses near infrared spectroscopy data analysis to quickly determine the nicotine content in tobacco powder. The data set contains 1000 samples, and the KS sampling method is used to select 80% as the training set (800 samples), and the remaining 20% ​​as the test set (200 samples). The specific steps are as follows:

[0062] S1: Model cluster analysis is used to eliminate extreme abnormal samples, whose serial numbers are: 175, 202, 250, 252, 543, 614, 718, 748, and 816.

[0063] S2: Using the Monte Carlo sampling method, the training set after removing abnormal samples is divided into 100 groups of corresponding training subsets and validation subsets.

[0064] S3: The spectra were preprocessed by mean centering, first order + mean centering, multivariate scattering correction + mean centering, vector normalization + mean centering, standard normal variable transformation + mean centering, elimination of constant offset + mean centering, subtracting a straight line + mean centering, detrending + mean centering, maximum and minimum normalization + mean centering, standard normal variable transformation + detrending + mean centering, first order derivative + multivariate scattering correction + mean centering, first order derivative + standard normal variable transformation + mean centering, first order derivative + subtracting a straight line + mean centering, first order derivative + vector normalization + mean centering.

[0065] S4: BiPLS algorithm is used to optimize the wavelength; different wavelength combinations are used in the optimization process, and the number of partial least squares factors ranges from 0 to 30 to establish quantitative sub-models;

[0066] S5: Use the validation set validation method to determine the optimal number of factors for the sub-model; for the sub-models established for each training subset, various wavelength combinations, and various pre-processing methods, add the sub-models corresponding to the three different numbers of factors that are adjacent to the optimal number of factors to the first-level candidate model library;

[0067] S6: Sort the aforementioned first-level candidate models from small to large according to RMSEP, and select the best 30 models to add to the second-level candidate model library;

[0068] S7: Sort the aforementioned secondary candidate models RMSEP from small to large, select the best 50 models for integration, and obtain the final prediction model;

[0069] S8: Predict the aforementioned 200 test samples and simply average the prediction results of the 50 models to obtain the final prediction result.

[0070] The R2 of the prediction result of this embodiment is 0.99288, and the RMSEP is 0.08793.

[0071] For comparison, we adopted the conventional PLS modeling method, applied different spectral preprocessing methods, selected the backward interval partial least squares method (BiPLS) as the spectral wavelength variable screening method, established the corresponding model for the training set, used ten-fold cross validation to determine the optimal number of factors, and manually removed obviously abnormal samples. The model was used to predict the above test set, and the prediction results were as follows: Figure 3 shown.

[0072] Through the two embodiments of the present invention, it can be seen that the method can achieve good results for both smaller and larger sample sets, and the R2 and RMSEP of the method are better than the results of a single model. More importantly, the method does not require the user to adjust or optimize any parameters, and can be easily applied to WindowsApp; cloud-based automatic modeling based on C / S architecture or B / S architecture; it can also be embedded in the near-infrared big data platform system, and the system automatically updates the model based on certain rules.

[0073] Automatic modeling based on Windows App: The modeling software is deployed to the user's PC. The user only needs to import the spectral data and reference value data, and then complete the model building through one-click operation.

[0074] Cloud-based automatic modeling based on C / S architecture: The client is connected to the server through a local area network, accepts user requests, and makes requests to the server through the network. Using this development method, the processing power of the client PC can be fully utilized. Many tasks can be processed on the client and then submitted to the server, which has raised the processing of near-infrared spectroscopy quantitative analysis to a higher level.

[0075] Cloud-based automatic modeling based on B / S architecture: It has nothing to do with the operating system platform. At any time, any place, and any system, as long as you can use the browser to access the Internet, you can use the terminal of the B / S system. When more system users join, they only need to set up accounts and receive training. It also supports mobile office and distributed office. Each Web server can be connected to the database server in various ways. A large amount of data is actually stored in the database server. Cloud-based automatic modeling can store data on the Internet. In the cloud-based automatic modeling using the B / S architecture, it can be operated anywhere without installing any special software, making the development of near-infrared spectroscopy quantitative analysis more convenient. It does not require staff with knowledge of chemometrics to operate. It is low-cost, easy to maintain, highly distributed, simple to develop, and zero-maintenance on the client side. The system is very easy to expand.

[0076] Embedded near-infrared big data platform system: Make full use of the existing near-infrared big data platform and Internet of Things technology, mark the tested samples that have measured the reference value and upload them to the big data system. The modeling system automatically updates the model based on rules such as sample quantity and time period.

[0077] The embodiments described above are merely illustrative, wherein the cloud-based automatic modeling based on the C / S architecture and the B / S architecture may select some or all of the modules according to actual needs to achieve the purpose of the present embodiment, and ordinary technicians in this field may understand and implement them without creative labor. Through the description of the above implementation methods, technicians in this field may clearly understand that each implementation method may be implemented by software plus a necessary general hardware platform.

[0078] Finally, it should be noted that the embodiments of the present invention are described in detail above, but the contents described are only preferred embodiments of the present invention and cannot be considered to limit the scope of implementation of the present invention. All equivalent changes and improvements made within the scope of the present invention should still fall within the scope of the patent coverage of the present invention.

Claims

1. An automatic modeling method for near infrared spectroscopy quantitative analysis, It is characterized in that Includes steps: S1. Collect near-infrared spectra of test samples and divide the samples into training set and test set; and use model cluster analysis to remove extreme abnormal samples; S2, the training set after removing abnormal samples is divided into several groups of corresponding training subsets and validation subsets by using Bootstrap or Monte Carlo algorithm; S3, for each set of training subsets and validation subsets, respectively, using n spectral preprocessing methods to preprocess the spectra; S4. Optimize the wavelength of the preprocessed spectrum, use different wavelength variables for the training subsets under each preprocessing method, and establish quantitative sub-models with partial least squares factors ranging from 0 to 30; S5. Determine the optimal number of factors of the sub-model using the validation set validation method; add the sub-models corresponding to j different numbers of factors that are adjacent to the optimal number of factors of the different wavelength variable models to the first-level candidate model library; sort the first-level candidate models in the aforementioned first-level candidate model library from small to large according to RMSEP, and select the best p models to add to the second-level candidate model library; S6: Similarly, for each sub-model established for each training subset, each wavelength combination, and each preprocessing method, the sub-models corresponding to j different factor numbers that are adjacent to the best factor numbers of different wavelength variable models are added to the first-level candidate model library, and the best p models are selected and added to the second-level candidate model library; S7: sort the secondary candidate models in the aforementioned secondary candidate model library from small to large according to RMSEP, select the best k models for integration, and obtain the final prediction model; The validation set validation method is used to determine the optimal number of factors for the sub-model. The validation set validation method calculates the prediction residual sum of squares (PRESS, denoted as p) corresponding to each number of factors. i ), find the smallest PRESS (denoted as p min ), calculate the p corresponding to each factor number i / p min (denoted as fvalue i ), calculate the F probability through the F test, find the first F probability less than 0.75, and the corresponding number of factors is the best.

2. The automatic modeling method for near infrared spectroscopy quantitative analysis according to claim 1, It is characterized in that The model cluster analysis removes extremely abnormal samples to obtain clean data.

3. The automatic modeling method for near infrared spectroscopy quantitative analysis according to claim 1, It is characterized in that The spectrum preprocessing adopts spectrum preprocessing algorithms and combinations thereof.

4. The automatic modeling method for near infrared spectroscopy quantitative analysis according to claim 1, It is characterized in that The wavelength preferably adopts one or a combination of the following BIPLS, UVE, MCUVE, CARS, and RandomFrog wavelength screening algorithms.

5. The automatic modeling method for near infrared spectroscopy quantitative analysis according to claim 1, It is characterized in that Partial least squares regression was used as the basic multivariate calibration algorithm.