CN111125629B - Domain-adaptive PLS regression model modeling method - Google Patents
Domain-adaptive PLS regression model modeling method Download PDFInfo
- Publication number
- CN111125629B CN111125629B CN201911353268.2A CN201911353268A CN111125629B CN 111125629 B CN111125629 B CN 111125629B CN 201911353268 A CN201911353268 A CN 201911353268A CN 111125629 B CN111125629 B CN 111125629B
- Authority
- CN
- China
- Prior art keywords
- matrix
- domain
- parameter
- adopting
- regression model
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
- 238000010238 partial least squares regression Methods 0.000 title claims abstract description 47
- 238000000034 method Methods 0.000 title claims abstract description 46
- 239000011159 matrix material Substances 0.000 claims abstract description 166
- 238000001228 spectrum Methods 0.000 claims abstract description 51
- 238000002329 infrared spectrum Methods 0.000 claims abstract description 29
- 238000012546 transfer Methods 0.000 claims abstract description 8
- 230000008569 process Effects 0.000 claims abstract description 5
- 230000003595 spectral effect Effects 0.000 claims description 26
- 230000001419 dependent effect Effects 0.000 claims description 25
- 238000004364 calculation method Methods 0.000 claims description 24
- 239000013598 vector Substances 0.000 claims description 23
- 238000005457 optimization Methods 0.000 claims description 18
- 238000012360 testing method Methods 0.000 claims description 9
- 238000002790 cross-validation Methods 0.000 claims description 7
- 238000012545 processing Methods 0.000 claims description 6
- 230000017105 transposition Effects 0.000 claims description 6
- 230000007704 transition Effects 0.000 claims description 3
- 102000008297 Nuclear Matrix-Associated Proteins Human genes 0.000 abstract description 2
- 108010035916 Nuclear Matrix-Associated Proteins Proteins 0.000 abstract description 2
- 210000000299 nuclear matrix Anatomy 0.000 abstract description 2
- 230000003044 adaptive effect Effects 0.000 abstract 1
- 238000013507 mapping Methods 0.000 abstract 1
- 230000003313 weakening effect Effects 0.000 abstract 1
- 238000005516 engineering process Methods 0.000 description 4
- 238000004497 NIR spectroscopy Methods 0.000 description 2
- 238000004458 analytical method Methods 0.000 description 2
- 230000008859 change Effects 0.000 description 2
- 238000001514 detection method Methods 0.000 description 2
- 238000011160 research Methods 0.000 description 2
- 238000002835 absorbance Methods 0.000 description 1
- 230000032683 aging Effects 0.000 description 1
- 230000000694 effects Effects 0.000 description 1
- 238000007689 inspection Methods 0.000 description 1
- 238000013178 mathematical model Methods 0.000 description 1
- 238000012795 verification Methods 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F17/00—Digital computing or data processing equipment or methods, specially adapted for specific functions
- G06F17/10—Complex mathematical operations
- G06F17/16—Matrix or vector computation, e.g. matrix-matrix or matrix-vector multiplication, matrix factorization
-
- G—PHYSICS
- G01—MEASURING; TESTING
- G01N—INVESTIGATING OR ANALYSING MATERIALS BY DETERMINING THEIR CHEMICAL OR PHYSICAL PROPERTIES
- G01N21/00—Investigating or analysing materials by the use of optical means, i.e. using sub-millimetre waves, infrared, visible or ultraviolet light
- G01N21/17—Systems in which incident light is modified in accordance with the properties of the material investigated
- G01N21/25—Colour; Spectral properties, i.e. comparison of effect of material on the light at two or more different wavelengths or wavelength bands
- G01N21/31—Investigating relative effect of material at wavelengths characteristic of specific elements or molecules, e.g. atomic absorption spectrometry
- G01N21/35—Investigating relative effect of material at wavelengths characteristic of specific elements or molecules, e.g. atomic absorption spectrometry using infrared light
- G01N21/359—Investigating relative effect of material at wavelengths characteristic of specific elements or molecules, e.g. atomic absorption spectrometry using infrared light using near infrared light
Landscapes
- Physics & Mathematics (AREA)
- Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Mathematical Physics (AREA)
- Spectroscopy & Molecular Physics (AREA)
- Theoretical Computer Science (AREA)
- Data Mining & Analysis (AREA)
- Pure & Applied Mathematics (AREA)
- Mathematical Optimization (AREA)
- Mathematical Analysis (AREA)
- Computational Mathematics (AREA)
- Biochemistry (AREA)
- Algebra (AREA)
- Computing Systems (AREA)
- Immunology (AREA)
- General Health & Medical Sciences (AREA)
- Analytical Chemistry (AREA)
- Chemical & Material Sciences (AREA)
- Pathology (AREA)
- Life Sciences & Earth Sciences (AREA)
- Databases & Information Systems (AREA)
- Software Systems (AREA)
- General Engineering & Computer Science (AREA)
- Health & Medical Sciences (AREA)
- Complex Calculations (AREA)
Abstract
The invention discloses a domain-adaptive PLS regression model modeling method, which comprises the steps of constructing an original domain spectrum centering matrix by adopting near infrared spectrum data acquired from an original domain, constructing a target domain spectrum centering matrix by adopting near infrared spectrum data acquired from a target domain, eliminating the mean difference of spectra of the original domain and the target domain, finding out the optimal projection direction from the original domain spectrum centering matrix and the target domain spectrum centering matrix by adopting a mode of mapping a transfer matrix to a nuclear matrix space based on the original domain spectrum centering matrix and the target domain spectrum centering matrix, determining an optimal projection matrix, constructing and obtaining a final PLS regression model based on the optimal projection matrix, and weakening the projection scores among different domains and the non-independence of domain labels; the method has the advantages that the difference of collected near-infrared spectrum data under different domains is eliminated by adopting a domain adaptive algorithm, and concentration information of a target domain sample is not required to be collected, so that the modeling process is simplified, and the constructed PLS regression model has good prediction precision on the near-infrared spectrum data of the target domain.
Description
Technical Field
The invention relates to a modeling method of a PLS regression model, in particular to a domain-adaptive modeling method of the PLS regression model.
Background
The near infrared spectrum technology is a simple, rapid and reliable detection technology. The method comprehensively utilizes the research results of multiple subjects such as a spectrum technology, a computer technology, a mode recognition and the like, is increasingly widely applied in multiple fields by using the unique advantages of the research results, and is gradually accepted by the public and officially approved. Near infrared spectroscopy is an indirect analysis method, and a regression model reflecting the relationship between near infrared spectroscopy data and the property of a sample to be analyzed is often required to be constructed. Among them, a Partial Least Squares (PLS) regression model is the most commonly used multiple regression model. The PLS can eliminate noise information in the spectrum matrix and the concentration matrix, and a good prediction effect is obtained.
The modeling method of the existing Partial Least Squares (PLS) regression model in near infrared spectrum analysis comprises the following steps: the method comprises the steps of firstly, collecting near infrared spectrum data and concentration data of a standard sample to construct a corresponding near infrared spectrum data matrix and a concentration vector, then decomposing the near infrared spectrum matrix, determining the optimal principal component number of the near infrared spectrum matrix through a cross verification method, and finally establishing a mathematical model relation between the near infrared spectrum matrix and the concentration vector by utilizing a Partial Least Squares (PLS) regression method.
The conventional Partial Least Squares (PLS) regression model modeling method based on near infrared spectral data requires the acquisition of near infrared spectral data and concentration data of a standard sample. However, with the complication of the application scenario of the near infrared spectrum, the situation that the detection condition or the apparatus itself changes, such as the temperature/humidity change of the sample inspection, the change of the sample form, the aging of the apparatus, and the replacement of accessories, is often encountered, and at this time, the near infrared spectrum data of the collected standard sample often generates absorbance difference and wavelength drift, so that the prediction result of the Partial Least Squares (PLS) regression model constructed based on the data of the original domain (source domain, corresponding to the near infrared spectrum data collected under the condition 1 state) to the data of the target domain (target domain, corresponding to the near infrared spectrum data collected under the condition 2 state) has a large deviation.
Disclosure of Invention
The technical problem to be solved by the invention is to provide a domain-adaptive PLS regression model modeling method, which does not need to acquire concentration information of a target domain sample, simplifies the modeling process, and eliminates the difference of acquired near-infrared spectrum data in different domains by adopting a domain-adaptive algorithm, so that the constructed PLS regression model has good prediction precision on the near-infrared spectrum data of the target domain.
The technical scheme adopted by the invention for solving the technical problems is as follows: a domain-adaptive PLS regression model modeling method comprises the following steps:
step 1, acquiring ns near-red spectrum samples from an original domain, wherein ns is an integer greater than or equal to 5, and constructing by adopting the ns near-red spectrum samples to obtain an original domain near-infrared spectrum data set { x [) sq ,y sq | q =1,2, \8230;, ns }, where x is sq Near-red spectral data for the q sample taken from the original domain, y sq The concentration attribute value of the q sample obtained from the original domain;
acquiring nt near-red spectrum samples from a target domain, wherein nt is an integer greater than or equal to 5, and constructing by adopting the nt near-red spectrum samples to obtain a target domain near-infrared spectrum data set { x tj L j =1,2, \8230 |, nt }, where x tj Is the near infrared spectral data of the jth sample obtained from the target domain; x is the number of sq And x tj Are vectors of 1 row and p columns respectively, and p is collected near-red spectral data x of an original domain sq And target domain near infrared spectral data x tj The number of wavebands of the spectroscopic instrument used;
step 2, adopting near-red spectral data x in the original domain near-infrared spectral data set s1 ~x sns Constructing to obtain an original domain spectrum matrix X,the original domain spectrum matrix X is subjected to centering processing to obtain an original domain spectrum centering matrix, and the method specifically comprises the following steps: calculating the mean value of all data in each row in X, and then subtracting the mean value of all data in the row from each column of data in each row in X to obtain an original domain spectrum centering matrix X s ;
Near-red spectral data x in target domain near-infrared spectral data set t1 ~x snt Constructing to obtain a target domain spectrum matrix S,the method comprises the following steps of performing centering processing on a target domain spectrum matrix S to obtain a target domain spectrum centering matrix, and specifically comprises the following steps: calculating the average value of all data in each line in S, and then, calculating the number of lines in SSubtracting the average value of all the data of the row from each line of data to obtain a target domain spectrum centering matrix X t ;
Concentration attribute value y in near infrared spectrum data set of original domain s1 ~y sns Constructing to obtain an original domain concentration vector Y,
step 3, designing a kernel function, and recording the kernel functions of the vector x and the vector y as k (x, y), wherein the k (x, y) is expressed by a formula (1):
in the formula (1), exp represents an exponential function with a natural logarithm as a base number, | | | | | represents an Euclidean distance between x and y, D represents a kernel parameter, the kernel matrixes corresponding to the two matrixes can be calculated by using the formula (1) and the conventional kernel matrix calculation method, and the kernel matrixes corresponding to the two matrixes Q and D obtained by calculation by using the formula (1) and the conventional kernel matrix calculation method are marked as K (Q, D);
step 4, constructing a category label matrix with m + n rows and m + n columns, wherein m = nt and n = ns, and recording the category label matrix as L, wherein L is expressed by adopting a formula (2):
step 5, constructing a transfer matrix, and recording the transfer matrix as X st ,X st Expressed by formula (3):
X st =[X s →X t ] (3)
wherein, X s →X t Representation matrix X s And X t The data in (1) are connected longitudinally in rows;
and 6, constructing an intermediate matrix, and recording the intermediate matrix as H, wherein the H is expressed by a formula (4):
where v is the transition matrix X st Number of rows of (I) v×v For a unitary diagonal matrix containing v rows and v columns of elements, 1 v Representing a column vector containing v columns of elements and all elements being 1, the superscript T representing the transpose of the matrix,/representing the division operation sign;
step 7, setting parameter optimization interval d of parameters d, r and A, wherein the parameter optimization interval d belongs to [10 ] -5 ,10 -4 ,…10 4 ,10 5 ],r∈[10 -5 ,10 -4 ,…10 4 ,10 5 ],A∈[1,2,…14,15]Constructing a parameter set [ d, r, A ]]Combining all parameters in the parameter optimization interval of d, r and A to obtainA parameter set [ d, r, A];
Step 8, setting a projection matrix W, and comparing the projection matrix W obtained in step 7Individual parameter set [ d, r, A]Each parameter set [ d, r, A ] in]Calculating the projection matrix W corresponding to each parameter set by respectively adopting a grid optimization method to obtain ^ greater than or equal to>The projection matrix W comprises the following specific processes:
a. judging whether A is equal to 1, and according to the judgment result, performing the following operations:
if A is equal to 1, the following steps are carried out:
a1-1, setting an intermediate parameter KS 1 、Y 1 、KT 1 And B 1 Respectively calculating by using formulas (5) to (8) to obtain an intermediate parameter KS 1 、Y 1 、KT 1 And B 1 :
KS 1 =K(X s ,X s ) (5)
Y 1 =Y (6)
KT 1 =K(X st ,X s ) (7)
In the formula (8), the upper corner symbol T represents matrix transposition, K (X) s ,X s ) Representation matrix X s And matrix X s The corresponding kernel matrix is obtained by calculation by adopting the formula (1) and the conventional kernel matrix calculation method, and K (X) st ,X s ) Representation matrix X st And matrix X s The corresponding kernel matrix is obtained by calculation by adopting a formula (1) and the conventional kernel matrix calculation method;
a1-2, setting an intermediate parameter w 1 A1 to B 1 The eigenvector corresponding to the largest eigenvalue of (a) is assigned to w 1 ;
a1-3, mixing w 1 As using the current parameter set [ d, r, A]Calculating to obtain a projection matrix W;
if A is not equal to 1, the following steps are carried out:
a2-1, calculating according to the step a1-1 to obtain an intermediate parameter KS 1 、Y 1 、KT 1 And B 1 ;
a2-2, obtaining an intermediate parameter w by adopting the method of the step a1-2 1 The intermediate parameter w 1 As the 1 st generation projection matrix, finishing the 1 st generation assignment of the projection matrix;
a2-3, setting an intermediate parameter t1 1 、t2 1 、p1 1 、p2 1 And c 1 Calculating to obtain an intermediate parameter t1 by using the formulas (9) to (13) 1 、t2 1 、p1 1 、p2 1 And c 1 :
t1 1 =KS 1 w 1 (9)
t2 1 =KT 1 w 1 (10)
Wherein, the upper corner mark-1 represents matrix inversion, and the upper corner mark T represents the transposition of the matrix;
a2-4, setting an algebraic variable i, initializing i, and enabling i to be equal to 2;
a2-5, carrying out ith generation assignment on the projection matrix, specifically:
s1, setting an intermediate parameter KS i 、KT i 、Y i And B i Calculating the intermediate parameter KS by using the formula (14) to the formula (17) i 、KT i 、Y i And B i :
Y i =Y i-1 -c i t1 i-1 (16)
S2, setting an intermediate parameter w i A1 to B i The eigenvector corresponding to the largest eigenvalue of (a) is assigned to w i W is to be i As the ith generation projection matrix, finishing the ith generation assignment of the projection matrix;
s3, setting an intermediate parameter t1 i 、t2 i 、p1 i 、p2 i And c i Calculating to obtain the intermediate parameter t1 by adopting the formulas (18) to (22) i 、t2 i 、p1 i 、p2 i And c i c 1 :
t1 i =KS i w i (18)
t2 i =KT i w i (19)
S4, judging whether the value of i is equal to A or not, if not, adding 1 to the current value of i and updating the value of i, returning to the step S1 to carry out next generation assignment of the projection matrix, and if the value of i is equal to A, entering the step a2-6;
step a2-6, obtaining w 1 To w A After being connected in sequence and transversely according to columns, the parameter group [ d, r, A ] at this time is used]Calculated projection matrix, W = [ W = 1 ,…,w A ];
Step 9, setting an intermediate variable T s And T t The product obtained in step 8The projection matrixes W are respectively substituted into formulas (23) and (24) to be calculated, and the result is ^ greater or less than or equal to>An intermediate variable T s And &>An intermediate variable T t :
T s =K(X s ,X s )W (23)
T t =K(X xt ,X s )W (24)
Step 10, obtaining step 9An intermediate variable T s Respectively as independent variable and Y as dependent variable to obtainAnd the data matrix is composed of independent variables and dependent variables.
Step 11, constructing a PLS regression model by a 5-fold cross validation method to obtainThe PLS regression model specifically comprises: will adopt>An intermediate variable T s Based on a dependent variable Y>The data matrix composed of independent variables and dependent variables is divided into 5 parts at random, and 4 parts are selected at random and constructed by adopting a cross validation method to obtainA PLS regression model;
step 12, the product obtained in step 9An intermediate variable T t Combined as test data with the argument in the remaining part 1 as argument for the->Testing each PLS regression model for 4 times in succession to obtain the prediction result in the dependent variable Y of each PLS regression model>And X t Prediction result of the corresponding dependent variable>Wherein the predicted result->Derived by an argument in the remaining 1 part, prediction result->By means of intermediate variables T as arguments t Obtaining;
step 13, defining a PLS regression model optimization objective function, wherein the optimization objective function is expressed by an equation (25):
in the formula (25), mean represents the Mean value of the solved vector, std represents the standard deviation of the solved vector, and | represents the symbol of taking the absolute value;
step 14, the dependent variable Y and the prediction result corresponding to each PLS regression modelAnd prediction result>Respectively substituting the values into an equation (25) for calculation to obtain the value of f corresponding to each PLS regression model;
step 15, comparing all the values of f obtained in step 14, and corresponding the f with the minimum value to a group [ d, r, A ]]Calculating to obtain a corresponding projection matrix by adopting the method of the step 8, and taking the projection matrix as an optimal projection matrix and marking as W op Setting the optimum independent variable and marking it as T sop By means of T sop =K(X s ,X s )W op Calculating to obtain T sop In terms of T sop A final PLS regression model was constructed with Y as the dependent variable.
Compared with the prior art, the method has the advantages that the original domain spectrum centering matrix is constructed by adopting the near infrared spectrum data acquired from the original domain, the target domain spectrum centering matrix is constructed by adopting the near infrared spectrum data acquired from the target domain, the mean difference of the original domain spectrum and the target domain spectrum is eliminated, then the optimal projection direction is found out by adopting the mode that the transfer matrix is mapped to the nuclear matrix space based on the original domain spectrum centering matrix and the target domain spectrum centering matrix, the optimal projection matrix is determined, the final PLS regression model is constructed based on the optimal projection matrix, and therefore the projection scores and the non-independence of domain labels between different domains are weakened.
Detailed Description
The present invention will be described in further detail with reference to examples.
The embodiment is as follows: a domain-adaptive PLS regression model modeling method comprises the following steps:
step 1, acquiring ns near-red light spectrum samples from an original domain, wherein ns is an integer greater than or equal to 5, and constructing by adopting the ns near-red light spectrum samples to obtain an original domain near-infrared spectrum data set { x } sq ,y sq | q =1,2, \8230;, ns }, where x is sq Near-red spectral data for the q sample taken from the original domain, y sq The concentration attribute value of the q sample obtained from the original domain;
acquiring nt near-red spectrum samples from a target domain, wherein nt is an integer greater than or equal to 5, and constructing by adopting the nt near-red spectrum samples to obtain a target domain near-infrared spectrum data set { x [) tj L j =1,2, \8230;, nt }, where x tj Is the near infrared spectral data of the jth sample obtained from the target domain; x is the number of sq And x tj Respectively 1 row and p columns of vectors, p is the collected near-red spectral data x of the original domain sq And target domain near infrared spectral data x tj To makeThe number of bands of the spectroscopic instrument used;
step 2, adopting near-red spectral data x in the original domain near-infrared spectral data set s1 ~x sns Constructing to obtain an original domain spectrum matrix X,the original domain spectrum matrix X is subjected to centering processing to obtain an original domain spectrum centering matrix, and the method specifically comprises the following steps: calculating the mean value of all data in each row in X, and then subtracting the mean value of all data in the row from each column of data in each row in X to obtain an original domain spectrum centering matrix X s ;
Near-red spectral data x in target domain near-infrared spectral data set t1 ~x snt Constructing and obtaining a target domain spectrum matrix S,the method comprises the following steps of performing centering processing on a target domain spectrum matrix S to obtain a target domain spectrum centering matrix, and specifically comprises the following steps: calculating the mean value of all data in each row in the S, and then subtracting the mean value of all data in each row from each line of data in each row in the S to obtain a target domain spectrum centering matrix X t ;/>
Concentration attribute value y in original domain near infrared spectrum data set s1 ~y sns Constructing to obtain an original domain concentration vector Y,
step 3, designing a kernel function, and marking the kernel functions of the vector x and the vector y as k (x, y), wherein the k (x, y) is expressed by a formula (1):
in the formula (1), exp represents an exponential function with a natural logarithm as a base number, | | | | | represents an Euclidean distance between x and y, D represents a kernel parameter, the kernel matrixes corresponding to the two matrixes can be calculated by using the formula (1) and the conventional kernel matrix calculation method, and the kernel matrixes corresponding to the two matrixes Q and D obtained by calculation by using the formula (1) and the conventional kernel matrix calculation method are marked as K (Q, D);
step 4, constructing a category label matrix with m + n rows and m + n columns, wherein m = nt and n = ns, and recording the category label matrix as L, wherein L is expressed by adopting a formula (2):
step 5, constructing a transfer matrix, and marking the transfer matrix as X st ,X st Expressed by formula (3):
X st =[X s →X t ] (3)
wherein, X s →X t Representation matrix X s And X t The data in (1) are connected longitudinally in rows;
and 6, constructing an intermediate matrix, and recording the intermediate matrix as H, wherein the H is expressed by a formula (4):
where v is the transition matrix X st Number of rows of (I) v×v For a unity diagonal matrix containing v rows and v columns of elements, 1 v Representing a column vector containing v columns of elements, all the elements being 1, the superscript T representing the transpose of the matrix,/representing a division operator;
step 7, setting parameter optimization interval d of parameters d, r and A, wherein the parameter optimization interval d belongs to [10 ] -5 ,10 -4 ,…10 4 ,10 5 ],r∈[10 -5 ,10 -4 ,…10 4 ,10 5 ],A∈[1,2,…14,15]Constructing a parameter set [ d, r, A ]]Combining all parameters in the parameter optimization interval of d, r and A to obtainIndividual parameter set [ d, r, A];
Step 8, setting a projection matrix W, for the stepObtained in step 7Individual parameter set [ d, r, A]Each parameter set [ d, r, A ] in]Calculating projection matrix W corresponding to each parameter set by respectively adopting a grid optimization method to obtain->The projection matrix W comprises the following specific processes:
a. judging whether A is equal to 1, and according to the judgment result, performing the following operations:
if A is equal to 1, the following steps are carried out:
a1-1, setting an intermediate parameter KS 1 、Y 1 、KT 1 And B 1 Respectively calculating by using formulas (5) to (8) to obtain an intermediate parameter KS 1 、Y 1 、KT 1 And B 1 :
KS 1 =K(X s ,X s ) (5)
Y 1 =Y (6)
KT 1 =K(X st ,X s ) (7)
In the formula (8), the upper corner mark T represents matrix transposition, K (X) s ,X s ) Representation matrix X s And matrix X s The corresponding kernel matrix is obtained by calculation by adopting the formula (1) and the conventional kernel matrix calculation method, and K (X) st ,X s ) Representation matrix X st And matrix X s The corresponding kernel matrix is obtained by calculation by adopting a formula (1) and the conventional kernel matrix calculation method;
a1-2, setting an intermediate parameter w 1 B is to be 1 The eigenvector corresponding to the largest eigenvalue of (a) is assigned to w 1 ;
a1-3, mixing w 1 As using the current parameter set [ d, r, A]Calculating to obtain a projection matrix W;
if A is not equal to 1, the following steps are carried out:
a2-1, calculating according to the step a1-1 to obtain an intermediate parameter KS 1 、Y 1 、KT 1 And B 1 ;
a2-2, obtaining the intermediate parameter w by adopting the method of the step a1-2 1 The intermediate parameter w 1 As the 1 st generation projection matrix, finishing the 1 st generation assignment of the projection matrix;
a2-3, setting an intermediate parameter t1 1 、t2 1 、p1 1 、p2 1 And c 1 Calculating to obtain an intermediate parameter t1 by using the formulas (9) to (13) 1 、t2 1 、p1 1 、p2 1 And c 1 :
t1 1 =KS 1 w 1 (9)
t2 1 =KT 1 w 1 (10)
Wherein, the upper corner mark-1 represents matrix inversion, and the upper corner mark T represents the transposition of the matrix;
a2-4, setting an algebraic variable i, initializing i, and enabling i to be equal to 2;
a2-5, carrying out ith generation assignment on the projection matrix, specifically:
s1, setting an intermediate parameter KS i 、KT i 、Y i And B i Calculating by using the formulas (14) to (17) to obtain an intermediate parameter KS i 、KT i 、Y i And B i :
Y i =Y i-1 -c i t1 i-1 (16)
S2, setting an intermediate parameter w i A1 to B i The eigenvector corresponding to the largest eigenvalue of (a) is assigned to w i W is to be i As the ith generation projection matrix, finishing the ith generation assignment of the projection matrix;
s3, setting an intermediate parameter t1 i 、t2 i 、p1 i 、p2 i And c i Calculating intermediate parameter t1 by using equations (18) to (22) i 、t2 i 、p1 i 、p2 i And c i c 1 :
t1 i =KS i w i (18)
t2 i =KT i w i (19)
S4, judging whether the value of i is equal to A or not, if not, adding 1 to the current value of i and updating the value of i, returning to the step S1 to carry out next generation assignment of the projection matrix, and if the value of i is equal to A, entering the step a2-6;
step a2-6, obtaining w 1 To w A After being connected in series and transversely, the parameter group [ d, r, A ] of this time is used]Calculated projection matrix, W = [) 1 ,…,w A ];
Step 9, setting an intermediate variable T s And T t The product obtained in step 8The projection matrixes W are respectively substituted into formulas (23) and (24) to be calculated, and the result is ^ greater or less than or equal to>An intermediate variable T s And &>An intermediate variable T t :
T s =K(X s ,X s )W (23)
T t =K(X xt ,X s )W (24)
Step 10, obtaining step 9An intermediate variable T s Respectively as independent variable and Y as dependent variable to obtainAnd the data matrix is composed of independent variables and dependent variables.
Step 11, constructing a PLS regression model by a 5-fold cross validation method to obtainThe PLS regression model specifically comprises: will adopt>An intermediate variable T s Obtained respectively as independent variable and Y as dependent variable>The data matrix composed of independent variables and dependent variables is divided into 5 parts at random, 4 parts are randomly selected and constructed by adopting a cross validation method to obtainA PLS regression model; the 5-fold cross validation method is one of the current mature methods for constructing the PLS regression model;
step 12, the product obtained in step 9An intermediate variable T t Combined as test data with the argument in the remaining part 1 as argument for the->Testing the PLS regression models for 4 times to obtain the prediction result of the dependent variable Y of each PLS regression model>And X t Prediction result of the corresponding dependent variable>Wherein the prediction result +>The prediction result is obtained by the argument in the remaining part 1, the prediction result->By means of intermediate variables T as arguments t Obtaining;
step 13, defining a PLS regression model optimization objective function, wherein the optimization objective function is expressed by an equation (25):
in the formula (25), mean represents the Mean value of the vector, std represents the standard deviation of the vector, and | | represents the symbol of taking the absolute value;
step 14, the dependent variable Y and the prediction result corresponding to each PLS regression model are calculatedAnd predicting a result->Respectively substituting into an equation (25) for calculation to obtain a value of f corresponding to each PLS regression model;
step 15, comparing all the values of f obtained in step 14, and corresponding the f with the minimum value to a group [ d, r, A ]]Calculating to obtain a corresponding projection matrix by adopting the method of the step 8, and taking the projection matrix as an optimal projection matrix and marking as W op Setting the optimum independent variable and marking it as T sop By means of T sop =K(X s ,X s )W op Calculating to obtain T sop With T sop A final PLS regression model was constructed with Y as the dependent variable.
When the domain self-adaptive PLS regression model modeling method is adopted to test the test sample, the corresponding near infrared spectrum x of the test sample is obtained t X is to t As a one-dimensional matrix, an independent variable parameter T is set t By using T t =K(x t ,X s )W op Calculating to obtain T t Then T is added t Substituting the constructed PLS model as an independent variable to obtain x t The predicted result of the corresponding dependent variable.
Claims (1)
1. A domain-adaptive PLS regression model modeling method is characterized by comprising the following steps:
step 1, acquiring ns near-red spectrum samples from an original domain, wherein ns is an integer greater than or equal to 5, and constructing by adopting the ns near-red spectrum samples to obtain an original domain near-infrared spectrum data set { x [) sq ,y sq | q =1,2, \8230;, ns }, where x is sq Near-red spectral data for the q sample taken from the original domain, y sq The concentration attribute value of the q sample obtained from the original domain;
acquiring nt near-red spectrum samples from a target domain, wherein nt is an integer greater than or equal to 5, and constructing by adopting the nt near-red spectrum samples to obtain a target domain near-infrared spectrum data set { x [) tj L j =1,2, \8230;, nt }, where x tj Is the near infrared spectral data of the jth sample obtained from the target domain; x is the number of sq And x tj Are vectors of 1 row and p columns respectively, and p is collected near-red spectral data x of an original domain sq And target domain near infrared spectral data x tj The number of wavebands of the spectroscopic instrument used;
step 2, adopting near-red spectral data x in the original domain near-infrared spectral data set s1 ~x sns Constructing to obtain an original domain spectrum matrix X,the original domain spectrum matrix X is subjected to centering processing to obtain an original domain spectrum centering matrix, and the method specifically comprises the following steps: calculating the mean value of all data in each row in X, and then subtracting the mean value of all data in the row from each column of data in each row in X to obtain an original domain spectrum centering matrix X s ;
Near-red spectral data x in target domain near-infrared spectral data set t1 ~x snt Constructing and obtaining a target domain spectrum matrix S,the method comprises the following steps of performing centering processing on a target domain spectrum matrix S to obtain a target domain spectrum centering matrix, and specifically comprises the following steps: calculating the mean value of all data in each row in the S, and then subtracting the mean value of all data in each row from each line of data in each row in the S to obtain a target domain spectrum centering matrix X t ;
Concentration attribute value y in near infrared spectrum data set of original domain s1 ~y sns Constructing to obtain an original domain concentration vector Y,
step 3, designing a kernel function, and marking the kernel functions of the vector x and the vector y as k (x, y), wherein the k (x, y) is expressed by a formula (1):
in the formula (1), exp represents an exponential function with a natural logarithm as a base number, | | | | | represents an Euclidean distance between x and y, D represents a kernel parameter, the kernel matrixes corresponding to the two matrixes can be calculated by using the formula (1) and the conventional kernel matrix calculation method, and the kernel matrixes corresponding to the two matrixes Q and D obtained by calculation by using the formula (1) and the conventional kernel matrix calculation method are marked as K (Q, D);
step 4, constructing a category label matrix with m + n rows and m + n columns, wherein m = nt, n = ns, and recording the category label matrix as L, wherein L is expressed by adopting a formula (2):
step 5, constructing a transfer matrix, and marking the transfer matrix as X st ,X st Expressed by formula (3):
X st =[X s →X t ] (3)
wherein, X s →X t Representation matrix X s And X t The data in (2) are connected longitudinally in rows;
and 6, constructing an intermediate matrix, and recording the intermediate matrix as H, wherein the H is expressed by a formula (4):
where v is the transition matrix X st Number of lines of (I) v×v For a unitary diagonal matrix containing v rows and v columns of elements, 1 v Representing a column vector containing v columns of elements, all elements being 1, with superscriptsT represents the transpose of the matrix,/represents the division operation symbol;
step 7, setting parameter optimization interval d of parameters d, r and A, wherein the parameter optimization interval d belongs to [10 ] -5 ,10 -4 ,…10 4 ,10 5 ],r∈[10 -5 ,10 -4 ,…10 4 ,10 5 ],A∈[1,2,…14,15]Constructing the parameter set [ d, r, A ]]Combining all parameters in the parameter optimization interval of d, r and A to obtainA parameter set [ d, r, A];
Step 8, setting a projection matrix W, and comparing the projection matrix W obtained in step 7A parameter set [ d, r, A]Each parameter set [ d, r, A ] in]Calculating the projection matrix W corresponding to each parameter set by respectively adopting a grid optimization method to obtain ^ greater than or equal to>The projection matrix W comprises the following specific processes:
a. judging whether A is equal to 1, and according to the judgment result, performing the following operations:
if A is equal to 1, the following steps are carried out:
a1-1, setting an intermediate parameter KS 1 、Y 1 、KT 1 And B 1 Respectively calculating by using formulas (5) to (8) to obtain an intermediate parameter KS 1 、Y 1 、KT 1 And B 1 :
KS 1 =K(X s ,X s ) (5)
Y 1 =Y (6)
KT 1 =K(X st ,X s ) (7)
In the formula (8), the upper corner symbol T represents matrix transposition, K (X) s ,X s ) Representation matrix X s And matrix X s The corresponding kernel matrix is obtained by calculation by adopting the formula (1) and the conventional kernel matrix calculation method, and K (X) st ,X s ) Representation matrix X st And matrix X s The corresponding kernel matrix is obtained by calculation by adopting a formula (1) and the conventional kernel matrix calculation method;
a1-2, setting an intermediate parameter w 1 A1 to B 1 Is assigned to w 1 ;
a1-3, mixing w 1 As using the current parameter set [ d, r, A]Calculating to obtain a projection matrix W;
if A is not equal to 1, the following steps are carried out:
a2-1, calculating according to the step a1-1 to obtain an intermediate parameter KS 1 、Y 1 、KT 1 And B 1 ;
a2-2, obtaining the intermediate parameter w by adopting the method of the step a1-2 1 The intermediate parameter w 1 As the 1 st generation projection matrix, finishing the 1 st generation assignment of the projection matrix;
a2-3, setting an intermediate parameter t1 1 、t2 1 、p1 1 、p2 1 And c 1 Calculating to obtain an intermediate parameter t1 by using the formulas (9) to (13) 1 、t2 1 、p1 1 、p2 1 And c 1 :
t1 1 =KS 1 w 1 (9)
t2 1 =KT 1 w 1 (10)
Wherein, the upper corner mark-1 represents matrix inversion, and the upper corner mark T represents the transposition of the matrix;
a2-4, setting an algebraic variable i, initializing i, and enabling i to be equal to 2;
a2-5, carrying out ith generation assignment on the projection matrix, specifically:
s1, setting an intermediate parameter KS i 、KT i 、Y i And B i Calculating by using the formulas (14) to (17) to obtain an intermediate parameter KS i 、KT i 、Y i And B i :
Y i =Y i-1 -c i t1 i-1 (16)
S2, setting an intermediate parameter w i A1 to B i Is assigned to w i W is to be i As the ith generation projection matrix, finishing the ith generation assignment of the projection matrix;
s3, setting an intermediate parameter t1 i 、t2 i 、p1 i 、p2 i And c i Calculating intermediate parameter t1 by using equations (18) to (22) i 、t2 i 、p1 i 、p2 i And c i c 1 :
t1 i =KS i w i (18)
t2 i =KT i w i (19)
S4, judging whether the value of i is equal to A or not, if not, adopting the current value of i plus 1 and updating the value of i, returning to the step S1 for next generation assignment of the projection matrix, and if the value of i is equal to A, entering the step a2-6;
step a2-6, obtaining w 1 To w A After being connected in series and transversely, the parameter group [ d, r, A ] of this time is used]Calculated projection matrix, W = [) 1 ,…,w A ];
Step 9, setting an intermediate variable T s And T t The product obtained in step 8The projection matrixes W are respectively substituted into formulas (23) and (24) to be calculated, and the result is ^ greater or less than or equal to>An intermediate variable T s And &>An intermediate variable T t :
T s =K(X s ,X s )W (23)
T t =K(X xt ,X s )W (24)
Step 10, obtaining step 9An intermediate variable T s Respectively as independent variable and Y as dependent variable, get ^ 5>A data matrix composed of independent variables and dependent variables;
step 11, constructing a PLS regression model through a 5-fold cross validation method to obtainThe PLS regression model specifically comprises: will adopt>An intermediate variable T s Based on a dependent variable Y>The data matrix composed of independent variables and dependent variables is divided into 5 parts at random, and 4 parts are selected at random and constructed by adopting a cross validation method to obtainA PLS regression model;
step 12, the product obtained in the step 9An intermediate variable T t Combined as test data with the argument in the remaining part 1 as argument for the->Testing each PLS regression model for 4 times in succession to obtain the prediction result in the dependent variable Y of each PLS regression model>And X t Prediction result of the corresponding dependent variable>Wherein the prediction result +>The prediction result is obtained by the argument in the remaining part 1, the prediction result->By means of intermediate variables T as arguments t Obtaining;
step 13, defining a PLS regression model optimization objective function, wherein the optimization objective function is expressed by an equation (25):
in the formula (25), mean represents the Mean value of the vector, std represents the standard deviation of the vector, and | | represents the symbol of taking the absolute value;
step 14, the dependent variable Y and the prediction result corresponding to each PLS regression modelAnd predicting a result->Respectively substituting into an equation (25) for calculation to obtain a value of f corresponding to each PLS regression model;
step 15, comparing all the values of f obtained in step 14, and corresponding the f with the minimum value to a group [ d, r, A ]]Calculating to obtain a corresponding projection matrix by adopting the method of the step 8, and taking the projection matrix as an optimal projection matrix and marking as W op Setting the optimum independent variable and marking it as T sop By using T sop =K(X s ,X s )W op Calculating to obtain T sop With T sop A final PLS regression model was constructed using Y as the dependent variable as the independent variable.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201911353268.2A CN111125629B (en) | 2019-12-25 | 2019-12-25 | Domain-adaptive PLS regression model modeling method |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201911353268.2A CN111125629B (en) | 2019-12-25 | 2019-12-25 | Domain-adaptive PLS regression model modeling method |
Publications (2)
Publication Number | Publication Date |
---|---|
CN111125629A CN111125629A (en) | 2020-05-08 |
CN111125629B true CN111125629B (en) | 2023-04-07 |
Family
ID=70502473
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201911353268.2A Active CN111125629B (en) | 2019-12-25 | 2019-12-25 | Domain-adaptive PLS regression model modeling method |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN111125629B (en) |
Families Citing this family (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112069450A (en) * | 2020-10-07 | 2020-12-11 | 武汉筑信科技有限公司 | Multi-object structural equation model calculation technology based on interactive projection between convex sets |
CN114611582B (en) * | 2022-02-16 | 2024-05-14 | 温州大学 | Method and system for analyzing substance concentration based on near infrared spectrum technology |
Citations (10)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101832909A (en) * | 2010-03-12 | 2010-09-15 | 江苏大学 | Selection method for subintervals of near infrared spectral characteristics based on simulated annealing-genetic algorithm |
CN102928382A (en) * | 2012-11-12 | 2013-02-13 | 江苏大学 | Near-infrared spectral characteristic wavelength selecting method based on improved simulated annealing algorithm |
CN103308463A (en) * | 2013-06-28 | 2013-09-18 | 中国农业大学 | Characteristic spectrum area selection method for near infrared spectrum |
CN104063710A (en) * | 2014-06-13 | 2014-09-24 | 武汉理工大学 | Method for removing abnormal spectrum in actual measurement spectrum curve based on support vector machine model |
CN104091089A (en) * | 2014-07-28 | 2014-10-08 | 温州大学 | Infrared spectrum data PLS modeling method |
CN104237158A (en) * | 2014-09-04 | 2014-12-24 | 浙江科技学院 | Near infrared spectrum qualitative analysis method with universality |
CN104376325A (en) * | 2014-10-30 | 2015-02-25 | 中国科学院半导体研究所 | Method for building near-infrared qualitative analysis model |
CN107064054A (en) * | 2017-02-28 | 2017-08-18 | 浙江大学 | A kind of near-infrared spectral analytical method based on CC PLS RBFNN Optimized models |
CN108593592A (en) * | 2018-04-19 | 2018-09-28 | 广东药科大学 | A kind of tuber of pinellia based on near-infrared spectrum technique mixes pseudo- discrimination method |
CN109145403A (en) * | 2018-07-31 | 2019-01-04 | 温州大学 | A kind of near infrared spectrum modeling method based on sample common recognition |
-
2019
- 2019-12-25 CN CN201911353268.2A patent/CN111125629B/en active Active
Patent Citations (10)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101832909A (en) * | 2010-03-12 | 2010-09-15 | 江苏大学 | Selection method for subintervals of near infrared spectral characteristics based on simulated annealing-genetic algorithm |
CN102928382A (en) * | 2012-11-12 | 2013-02-13 | 江苏大学 | Near-infrared spectral characteristic wavelength selecting method based on improved simulated annealing algorithm |
CN103308463A (en) * | 2013-06-28 | 2013-09-18 | 中国农业大学 | Characteristic spectrum area selection method for near infrared spectrum |
CN104063710A (en) * | 2014-06-13 | 2014-09-24 | 武汉理工大学 | Method for removing abnormal spectrum in actual measurement spectrum curve based on support vector machine model |
CN104091089A (en) * | 2014-07-28 | 2014-10-08 | 温州大学 | Infrared spectrum data PLS modeling method |
CN104237158A (en) * | 2014-09-04 | 2014-12-24 | 浙江科技学院 | Near infrared spectrum qualitative analysis method with universality |
CN104376325A (en) * | 2014-10-30 | 2015-02-25 | 中国科学院半导体研究所 | Method for building near-infrared qualitative analysis model |
CN107064054A (en) * | 2017-02-28 | 2017-08-18 | 浙江大学 | A kind of near-infrared spectral analytical method based on CC PLS RBFNN Optimized models |
CN108593592A (en) * | 2018-04-19 | 2018-09-28 | 广东药科大学 | A kind of tuber of pinellia based on near-infrared spectrum technique mixes pseudo- discrimination method |
CN109145403A (en) * | 2018-07-31 | 2019-01-04 | 温州大学 | A kind of near infrared spectrum modeling method based on sample common recognition |
Non-Patent Citations (3)
Title |
---|
Yasheng Wang 等.Improved PLS regression based on SVM classification for rapid analysis of coal properties by near-infrared reflectance spectroscopy.《Sensors and Actuators B Chemical》.2014,723-729. * |
张红光.近红外光谱新型建模方法与应用基础研究.《中国博士学位论文全文数据库 基础科学辑》.2016,A005-32. * |
成忠 等.快速稳健偏最小二乘回归及其在近红外光谱分析中的应用.《光谱学与光谱分析》.2006,1046-1050. * |
Also Published As
Publication number | Publication date |
---|---|
CN111125629A (en) | 2020-05-08 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
Bouveresse et al. | Two novel methods for the determination of the number of components in independent components analysis models | |
Hazama et al. | Covariance-based locally weighted partial least squares for high-performance adaptive modeling | |
Bai et al. | Accurate prediction of soluble solid content of apples from multiple geographical regions by combining deep learning with spectral fingerprint features | |
Wehrens | Chemometrics with R | |
WO1993021592A1 (en) | Improved method for interpreting complex data and detecting abnormal instrument or process behavior | |
CN106596450B (en) | Incremental method based on infrared spectrum analysis material component content | |
CN111125629B (en) | Domain-adaptive PLS regression model modeling method | |
CN113705092B (en) | Disease prediction method and device based on machine learning | |
CN112129741A (en) | Insulating oil aging analysis method and device, computer equipment and storage medium | |
CN105103166A (en) | Systems and methods for texture assessment of a coating formulation | |
JP7076463B2 (en) | Spectrum analyzer and spectrum analysis method | |
US8831316B2 (en) | Point source detection | |
CN110308713A (en) | A kind of industrial process failure identification variables method based on k neighbour reconstruct | |
CN114943674A (en) | Defect detection method, electronic device and storage medium | |
CN115713634A (en) | Color collocation evaluation method combining similarity measurement and visual perception | |
CN110648763A (en) | Method and apparatus for tumor assessment using artificial intelligence for spectral analysis | |
CN116994117A (en) | Training method, device, equipment and storage medium of target spectrum analysis model | |
CN114611582A (en) | Method and system for analyzing substance concentration based on near infrared spectrum technology | |
CN102906851B (en) | Analyze mass spectrographic method and system | |
CN109145403B (en) | Near infrared spectrum modeling method based on sample consensus | |
CN115541531A (en) | Method for predicting protein content in feed based on two-dimensional correlation spectrum | |
CN111220565B (en) | CPLS-based infrared spectrum measuring instrument calibration migration method | |
Kalivas | Data fusion of nonoptimized models: applications to outlier detection, classification, and image library searching | |
CN110632024B (en) | Quantitative analysis method, device and equipment based on infrared spectrum and storage medium | |
Cocchi et al. | Chemometrics–Bioinformatics |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |