An automatic modeling method for spectrometer

Through the automatic modeling method, the spectrometer automatically processes data and builds a model, which solves the problems of tedious manual modeling and reliance on professional knowledge in spectral analysis, realizes automatic data screening and parameter optimization, lowers the threshold of professional knowledge, and improves the accuracy of analysis results. Accuracy and convenience.

CN111816262BActive Publication Date: 2024-09-03ZHENGZHOU UNIVERSITY OF LIGHT INDUSTRY
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202010483844.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-06-01
Publication Date
2024-09-03
Estimated Expiration
2040-06-01

AI Technical Summary

Technical Problem

In spectral analysis technology, the existing technology requires professionals to manually build a prediction model, which is cumbersome and not conducive to quick operation by non-professionals. Moreover, the analysis results rely on the accurate establishment of the model and are easily affected by data errors.

Method used

Provide an automatic modeling method for spectrometers. By importing data sets for preprocessing, the model is automatically established, including data normalization, correction and second-order derivation, segmentation of data sets, calculation of weight matrices and regression coefficient matrices, and automatic iterative optimization. , until the error target value is reached, the automatic establishment of the model and parameter optimization are realized.

Benefits of technology

It realizes automatic screening of spectral data and automatic optimization of model parameters, lowers the requirement for professional knowledge, can automatically eliminate erroneous data, improves the accuracy and convenience of analysis results, and promotes the widespread application of spectrometer technology.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN111816262B
    Figure CN111816262B
Patent Text Reader

Abstract

The present invention discloses an automatic modeling method for a spectrometer, comprising the following steps: importing a data set into a spectrometer; preprocessing the spectral data set; preprocessing a chemical truth set; inputting a model control quantity into the spectrometer; and establishing a model. In the present invention, spectral error data can be automatically eliminated without the intervention of professionals. The prediction model of the present invention automatically iterates and optimizes, saves spectral modeling parameters and the calculation coefficient array of the model for use in calculating and outputting analysis results during prediction. The present invention can lower the threshold for professional knowledge required by the spectrometer, facilitate application-end personnel to establish accurate models by themselves, and greatly promote the widespread and convenient use of spectrometer technology. The present invention provides a method for automatically screening and analyzing spectral data and automatically selecting optimal parameters to iteratively optimize spectral modeling, thereby realizing the automatic establishment of a spectrometer model.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention belongs to the technical field of spectrum analysis, and in particular relates to an automatic modeling method for a spectrometer. Background Art

[0002] Spectral analysis technology has expanded from the agricultural products field to the fields of petrochemicals, medicine, biochemistry, tobacco and textiles, and has become the main means of rapid and non-destructive analysis such as quality control, quality analysis and online analysis in developed countries. However, spectral analysis technology requires the establishment of a prediction model of the substance based on samples with known substance content in advance in order to collect spectra of samples with unknown content and then use the model to calculate the content of the substance.

[0003] The accuracy of the analysis results depends on the accurate establishment of the prediction model. To establish an accurate model, professionals usually need to go through key steps such as data screening, modeling method selection, and modeling parameter adjustment based on their experience. The modeling process is cumbersome and not conducive to quick operation by non-professionals. Summary of the invention

[0004] The present invention is proposed to solve the problems existing in the prior art, and its purpose is to provide an automatic modeling method for a spectrometer.

[0005] The technical solution of the present invention is: an automatic modeling method for a spectrometer, comprising the following steps:

[0006] ⅰ. Importing datasets into the spectrometer

[0007] Import the spectral dataset and the corresponding content chemical truth set;

[0008] ii. Preprocessing of spectral dataset

[0009] Calling the spectrum preprocessing process to process the spectrum data set to obtain processed spectrum data;

[0010] iii. Preprocessing of chemical truth sets

[0011] Performing data processing on the chemical truth value set to obtain processed chemical truth value set data;

[0012] ⅳ. Input model control quantity to the spectrometer

[0013] Inputting a modeling control error target value and a cyclic error interval into the spectrometer;

[0014] ⅴ. Build the model

[0015] Receive spectral data, chemical truth set data, modeling control error target value, cyclic error interval, model according to the modeling process, and output the model calculation coefficient array.

[0016] The preprocessing of the spectral data set in step ii includes the following steps:

[0017] First, the spectral data is normalized;

[0018] Then, the normalized data were corrected;

[0019] Finally, the second-order derivative of the corrected data is taken to obtain the processed spectral data.

[0020] In step iii, the chemical truth value set is arranged from small to large.

[0021] The modeling process in step V includes the following steps:

[0022] First, the processed spectral data are arranged in the order of chemical values;

[0023] Then, the chemical truth set is divided into the calibration set Yc i and validation set Yt i , the processed spectral data are divided into the calibration set Fc x and validation set Ft x ;

[0024] Then, the weight matrix of the calibration set spectral data is calculated, and the sub-matrix is ​​obtained according to the weight matrix;

[0025] Then, the load of the calibration set chemical truth set is calculated, and the score factor of the calibration set chemical value is calculated based on the load;

[0026] Afterwards, the loading matrix of the spectral calibration set is calculated;

[0027] Finally, the regression coefficient matrix of the model is calculated.

[0028] In the calculation process of the load matrix, it is necessary to determine whether the error is greater than 1e -8 , if greater than, the scoring factor is used instead of the chemical value.

[0029] After obtaining the regression coefficient matrix, the residual value R of the prediction result of the validation set is calculated according to the regression coefficient. t The residual value R of the prediction result of the calibration set c , if R t If the error is greater than the target control error value, the target control error value is corrected to the difference between the target control error value and the cycle error interval, and the data with an error greater than the corrected target control error value is deleted;

[0030] Combine the spectral data and chemical truth set of the calibration set and the validation set, and re-execute the modeling process until the residual value R is reached. t Less than the control error target value.

[0031] The chemical truth set Yi 'Divided into the calibration set Yc in a 4:1 ratio i and validation set Yt i .

[0032] The beneficial effects of the present invention are as follows:

[0033] In the present invention, spectral error data can be automatically eliminated without the intervention of professionals.

[0034] The prediction model of the present invention automatically cycles through iterative optimization and saves spectrum modeling parameters and a calculation coefficient array of the model for use in calculating and outputting analysis results during prediction.

[0035] The present invention can lower the threshold for professional knowledge required by spectrometers, facilitate application-side personnel to establish accurate models by themselves, and greatly promote the widespread and convenient use of spectrometer technology.

[0036] The present invention provides a method for automatically screening and analyzing spectral data and automatically selecting optimal parameters to iteratively optimize spectral modeling, thereby realizing automatic establishment of a spectrometer model. BRIEF DESCRIPTION OF THE DRAWINGS

[0037] Figure 1 It is a flow chart of the method of the present invention. DETAILED DESCRIPTION

[0038] Hereinafter, the present invention will be described in detail with reference to the accompanying drawings and embodiments:

[0039] like Figure 1 As shown, an automatic modeling method for a spectrometer comprises the following steps:

[0040] ⅰ. Importing datasets into the spectrometer

[0041] Import the spectral dataset and the corresponding content chemical truth set;

[0042] ii. Preprocessing of spectral dataset

[0043] Calling the spectrum preprocessing process to process the spectrum data set to obtain processed spectrum data;

[0044] iii. Preprocessing of chemical truth sets

[0045] Performing data processing on the chemical truth value set to obtain processed chemical truth value set data;

[0046] ⅳ. Input model control quantity to the spectrometer

[0047] Inputting a modeling control error target value and a cyclic error interval into the spectrometer;

[0048] ⅴ. Build the model

[0049] Receive spectral data, chemical truth set data, modeling control error target value, cyclic error interval, model according to the modeling process, and output the model calculation coefficient array.

[0050] The preprocessing of the spectral data set in step ii includes the following steps:

[0051] First, the spectral data is normalized;

[0052] Then, the normalized data were corrected;

[0053] Finally, the second-order derivative of the corrected data is taken to obtain the processed spectral data.

[0054] In step iii, the chemical truth value set is arranged from small to large.

[0055] The modeling process in step V includes the following steps:

[0056] First, the processed spectral data are arranged in the order of chemical values;

[0057] Then, the chemical truth set is divided into the calibration set Yc i and validation set Yt i , the processed spectral data are divided into the calibration set Fc x and validation set Ft x ;

