Xylose content detection method based on near infrared spectrum and readable storage medium

CN119688642APending Publication Date: 2025-03-25JIANGNAN UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411780455.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-05
Publication Date
2025-03-25

Smart Images

  • Figure CN119688642A_ABST
    Figure CN119688642A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of xylose content quantitative analysis, and discloses a xylose content detection method based on near infrared spectroscopy and a readable storage medium, and the method comprises the following steps: obtaining a plurality of xylose solution samples with different xylose contents, collecting corresponding near infrared spectrum original data, preprocessing, and obtaining corresponding enhanced spectrum data; selecting a preset number of variables as target features by using a random frog leaping algorithm on the basis of all the enhanced spectrum data; based on the xylose content of the xylose solution sample and the corresponding enhanced spectral data, constructing an initial xylose content prediction model by utilizing a partial least square method; iteratively updating a weight vector, a load vector, a coefficient vector and a score vector in a display expression of the initial xylose content prediction model by using the target features to obtain a target xylose content prediction model; and preprocessing near infrared spectrum data of a to-be-detected xylose solution, and inputting the preprocessed near infrared spectrum data into the target xylose content prediction model to obtain the corresponding xylose content.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of xylose content quantitative analysis, and in particular to a xylose content detection method based on near infrared spectroscopy and a readable storage medium. Background Art

[0002] As a functional oligosaccharide, xylose is widely used in food, feed, medicine and other fields because of its safety, non-toxicity, non-intestinal absorption and thus avoidance of obesity, and promotion of the growth of probiotics in the human intestine. In the actual industrial process, one of the main equipment for the separation and purification of xylose is a simulated moving bed. In order to ensure the normal operation of the simulated moving bed equipment, the operator needs to detect the product content of each outlet. The traditional method for measuring xylose content is to use a high performance liquid chromatograph for determination. The operation and analysis process of this method relies on professional technicians, the analysis time is too long, and the life of the chromatographic column is limited. Near-infrared spectroscopy detection technology is a method of analyzing the composition of a substance by detecting the specific frequency absorption of molecular chemical bonds. It uses molecules to absorb photons of fixed frequencies to achieve energy level transitions. It has the characteristics of rapidity and low cost.

[0003] Near-infrared spectroscopy has been applied to the analysis and detection of various industries and has achieved good results. Among them, the more common application fields are chemical industry, food and pharmaceuticals. Tang Hui et al. applied near-infrared spectroscopy analysis technology to the control of fluidized bed system. They used a probe to scan and collect spectra of the whole process of fluidized bed one-step granulation. After establishing a prediction model, they used the temperature and moisture data obtained by the model as the judgment conditions for the fluidized bed drying endpoint, which provided a new idea for the multivariate control of the drying endpoint (Tang Hui, Chen Qiang, Zhang Xuerong, Journal of Food Quality Inspection, 2020, 11(03): 955-960.). Victoria Lafuente et al. combined two non-destructive analysis technologies, acoustic pulse and near-infrared spectroscopy, to improve the reliability of MT hardness detection of peach variety "Calrico" (Lafuente V, Herrera LJ, Pérez MM, Journal of the Science of Food and Agriculture, 2015, 95(10): 2033-2040.). Puneet Mishra et al. collected spectral data of apples and tried to use dynamic orthogonal projection and domain adaptation to calibrate the non-destructive sugar detection model of apples. Both attempts were successful (Mishra P, Roger JM, Rut ledge DN, Postharvest Biology and Technology, 2020, 170: 111326.). Yang Nanlin et al. proposed a new analysis method based on fiber-optic near-infrared transmission spectroscopy to detect the purification process of traditional Chinese medicine macroporous adsorption resin, and successfully used it in the purification process of Coptis chinensis alkaloids (Yi Yu, Qu Haibin, Acta Chimica Sinica, 2003, 61(5): 742-747.). Gao Lele et al. combined near-infrared analysis and chemometric methods to analyze the moisture absorption process of sweet oranges, eliminated the interference of water molecules in the sample through an external parameter orthogonal algorithm, and established a near-infrared prediction model for the content of rebaudioside A (RA) in stevioside (Gao Lele, Zhong Liang, Dong Hailing, et al., Spectroscopy and Spectral Analysis, 2022, 42(2): 415-422.).

[0004] Although near-infrared spectroscopy has been widely used in various fields of life such as chemical industry, food and pharmaceuticals, there has been no report on the application of near-infrared spectroscopy analysis to the detection of xylose content. At present, the detection of xylose content still uses traditional methods, which rely on professional technicians for operation and analysis, and have problems such as long analysis time and limited life of chromatographic columns, resulting in delayed xylose content detection results and low detection efficiency. Summary of the invention

[0005] Therefore, the technical problem to be solved by the present invention is to overcome the problems in the prior art that xylose content analysis is overly dependent on professionals, has a long analysis time and low detection efficiency.

[0006] In order to solve the above technical problems, the present invention provides a method for detecting xylose content based on near infrared spectroscopy, comprising:

[0007] Obtain a variety of xylose solution samples with different xylose contents and collect the corresponding near-infrared spectral raw data;

[0008] Preprocess the raw near-infrared spectrum data to obtain the corresponding enhanced spectrum data;

[0009] Based on all enhanced spectral data, a preset number of variables are selected as target features using the random frog leaping algorithm;

[0010] Based on the xylose content of the xylose solution sample and its corresponding enhanced spectral data, the initial xylose content prediction model was constructed using the partial least squares method.

[0011] Using the target features, the weight vector, the load vector, the coefficient vector and the score vector in the display expression of the initial xylose content prediction model are iteratively updated to obtain the target xylose content prediction model;

[0012] The near infrared spectral data of the xylose solution to be detected are preprocessed and then input into the target xylose content prediction model to obtain the corresponding xylose content.

[0013] Preferably, the acquisition of the raw data of the near infrared spectrum of the xylose solution sample comprises:

[0014] Preset the wavelength scanning range and resolution of the spectrometer;

[0015] Two scans were performed at each wavelength point within the wavelength scanning range to obtain two absorbances of the xylose solution sample at each wavelength point;

[0016] Take the average of the two absorbances as the original data of the xylose solution sample at this wavelength;

[0017] The raw data of all wavelength points within the wavelength scanning range are obtained to constitute the near-infrared spectrum raw data of the xylose solution sample.

[0018] Preferably, the preprocessing method for preprocessing the raw data of the near-infrared spectrum includes one or more of first-order derivative FD, multivariate scatter correction MSC, standard normal transformation SNV, smoothing filter SG, and moving average smoothing MA.

[0019] Preferably, based on all enhanced spectral data, a preset number of variables are selected as target features using a random frog leaping algorithm, including:

[0020] S41: all enhanced spectral data are taken as the complete set V;

[0021] S42: Randomly select Q enhanced spectral data from the full set V as variables to form a candidate variable subset V 0 ;

[0022] S43: Generate a random number from a normal distribution and round it to the nearest integer as the target number Q*;

[0023] S44: For the candidate variable subset V 0 Add or delete variables in the candidate variable subset V 0 The number of variables Q in the equation is the same as the target number Q*, and the target variable subset V* is obtained;

[0024] S45: Based on the candidate variable subset V 0 Calculate and compare the candidate classification error probability Err with the target classification error probability Err* to obtain the optimal variable subset V under the current number of variables Q 1 ,include:

[0025] If Err*>Err, then is the acceptance probability, based on the candidate variable subset V 0 and the target variable subset V*, select the optimal variable subset V under the current number of variables Q 1 ;

[0026] If Err*≤Err, the target variable subset V* is used as the optimal

[0027] Variable subset V 1 ;

[0028] S46: Return to step S52, update the number of variables Q' in the candidate variable subset, obtain the optimal variable subset under the updated number of variables Q', until the total number of optimal variable subsets reaches the preset number N, and obtain N optimal variable subsets with different numbers of variables;

[0029] S47: Calculate the selection probability of each enhanced spectral data in the entire set V, obtain the top e variables with the largest probability, and form the target feature.

[0030] Preferably, the candidate variable subset V 0 Add or delete variables in the candidate variable subset V 0 The number of variables Q in is the same as the target number Q*, and the target variable subset V* is obtained, including:

[0031] If Q*=Q, then the candidate variable subset V 0 As the target variable subset V*;

[0032] If Q*>Q, then from the set VV 0 Select w(Q*-Q) variables from the candidate variable subset V 0 , forming the updated candidate variable subset V 0 '; Using the updated candidate variable subset V 0 'Establish a partial least squares-linear discriminant model and retain the updated candidate variable subset V 0 'The Q* variables with the largest absolute values ​​of regression coefficients are used as the target variable subset;

[0033] If Q*<Q, then use the candidate variable subset V 0 Establish a partial least squares-linear discriminant model and retain the candidate variable subset V 0 The Q* variables with the largest absolute values ​​of regression coefficients are used as the target variable subset.

[0034] Preferably, the candidate classification error probability Err and the target classification error probability Err* are expressed as:

[0035] The candidate classification error probability Err is expressed as:

[0036] The target classification error probability Err* is expressed as:

[0037] Among them, M represents the total number of test samples, y i represents the true label of the i-th test sample, Indicates the use of candidate variable subset V 0 The predicted label of the trained model for the i-th test sample; θ() represents the indicator function. If the true label is inconsistent with the predicted label, the indicator function value is 1, otherwise, the indicator function value is 0; represents the predicted label of the i-th test sample by the model trained with the target variable subset V*.

[0038] Preferably, the is the acceptance probability, based on the candidate variable subset V 0 and the target variable subset V*, select the optimal variable subset V under the current number of variables Q 1 ,include:

[0039] Get a random number R in the range of [0,1];

[0040] Comparing the probability of acceptance With a random number R:

[0041] like Then accept the target variable subset V* as the optimal variable subset V under the current number of variables Q1 ;

[0042] like Then receive the candidate variable subset V 0 As the optimal variable subset V under the current number of variables Q 1 .

[0043] Preferably, the selection probability of each enhanced spectral data in the whole set is calculated, which is expressed as:

[0044]

[0045] Among them, Prob j represents the selection probability of the jth enhanced spectral data in the whole set, j = 1, 2, ..., m, m represents the total number of enhanced spectral data in the whole set, N j represents the number of optimal variable subsets containing the j-th enhanced spectral data in the whole set, and N represents the total number of optimal variable subsets.

[0046] Preferably, the target feature is used to iteratively update the weight vector, load vector, coefficient vector and score vector in the display expression of the initial xylose content prediction model to obtain the target xylose content prediction model, including:

[0047] The display expression of the initial xylose content prediction model is expressed as: Y = B PLS X;

[0048] Among them, the dependent variable matrix Y represents the xylose content, and the independent variable matrix X represents the target feature; B PLS Represents the weight vector w i , load vector p i , coefficient vector b i With the score vector t i The function is expressed as

[0049] Initialize E 0 =X,F 0 =Y, i=1;

[0050] Update the weight vector w i , expressed as: λ i Representation Matrix The maximum eigenvalue of

[0051] Update the score vector t i , expressed as: t i =E i-1 w i ;

[0052] Calculate E i-1 and F i-1Relative to t i Load vector p i With coefficient vector b i , and the independent variable matrix X with respect to t i The weight vector It is expressed as:

[0053]

[0054] calculate It is expressed as:

[0055] I represents a unit vector;

[0056] Let i=i+1, update the weight vector w i , load vector p i , coefficient vector b i With the score vector t i , until |t i -t i-1 | is less than a preset threshold, the target weight vector, target load vector, target coefficient vector and target score vector are obtained, and they are substituted into the display expression of the initial xylose content prediction model to obtain the target xylose content prediction model.

[0057] This embodiment provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the steps of the method for detecting xylose content based on near-infrared spectroscopy as described above are implemented.

[0058] The above technical solution of the present invention has the following beneficial effects compared with the prior art:

[0059] The xylose content detection method based on near infrared spectroscopy of the present invention is based on the infrared spectral data of xylose solution, and the random frog leaping algorithm is applied. Through multiple iterations, a preset number of features are selected according to the classification error probability of the features, as target features, and the initial xylose content prediction model constructed by partial least squares is trained, and the trained target xylose content prediction model is used to predict the xylose content of the xylose solution. The present invention is based on the characteristics of fast analysis speed of near infrared spectroscopy technology, and can complete the collection and analysis of samples in a short time, significantly shorten the detection cycle, and is suitable for online monitoring, and can reflect the change of xylose content in real time; and the random frog leaping algorithm is used for wavelength feature selection, which greatly reduces the number of variables required for model establishment, improves the model generalization ability, and reduces the model complexity; and the xylose content prediction model constructed by partial least squares method is used, and the linear relationship between the target features selected in the spectral data and the xylose content in the solution, and the correlation between them, is considered to construct a prediction model, which further improves the accuracy of xylose content detection, and is simple to operate, does not require complex sample preparation and processing, and does not require professional technicians, and can achieve online real-time detection, which can meet the needs of rapid monitoring. BRIEF DESCRIPTION OF THE DRAWINGS

[0060] In order to make the content of the present invention more clearly understood, the present invention is further described in detail below according to specific embodiments of the present invention in conjunction with the accompanying drawings, wherein:

[0061] Figure 1 It is a flowchart of the steps of the xylose content detection method based on near infrared spectroscopy provided by the present invention;

[0062] Figure 2 This is a model building block diagram for the rapid detection method of xylose content;

[0063] Figure 3 It is a schematic diagram of the raw data of near infrared spectrum;

[0064] Figure 4 It is the flow chart of random frog leaping algorithm;

[0065] Figure 5 It is a curve chart of the evaluation index change trend of the PLS model under different numbers of features;

[0066] Figure 6 This is the wavelength feature selection result diagram of the random frog leaping algorithm;

[0067] Figure 7 This is the prediction effect diagram of the target xylose content detection model. DETAILED DESCRIPTION

[0068] The present invention is further described below in conjunction with the accompanying drawings and specific embodiments so that those skilled in the art can better understand the present invention and implement it, but the embodiments are not intended to limit the present invention.

[0069] Reference Figure 1 As shown, the step flow chart of the xylose content detection method based on near infrared spectroscopy provided by the present invention includes the following steps:

[0070] S101: obtaining a plurality of xylose solution samples with different xylose contents, and collecting corresponding near-infrared spectral raw data;

[0071] S102: preprocessing the raw near-infrared spectrum data to obtain corresponding enhanced spectrum data;

[0072] S103: Based on all enhanced spectral data, a preset number of variables are selected as target features using a random frog leaping algorithm;

[0073] S104: Based on the xylose content of the xylose solution sample and its corresponding enhanced spectral data, an initial xylose content prediction model is constructed using a partial least squares method;

[0074] S105: using the target feature, iteratively updating the weight vector, the load vector, the coefficient vector and the score vector in the display expression of the initial xylose content prediction model to obtain a target xylose content prediction model;

[0075] S106: Pre-process the near infrared spectrum data of the xylose solution to be detected and input it into the target xylose content prediction model to obtain the corresponding xylose content.

[0076] Specifically, in step S101, the acquisition of the raw data of the near infrared spectrum of the xylose solution sample includes:

[0077] Preset the wavelength scanning range and resolution of the spectrometer;

[0078] Two scans were performed at each wavelength point within the wavelength scanning range to obtain two absorbances of the xylose solution sample at each wavelength point;

[0079] Take the average of the two absorbances as the original data of the xylose solution sample at this wavelength;

[0080] The raw data of all wavelength points within the wavelength scanning range are obtained to constitute the near-infrared spectrum raw data of the xylose solution sample.

[0081] Specifically, the preprocessing method for preprocessing the raw data of the near-infrared spectrum includes one or more of the first-order derivative FD, multivariate scatter correction MSC, standard normal transformation SNV, smoothing filter SG, and moving average smoothing MA.

[0082] Specifically, in step S103, based on all enhanced spectral data, a preset number of variables are selected as target features using a random frog leaping algorithm, including:

[0083] S41: all enhanced spectral data are taken as the complete set V;

[0084] S42: Randomly select Q enhanced spectral data from the full set V as variables to form a candidate variable subset V 0 ;

[0085] S43: Generate a random number from a normal distribution and round it to the nearest integer as the target number Q*;

[0086] S44: For the candidate variable subset V 0 Add or delete variables in the candidate variable subset V 0 The number of variables Q in the equation is the same as the target number Q*, and the target variable subset V* is obtained;

[0087] S45: Based on the candidate variable subset V 0 Calculate and compare the candidate classification error probability Err with the target classification error probability Err* to obtain the optimal variable subset V under the current number of variables Q 1 ,include:

[0088] If Err*>Err, then is the acceptance probability, based on the candidate variable subset V 0 and the target variable subset V*, select the optimal variable subset V under the current number of variables Q 1 ;

[0089] If Err*≤Err, the target variable subset V* is used as the optimal

[0090] Variable subset V 1 ;

[0091] S46: Return to step S52, update the number of variables Q' in the candidate variable subset, obtain the optimal variable subset under the updated number of variables Q', until the total number of optimal variable subsets reaches the preset number N, and obtain N optimal variable subsets with different numbers of variables;

[0092] S47: Calculate the selection probability of each enhanced spectral data in the entire set V, obtain the top e variables with the largest probability, and form the target feature.

[0093] In step S44, the candidate variable subset V 0 Add or delete variables in the candidate variable subset V 0The number of variables Q in the equation is the same as the target number Q*, and the target variable subset V* is obtained, including:

[0094] If Q*=Q, then the candidate variable subset V 0 As the target variable subset V*;

[0095] If Q*>Q, then from the set VV 0 Select w(Q*-Q) variables from the candidate variable subset V 0 , forming the updated candidate variable subset V 0 '; Using the updated candidate variable subset V 0 'Establish a partial least squares-linear discriminant model and retain the updated candidate variable subset V 0 'The Q* variables with the largest absolute values ​​of regression coefficients are used as the target variable subset;

[0096] If Q*<Q, then use the candidate variable subset V 0 Establish a partial least squares-linear discriminant model and retain the candidate variable subset V 0 The Q* variables with the largest absolute values ​​of regression coefficients are used as the target variable subset.

[0097] Among them, in step S45, the candidate classification error probability Err and the target classification error probability Err* are respectively expressed as:

[0098] The candidate classification error probability Err is expressed as:

[0099] The target classification error probability Err* is expressed as:

[0100] Among them, M represents the total number of test samples, y i represents the true label of the i-th test sample, Indicates the use of candidate variable subset V 0 The predicted label of the trained model for the i-th test sample; θ() represents the indicator function. If the true label is inconsistent with the predicted label, the indicator function value is 1, otherwise, the indicator function value is 0; represents the predicted label of the i-th test sample by the model trained with the target variable subset V*.

[0101] Specifically, is the acceptance probability, based on the candidate variable subset V 0 and the target variable subset V*, select the optimal variable subset V under the current number of variables Q 1 ,include:

[0102] Get a random number R in the range of [0,1];

[0103] Comparing the probability of acceptance With a random number R:

[0104] like Then accept the target variable subset V* as the optimal variable subset V under the current number of variables Q 1 ;

[0105] like Then receive the candidate variable subset V 0 As the optimal variable subset V under the current number of variables Q 1 .

[0106] Specifically, in step S47, the selection probability of each enhanced spectrum data in the entire set is calculated, which is expressed as:

[0107]