[0058] Then, the weight matrix of the calibration set spectral data is calculated, and the sub-matrix is ​​obtained according to the weight matrix;

[0059] Then, the load of the calibration set chemical truth set is calculated, and the score factor of the calibration set chemical value is calculated based on the load;

[0060] Afterwards, the loading matrix of the spectral calibration set is calculated;

[0061] Finally, the regression coefficient matrix of the model is calculated.

[0062] In the calculation process of the load matrix, it is necessary to determine whether the error is greater than 1e -8 , if greater than, the scoring factor is used instead of the chemical value.

[0063] After obtaining the regression coefficient matrix, the residual value R of the prediction result of the validation set is calculated according to the regression coefficient. t The residual value R of the prediction result of the calibration set c , if R t If the error is greater than the target control error value, the target control error value is corrected to the difference between the target control error value and the cycle error interval, and the data with an error greater than the corrected target control error value is deleted;

[0064] Combine the spectral data and chemical truth set of the calibration set and the validation set, and re-execute the modeling process until the residual value R is reached. t Less than the control error target value.

[0065] The chemical truth set Y i 'Divided into the calibration set Yc in a 4:1 ratio i and validation set Yt i .

[0066] The process of spectral data normalization is as follows:

[0067] Among them, there are M spectra, N wavelengths, i = 1, 2, 3 ... M, j = 1, 2, 3 ... N;

[0068]

[0069]

[0070]

[0071] Data description, where X (i,j) is the spectral data set; B x (i) is the effective value corresponding to each spectrum; is the average value of each spectrum; C x (i, j) are the normalized spectral data.

[0072] The data correction process is as follows:

[0073]

[0074] Use least squares to find a and b

[0075] D x =(C x -a) / b

[0076] Data description, among which, is the normalized spectral average, D x is the spectral data after correction.

[0077] Smoothed second-order derivative of spectral data:

[0078] Input: The fitting series is n, the window is m data length, and m is an odd number greater than n, m = 2 × r + 1. Construct a smooth fitting coefficient vector a = [a0 a1 ... a n-1 ], so that the expression The center data weight factor vector of the least squares solution is w m .

[0079] The spectral correction data D x After smoothing, we get E x :

[0080]

[0081] Then the spectral data E x Take the second-order derivative of the window with m data

[0082]

[0083] The following is an explanation of the automatic establishment of the model with specific formulas:

[0084] Data processing before modeling, input model control error target value Tg, cycle error interval value Δt;

[0085] The chemical truth set Y i Arrange from small to large as Y i ', and the processed spectral data F x Arranged in order of chemical value as F' x . The chemical truth set Y i 'Divided into the calibration set Yc in a 4:1 ratio i and validation set Yt i The corresponding spectral data are also divided into the calibration set Fc x and validation set Ft x

[0086] Start the modeling cycle. The modeling process is:

[0087] S1: Calculate the calibration set spectral data set Fc x The weight matrix W is

[0088] Calculate the score matrix V according to the weight value, V = Fc × W;

[0089] S2: Calculate the load q of the calibration set chemical value, Calculate the scoring factor of the calibration set chemical value according to q

[0090] S3: Judgment error Is it greater than 1e? -8 , if greater than, the score factor is used instead of the chemical value, F c =u, repeat S1-S3 to obtain the weight matrix W and score matrix V of the spectral data set, and calculate the loading matrix P of the calibration set spectral data:

[0091] error Less than 1e -8, then the loop ends and the weight matrix W of the spectral dataset is obtained.

[0092] S4: Calculate the model regression coefficient matrix Z, Calculate the residual value R of the prediction result of the validation set based on the regression coefficient t The residual value R of the prediction result of the calibration set c , R t =|Z×Ft x -Yt|,R c =|Z×Fc x -Yc|.

[0093] If R t If the error target value is greater than the target value Tg, the error target value is corrected to T g '=T g -Δt. The error is greater than T g The spectral data and chemical value data of the calibration set and validation set are deleted.

[0094] Combine the spectral data and chemical value data of the calibration set and the validation set, and repeat the whole process until R t Less than T g .

[0095] Among them, the residual value R t Comparison with the control error target value Tg can automatically eliminate erroneous data.

[0096] The prediction model of the present invention automatically cycles through iterative optimization and saves spectrum modeling parameters and a calculation coefficient array of the model for use in calculating and outputting analysis results during prediction.

[0097] The present invention can reduce the threshold for professional knowledge required by spectrometers, facilitate application-side personnel to establish accurate models by themselves, and greatly promote the extensive and convenient use of spectrometer technology. The present invention provides a method for automatically screening and analyzing spectral data and automatically selecting optimal parameters to iteratively optimize spectral modeling, thereby realizing the automatic establishment of a spectrometer model.

Claims

1. An automatic modeling method for a spectrometer, characterized in that: The following steps are involved: (i) Importing datasets into the spectrometer Import the spectral dataset and the corresponding content chemical truth set; (ii) Preprocessing of spectral dataset Calling the spectrum preprocessing process to process the spectrum data set to obtain processed spectrum data; (iii) Preprocessing the chemical truth set Performing data processing on the chemical truth value set to obtain processed chemical truth value set data; (iv) Inputting model control variables into the spectrometer Input the modeling control error target value T to the spectrometer g and the cyclic error interval value Δt; (v) Model building Receive spectral data, chemical truth set data, modeling control error target value T g , the cyclic error interval value Δt, modeling according to the modeling process, and output the model calculation coefficient array; The preprocessing of the spectral data set in step (ii) includes the following steps: First, the spectral data is normalized; Then, the normalized data were corrected; Finally, the second-order derivative of the corrected data is taken to obtain the processed spectral data; The process of spectral data normalization is as follows: M spectra, N wavelengths, i = 1, 2, 3 ... M, j = 1, 2, 3 ... N; Among them, X (i,j) is the spectral data set; B x (i) is the effective value corresponding to each spectrum; is the average value of each spectrum; C x (i, j) are normalized spectral data; The data correction process is as follows: Use least squares to find a and b D x =(C x -a) / b in, is the normalized spectral average, D x is the corrected spectral data; Smoothed second-order derivative of spectral data: Input: The fitting series is n, the window is m data length, and m is an odd number greater than n, m = 2 × r + 1, and the smooth fitting coefficient vector a = [a0a1...a n-1 ], so that the expression The center data weight factor vector of the least squares solution is w m ; The spectral correction data D x After smoothing, we get E x : Then the spectral data E x Take the second-order derivative of the window with m data After obtaining the regression coefficient matrix, the residual value R of the prediction result of the validation set is calculated according to the regression coefficient. t The residual value R of the prediction result of the calibration set c , if R t Greater than the control error target value T g , then the control error target value is corrected to T g '=T g -Δt, that is, the corrected control error target value T g ' is the control error target value T g The difference between the cycle error interval value Δt, the error is greater than the corrected control error target value T g 'The spectral data and chemical value data of the calibration set and validation set are deleted; Combine the spectral data and chemical value data of the calibration set and the validation set, and re-execute the modeling process until the residual value R t Less than the control error target value T g .

2. The automatic modeling method of a spectrometer according to claim 1, characterized in that: In step (iii), the chemical truth value set is arranged from small to large.

3. The automatic modeling method of a spectrometer according to claim 1, characterized in that: The modeling process in step (v) includes the following steps: First, the processed spectral data are arranged in the order of chemical values; Then, the chemical truth set is divided into the calibration set Yc i and validation set Yt i , the processed spectral data are divided into the calibration set Fc x and validation set Ft x ; Then, the weight matrix of the calibration set spectral data is calculated, and the sub-matrix is ​​obtained according to the weight matrix; Then, the load of the calibration set chemical truth set is calculated, and the score factor of the calibration set chemical value is calculated based on the load; Afterwards, the loading matrix of the spectral calibration set is calculated; Finally, the regression coefficient matrix of the model is calculated.

4. The automatic modeling method of a spectrometer according to claim 1, characterized in that: In the calculation process of the load matrix, it is necessary to determine whether the error is greater than 1e -8 , if greater than, the scoring factor is used instead of the chemical value.

5. The automatic modeling method of a spectrometer according to claim 2, characterized in that: The chemical truth set Y i 'Divided into the calibration set Yc in a 4:1 ratio i and validation set Yt i .