[0108] Among them, Prob j represents the selection probability of the jth enhanced spectral data in the whole set, j = 1, 2, ..., m, m represents the total number of enhanced spectral data in the whole set, N j represents the number of optimal variable subsets containing the j-th enhanced spectral data in the whole set, and N represents the total number of optimal variable subsets.

[0109] Specifically, a partial least squares-linear discriminant model PLS-LDA is constructed based on variable subsets, including: screening the most relevant variables according to a selection algorithm to construct a variable subset; applying the PLS algorithm to the selected variable subset to reduce the dimension to obtain latent variables; and performing LDA classification based on the latent variables after PLS dimension reduction.

[0110] Specifically, in step S105, the weight vector, load vector, coefficient vector and score vector in the display expression of the initial xylose content prediction model are iteratively updated by using the target feature to obtain the target xylose content prediction model, including:

[0111] The display expression of the initial xylose content prediction model is expressed as: Y = B PLS X;

[0112] Among them, the dependent variable matrix Y represents the xylose content, and the independent variable matrix X represents the target feature; B PLS Represents the weight vector w i , load vector p i , coefficient vector b i With the score vector t i The function is expressed as

[0113] Initialize E 0 =X,F 0 =Y, i=1;

[0114] Update the weight vector w i , expressed as: λ i Representation Matrix The maximum eigenvalue of

[0115] Update the score vector t i , expressed as: t i =E i-1 w i ;

[0116] Calculate E i-1 and F i-1 Relative to t i Load vector p i With coefficient vector b i , and the independent variable matrix X with respect to t i The weight vector It is expressed as:

[0117]

[0118] calculate It is expressed as:

[0119] I represents a unit vector;

[0120] Let i=i+1, update the weight vector w i , load vector p i , coefficient vector b i With the score vector t i , until |t i -t i-1 | is less than a preset threshold, the target weight vector, target load vector, target coefficient vector and target score vector are obtained, and they are substituted into the display expression of the initial xylose content prediction model to obtain the target xylose content prediction model.

[0121] The xylose content detection method based on near-infrared spectroscopy described in the present invention does not require a long sample preparation and analysis time, can obtain analysis results in a short time, and is relatively simple to operate, does not require professional operators, and can achieve real-time online detection to meet the needs of rapid monitoring.

[0122] Based on the above embodiments, in the embodiments of the present invention, the effectiveness of the xylose content detection method based on near infrared spectroscopy provided by the present invention is verified, referring to Figure 2 As shown in FIG. 1 , a model building block diagram of a rapid xylose content detection method is provided, and the specific process includes:

[0123] S201: Spectral data acquisition;

[0124] Set the wavelength scanning range of the spectrometer to 800nm-2500nm and the resolution of the spectrometer to 8cm -1 , the scanning time is 16s, and the number of scans is 20. Take 5ml of the collected samples and scan them with a spectrometer. In order to minimize the influence of measurement errors on the experimental results, the same sample is scanned twice during data collection, and the average absorbance value is taken as the original spectral data of this embodiment; refer to Figure 3 The figure shows the schematic diagram of the raw data of near infrared spectrum.

[0125] S202: data set division and data preprocessing;

[0126] The collected samples were divided into training set and test set at a ratio of 4:1. The raw spectral data were preprocessed using different methods such as first-order derivative (FD), multivariate scatter correction (MSC), standard normal transformation (SNV), smoothing filter (SG), moving average smoothing (MA) and FD+SG ​​combination method. Different preprocessing methods will have different effects on the performance of the prediction model. The PLS xylose content prediction model was established using the processed spectral data. The determination coefficient R 2 , prediction root mean square error RMSEP and prediction relative analysis error RPD to determine the most appropriate preprocessing method.

[0127] After using different preprocessing methods to process the original spectral data, the evaluation indicators of the established prediction model are shown in Table 1. From the model evaluation indicators in Table 1, it can be seen that after using the combination of FD and SG to preprocess the original spectral data, Rp 2 The RPD is 0.8481, the RPD is 2.6256, and the RMSEP is further reduced, and the performance of the model is optimal. The present invention selects the combination of FD and SG as the preprocessing method in the modeling process.

[0128] Table 1 PLS modeling results of different preprocessing methods

[0129] Preprocessing <![CDATA[R 2 ]]> RMSEP RPD <![CDATA[Rp 2 ]]> Original 0.9984 11.7394 1.9328 0.7317 FD 0.9989 11.5020 2.0416 0.7425 MSC 0.9998 12.2703 1.9107 0.7069 SNV 0.9987 12.1939 1.9124 0.7106 SG 0.9989 10.4110 2.1812 0.7890 MA 0.9891 13.0350 1.7446 0.6693 CT 0.9936 11.8455 2.0006 0.7269 FD+SG 0.9811 8.8341 2.6256 0.8481

[0130] S203: wavelength feature selection;

[0131] Reference Figure 4 As shown, it is the flow chart of random frog leaping algorithm;

[0132] S203-1: The preprocessed spectral data is recorded as the complete set V, and Q variables are randomly selected from the complete set V and recorded as V 0 ; Generate a random number from the normal distribution N(Q,θQ), round it to the nearest integer and record it as Q * , Q * is the candidate variable subset V * The number of variables in .

[0133] S203-2: Comparison Q * and the size of Q, if Q * =Q, then let V 0 =V * If Q * >Q, needs to be in the current variable subset V 0 Add a variable, denoted as V * If Q * <Q, need to be in the current variable subset V 0 Delete the variable, denoted as V * . Guaranteed V * The number of variables is Q * .

[0134] S203-3: Determine whether V can be received * , use V 0 and V * Calculate the cross-validation misclassification error probability, denoted as Err and Err * If Err≤Err * , then receive V * As V 1 ; otherwise, ηErr / Err * Receive V * As V 1 . Use V 1 Update the variables in V 0 , repeat the above process until N cycles are completed.

[0135] S203-4: Calculate the selection probability of each variable. After N iterations, a total of N variable subsets can be obtained. The frequency of the jth variable being selected into these N variable subsets is N j . Select the first e variables with the largest probability in the full set V as the feature output, where the selection probability of each variable can be calculated using the following formula:

[0136] The key parameter of RJFA is the number of selected features, which will have a significant impact on the modeling results of the partial least squares PLS model. Selecting too few features may cause the prediction model to be unable to capture all the information of the data, resulting in underfitting of the model; selecting too many features may introduce noise and redundant features, resulting in overfitting of the model and reducing the generalization performance of the model. Figure 5 The following is a curve chart showing the changing trend of the evaluation index of the PLS model under different numbers of features.

[0137] from Figure 5It can be seen that with the increase in the number of selected features, RPD first rises and then falls. When the number of features is too small, the model is not able to explain the spectral data well and cannot predict the changes in the xylose content in the sample solution. When the number of features is too large, the model is underfitting and the generalization performance decreases, making it poorly predictive of the test samples. From the above trend chart, it can be seen that the model's prediction performance for new data is optimal when the number of features is 20 to 30. Combining other evaluation indicators, the number of features is selected as 25, and the algorithm is run to obtain the following Figure 6 Features shown. Figure 6 As shown, this is a graph of wavelength feature selection results of the random frog leaping algorithm; it can be seen from the figure that RJFA selects a small number of wavelengths from the full spectrum as features. Compared with the full spectrum model, changes in other irrelevant variables have less impact on the model established by the present invention, and the generalization performance of the model will be improved.

[0138] S204: Establish a prediction model using the obtained features;

[0139] Assume that the characteristic dimension of the spectral data is n×m, and the independent variable matrix is ​​X=x 1 ,x 2 ,…,x m , the dependent variable matrix is ​​Y = [y 1 ,y 2 ,...,y n ] T The explicit expression of the PLS model is Among them B PLS is the weight vector w i , load vector p i and coefficient vector b i The following steps are B PLS The iterative process of .

[0140] (31) Let E 0 =X,F 0 =Y, i=1;

[0141] (32) Weight vector w i It is calculated by the following formula. i For the matrix The maximum eigenvalue λ i The corresponding eigenvector w i , i=1,2,,...,a;

[0142]

[0143] (33) Calculate the score vector t i , the formula is as follows: t i =E i1 w i ;

[0144] (34) Calculate E i1 and F i1 Corresponding to t i The load p i and b i , and the independent variable matrix X corresponds to the score vector t i The weight vector The formula is as follows:

[0145]

[0146] (35) Calculation The formula is as follows:

[0147]

[0148] (36) Let i = i + 1, repeat steps 32-35, and calculate the new w i 、p i , b i and t i ;

[0149] (37) Calculate the output of the PLS model for the independent variable matrix X, the formula is as follows:

[0150]

[0151] Input the training set and test set spectral data into the model, obtain the test sample prediction value, and evaluate the performance of the model through indicators; refer to Figure 7 The figure shows the prediction effect diagram of the target xylose content detection model provided by the present invention. The specific steps are as follows: preprocess the test sample data using the same method; select the corresponding variable features in the test sample data as the input of the model according to the RJFA operation results; input the features into the model to obtain the predicted value of the xylose content of the test set samples; process the training set data in the same way to obtain the predicted value of the xylose content of the training set samples; use the predicted values ​​and actual values ​​of the training set samples and the test set samples to calculate the evaluation index of the model.

[0152] Model evaluation indicators include:

[0153] ①Determination coefficient R 2 , expressed as:

[0154] ② The root mean square error of prediction RMSEP is expressed as:

[0155] ③ Prediction relative analysis error RPD, expressed as:

[0156] Among them, yi is the actual value of the dependent variable, is the predicted value of the dependent variable, is the average value of the actual value of the dependent variable, and n is the number of samples. 2 Indicates the goodness of fit and generalization ability of the model, with a value range of 0 to 1. The closer the value is to 1, the better the model fits the data. Use the training set data to calculate R 2 It can measure the degree of fit of the model on the training set data and be used to evaluate the goodness of fit of the model; use the test set data to calculate R 2 It can measure the predictive ability of the model on the training set data. At this time, R 2 Denoted as R p 2 , which is a key indicator for evaluating the generalization performance of the model. The root mean square error RMSEP and the prediction relative analysis error RPD can intuitively evaluate the prediction performance of the model. RMSEP is an indicator used to evaluate the prediction accuracy of the model, which reflects the deviation between the model predicted value and the actual value. The smaller the RMSEP, the higher the prediction accuracy of the model. RPD is an indicator used to evaluate the predictive ability of the model, which measures the relative performance of the model by comparing the standard deviation of the data and the prediction error. The higher the RPD, the better the prediction performance of the model. When RPD>2.5, it can be considered that the model has good predictive ability and is suitable for quantitative analysis.

[0157] Substitute the sample prediction value and actual value into the evaluation index calculation formula to obtain R 2 The RMSEP is 5.9377, and the RPD is 3.9377. The model has excellent predictive ability and is suitable for quantitative analysis of xylose content. 2 The value is 0.9335, and the model can accurately predict the xylose content of the test samples, with good generalization ability.

[0158] An embodiment of the present invention further provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the steps of the method for detecting xylose content based on near infrared spectroscopy as described above are implemented.

[0159] The xylose content detection method based on near infrared spectroscopy of the present invention is based on the infrared spectral data of xylose solution, and the random frog leaping algorithm is applied. Through multiple iterations, a preset number of features are selected according to the classification error probability of the features, as target features, and the initial xylose content prediction model constructed by partial least squares is trained, and the trained target xylose content prediction model is used to predict the xylose content of the xylose solution. The present invention is based on the characteristics of fast analysis speed of near infrared spectroscopy technology, and can complete the collection and analysis of samples in a short time, significantly shorten the detection cycle, and is suitable for online monitoring, and can reflect the change of xylose content in real time; and the random frog leaping algorithm is used for wavelength feature selection, which greatly reduces the number of variables required for model establishment, improves the model generalization ability, and reduces the model complexity; and the xylose content prediction model constructed by partial least squares method is used, and the linear relationship between the target features selected in the spectral data and the xylose content in the solution, and the correlation between them, is considered to construct a prediction model, which further improves the accuracy of xylose content detection, and is simple to operate, does not require complex sample preparation and processing, and does not require professional technicians, and can achieve online real-time detection, which can meet the needs of rapid monitoring.

[0160] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented in one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that include computer-usable program code.

[0161] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0162] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0163] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0164] Obviously, the above embodiments are merely examples for the purpose of clear explanation and are not intended to limit the implementation methods. For those skilled in the art, other different forms of changes or modifications can be made based on the above description. It is not necessary and impossible to list all the implementation methods here. The obvious changes or modifications derived therefrom are still within the scope of protection of the present invention.

Claims

1. A method for detecting xylose content based on near infrared spectroscopy, characterized in that: include: Obtain a variety of xylose solution samples with different xylose contents and collect the corresponding near-infrared spectral raw data; Preprocess the raw near-infrared spectrum data to obtain the corresponding enhanced spectrum data; Based on all enhanced spectral data, a preset number of variables are selected as target features using the random frog leaping algorithm; Based on the xylose content of the xylose solution sample and its corresponding enhanced spectral data, the initial xylose content prediction model was constructed using the partial least squares method. Using the target features, the weight vector, the load vector, the coefficient vector and the score vector in the display expression of the initial xylose content prediction model are iteratively updated to obtain the target xylose content prediction model; The near infrared spectral data of the xylose solution to be detected are preprocessed and then input into the target xylose content prediction model to obtain the corresponding xylose content.

2. The method for detecting xylose content based on near infrared spectroscopy according to claim 1, characterized in that: The acquisition of raw data of near infrared spectrum of xylose solution sample includes: Preset the wavelength scanning range and resolution of the spectrometer; Two scans were performed at each wavelength point within the wavelength scanning range to obtain two absorbances of the xylose solution sample at each wavelength point; Take the average of the two absorbances as the original data of the xylose solution sample at this wavelength; The raw data of all wavelength points within the wavelength scanning range are obtained to constitute the near-infrared spectrum raw data of the xylose solution sample.

3. The method for detecting xylose content based on near infrared spectroscopy according to claim 1, characterized in that: The preprocessing method for preprocessing the raw data of near-infrared spectrum includes one or more of first-order derivative FD, multivariate scatter correction MSC, standard normal transformation SNV, smoothing filter SG, and moving average smoothing MA.

4. The method for detecting xylose content based on near infrared spectroscopy according to claim 1, characterized in that: Based on all enhanced spectral data, a preset number of variables are selected as target features using the random frog leaping algorithm, including: S41: all enhanced spectral data are taken as the complete set V; S42: Randomly select Q enhanced spectral data from the full set V as variables to form a candidate variable subset V0; S43: Generate a random number from a normal distribution and round it to the nearest integer as the target number Q*; S44: Add or delete variables in the candidate variable subset V0, make the number Q of variables in the candidate variable subset V0 the same as the target number Q*, and obtain the target variable subset V*; S45: Based on the candidate variable subset V0 and the target variable subset V*, the candidate classification error probability Err and the target classification error probability Err* are calculated and compared to obtain the optimal variable subset V1 under the current number of variables Q, including: If Err*>Err, then To accept the probability, based on the candidate variable subset V0 and the target variable subset V*, select the optimal variable subset V1 under the current number of variables Q; If Err*≤Err, the target variable subset V* is used as the optimal variable subset V1 under the current number of variables Q; S46: Return to step S52, update the number of variables Q' in the candidate variable subset, obtain the optimal variable subset under the updated number of variables Q', until the total number of optimal variable subsets reaches the preset number N, and obtain N optimal variable subsets with different numbers of variables; S47: Calculate the selection probability of each enhanced spectral data in the entire set V, obtain the top e variables with the largest probability, and form the target feature.

5. The method for detecting xylose content based on near infrared spectroscopy according to claim 4, characterized in that: The adding or deleting of variables in the candidate variable subset V0, making the number Q of variables in the candidate variable subset V0 the same as the target number Q*, and obtaining the target variable subset V*, includes: If Q*=Q, then the candidate variable subset V0 is used as the target variable subset V*; If Q*>Q, w(Q*-Q) variables are selected from the set V-V0, and together with the candidate variable subset V0, they form an updated candidate variable subset V0'; a partial least squares-linear discriminant model is established using the updated candidate variable subset V0', and the Q* variables with the largest absolute value of the regression coefficient in the updated candidate variable subset V0' are retained as the target variable subset; If Q*<Q, the partial least squares-linear discriminant model is established using the candidate variable subset V0, and the Q* variables with the largest absolute value of the regression coefficient in the candidate variable subset V0 are retained as the target variable subset.

6. The method for detecting xylose content based on near infrared spectroscopy according to claim 4, characterized in that: The candidate classification error probability Err and the target classification error probability Err* are expressed as: The candidate classification error probability Err is expressed as: The target classification error probability Err* is expressed as: Among them, M represents the total number of test samples, y i represents the true label of the i-th test sample, represents the predicted label of the i-th test sample by the model trained with the candidate variable subset V0; θ() represents the indicator function. If the true label is inconsistent with the predicted label, the indicator function value is 1, otherwise, the indicator function value is 0; * represents the predicted label of the i-th test sample by the model trained with the target variable subset V*.

7. The method for detecting xylose content based on near infrared spectroscopy according to claim 6, characterized in that: Said To accept the probability, based on the candidate variable subset V0 and the target variable subset V*, select the optimal variable subset V1 under the current number of variables Q, including: Get a random number R in the range of [0,1]; Comparing the probability of acceptance With a random number R: like Then the target variable subset V* is received as the optimal variable subset V1 under the current number of variables Q; like Then the candidate variable subset V0 is received as the optimal variable subset V1 under the current number of variables Q.

8. The method for detecting xylose content based on near infrared spectroscopy according to claim 4, characterized in that: Calculate the selection probability of each enhanced spectral data in the full set, expressed as: Among them, Prob j represents the selection probability of the jth enhanced spectral data in the whole set, j = 1, 2, ..., m, m represents the total number of enhanced spectral data in the whole set, N j represents the number of optimal variable subsets containing the j-th enhanced spectral data in the whole set, and N represents the total number of optimal variable subsets.

9. The method for detecting xylose content based on near infrared spectroscopy according to claim 1, characterized in that: Using the target features, the weight vector, load vector, coefficient vector and score vector in the display expression of the initial xylose content prediction model are iteratively updated to obtain the target xylose content prediction model, including: The display expression of the initial xylose content prediction model is expressed as: Y = B PLS X; Among them, the dependent variable matrix Y represents the xylose content, and the independent variable matrix X represents the target feature; B PLS Represents the weight vector w i , load vector p i , coefficient vector b i With the score vector t i The function is expressed as Initialize E0=X, F0=Y, i=1; Update the weight vector w i , expressed as: λ i Representation Matrix The maximum eigenvalue of Update the score vector t i , expressed as: t i =E i-1 w i ; Calculate E i-1 and F i-1 Relative to t i Load vector p i With coefficient vector b i , and the independent variable matrix X with respect to t i The weight vector It is expressed as: calculate It is expressed as: I represents a unit vector; Let i=i+1, update the weight vector w i , load vector p i , coefficient vector b i With the score vector t i , until |t i -t i-1 | is less than a preset threshold, the target weight vector, target load vector, target coefficient vector and target score vector are obtained, and they are substituted into the display expression of the initial xylose content prediction model to obtain the target xylose content prediction model.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method for detecting xylose content based on near infrared spectroscopy as claimed in any one of claims 1 to 9 are implemented.