Near infrared spectrogram analysis model, construction method and device thereof and computer equipment
By constructing a near-infrared spectral analysis model based on the Lasso regression algorithm, and combining stratified sampling and data preprocessing, the hyperparameters and model diagnosis were optimized, solving the problems of long detection time and low accuracy in the detection of Chinese herbal medicine components, and realizing rapid and accurate analysis of Chinese herbal medicine components.
Patent Information
- Application Number
- CN202511252881.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-09-03
- Publication Date
- 2025-11-18
AI Technical Summary
Existing technologies for detecting components in traditional Chinese medicine suffer from problems such as long detection time, high cost, and difficulty in achieving online detection. Near-infrared spectroscopy technology, on the other hand, suffers from severe spectral band overlap, high information redundancy, relatively low signal-to-noise ratio, and low quantitative analysis accuracy.
A near-infrared spectral analysis model was constructed using the Lasso regression algorithm. Data preprocessing was performed using stratified sampling, the Kolmogorov-Smirnov test, and the Savitzky-Golay second derivative method. Hyperparameters were optimized using Bayesian optimization and repeated cross-validation. Model diagnosis was performed using Bootstrap resampling to ensure the robustness and interpretability of the model.
The accuracy and stability of the near-infrared spectroscopy analysis model were improved, the risk of overfitting was reduced, and rapid, non-destructive quantitative analysis of effective components in Chinese medicinal materials was achieved, thus enhancing the practicality and reliability of the model.
Smart Images

Figure CN120977423A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of chemical analysis, in particular to a near-infrared spectrogram analysis model, a construction method and device thereof, and a computer device. BACKGROUND
[0002] Traditional Chinese medicine (TCM) has played an irreplaceable role in maintaining human health as an important means of preventing and treating diseases for thousands of years. With the development of modern medicine and the advancement of globalization, the standardization and modernization of TCM quality control have become a key link to promote the international development of TCM. Traditional Chinese medicine has complex components, and quality control faces many challenges. It is of great significance to establish a rapid, accurate, and reliable quality detection method to ensure the safety and effectiveness of TCM.
[0003] Paeonia lactiflora Pall. is the dried root of Paeonia lactiflora Pall. of the Paeoniaceae family, which is a commonly used traditional Chinese medicinal material. It has the effects of clearing heat and cooling blood, removing blood stasis, and relieving pain, and is widely used in the treatment of cardiovascular diseases, inflammatory diseases, liver diseases, and other diseases. Modern pharmacological studies have shown that Paeoniflorin is one of the main active components of Paeonia lactiflora Pall., and has significant anti-inflammatory, analgesic, liver-protecting, and antioxidant effects. The accurate determination of its content is crucial for the quality control of Paeonia lactiflora Pall. and its preparations.
[0004] Currently, the detection of active ingredients in traditional Chinese medicine mainly relies on separation and analysis techniques such as high-performance liquid chromatography (HPLC), gas chromatography (GC), and liquid chromatography-mass spectrometry (LC-MS). These methods have high accuracy, specificity, and reproducibility, but generally have the disadvantages of complex sample pretreatment, long detection time, high cost, need for large amounts of organic solvents, and difficulty in achieving online detection. In modern industrial production of traditional Chinese medicine, this traditional detection method is difficult to meet the needs of rapid, online, and real-time monitoring, and has become an important bottleneck restricting the development of modern quality control of traditional Chinese medicine.
[0005] As a new analytical technique, near-infrared spectroscopy (NIRS) has been widely applied in food, agriculture, pharmaceutical, petrochemical and other fields due to its advantages such as fast detection speed, simple operation, no sample pretreatment, online detection, environmental friendliness, etc. Near-infrared spectroscopy mainly reflects the frequency doubling and combination vibration information of chemical bonds such as C-H, N-H, O-H and S-H in molecules, and can provide rich information of molecular structure and chemical composition. However, near-infrared spectroscopy also has some inherent limitations, mainly in the aspects of serious spectral band overlap, high information redundancy, relatively low signal-to-noise ratio, relatively low quantitative analysis accuracy, etc. Therefore, the successful application of near-infrared spectroscopy technology largely depends on the advanced chemometric methods for processing and analyzing spectral data.
[0006] Chemometrics is a cross-discipline that applies mathematical, statistical and computer science methods to chemical problems, and plays a crucial role in spectral data analysis. Traditional chemometric methods include linear methods such as partial least squares regression (PLS) and principal component regression (PCR), which have been widely applied and verified in processing spectral data. In recent years, with the rapid development of machine learning and artificial intelligence technologies, more and more advanced algorithms have been introduced into the field of chemometrics, providing new ideas and methods for spectral data analysis. SUMMARY
[0007] Therefore, the present application provides a near-infrared spectrogram analysis model, a construction method and device thereof, and a computer device, to solve the problem of insufficient analysis precision of near-infrared spectroscopy by using traditional chemometrics.
[0008] In a first aspect, the present application discloses a construction method of a near-infrared spectrogram analysis model, comprising the following steps: obtaining a data set, wherein the data set comprises a plurality of near-infrared spectrograms; constructing a regression model by using a Lasso regression algorithm; training the regression model by using the data set to obtain an analysis model of the near-infrared spectrogram.
[0009] The construction method of the near-infrared spectrogram analysis model disclosed by the present application models and trains the near-infrared spectrogram data set by using the Lasso regression algorithm, effectively excavates the linear relationship between the spectral features and the concentration of paeoniflorin, and the constructed model not only has good generalization ability and stability, but also has strong interpretability and high computational efficiency; the experimental results show that the overfitting risk of the linear model is lower than 0.001, which is significantly better than the nonlinear model, thereby greatly improving the practicability and reliability of the model while ensuring the prediction accuracy, and being suitable for rapid and non-destructive quantitative analysis of effective components in traditional Chinese medicinal materials.
[0010] In some optional embodiments, before training the regression model using the data set, further comprising: dividing the data set into a training set, a validation set and a test set by using a stratified sampling method; performing consistency evaluation on the concentration distribution of the training set, the validation set and the test set by using Kolmogorov-Smirnov test, and determining whether there is a significant difference between the training set, the validation set and the test set according to the evaluation result; and when there is a significant difference between the training set, the validation set and the test set, re-dividing the data set.
[0011] The present application divides the data set into a training set, a validation set and a test set by using a stratified sampling method, ensures the representativeness and distribution balance of each subset in the key concentration interval, and effectively avoids the distortion of model training caused by sample distribution deviation; further, the consistency of the concentration distribution of each subset is statistically evaluated by using Kolmogorov-Smirnov test, and when the test result shows a significant difference, the re-division of the data set is triggered, thereby ensuring the independence and fairness of the model training, validation and testing process, significantly reducing the risk of data leakage, improving the credibility and repeatability of the model evaluation result, and providing scientific and rigorous data preprocessing guarantee for the stable construction of near-infrared spectrum analysis model.
[0012] In some optional embodiments, before dividing the data set into a training set, a validation set and a test set by using a stratified sampling method, further comprising: preprocessing the near-infrared spectrum in the data set by using Savitzky-Golay second derivative method; constructing a partial least squares regression model based on the preprocessed near-infrared spectrum, and calculating the variable importance of each wavelength variable, and determining the key features according to the variable importance.
[0013] The present application introduces Savitzky-Golay second derivative method for preprocessing the near-infrared spectrum before dividing the data set, effectively eliminates baseline drift, scattering effect and noise interference, enhances the resolution of the spectrum and the distinguishability of the characteristic peak, and significantly improves the signal-to-noise ratio of the useful signal; on this basis, a partial least squares regression (PLS) model is constructed and the variable importance projection (VIP) value of each wavelength variable is calculated, realizing effective dimension reduction and feature optimization of high-dimensional spectral data, and retaining the most contributive feature information. The strategy of combining preprocessing and feature selection not only improves the accuracy and stability of the model, but also enhances the interpretability of the model, provides high-quality and high-correlation input features for subsequent Lasso regression modeling, and thus improves the performance and reliability of the near-infrared spectrum analysis model as a whole.
[0014] In some optional embodiments, training the regression model by using the data set comprises: obtaining an average performance index corresponding to initial hyperparameters of the regression model by using repeated cross-validation on the training set; using a Bayesian optimization algorithm to take the average performance index as a target function, to establish a surrogate model by using a Gaussian process, and to iteratively search for optimal hyperparameters based on an expected improvement acquisition function; and training the training set by using the optimal hyperparameters to obtain the analysis model of the infrared spectrum.
[0015] The present application efficiently searches for optimal hyperparameters of a Lasso regression model by using Bayesian optimization combined with repeated cross-validation, significantly improves model performance and training efficiency, greatly saves computing time while ensuring higher accuracy compared with traditional methods, and ensures unbiased performance evaluation by using nested cross-validation, thereby enhancing the reliability and practicality of the model.
[0016] In some optional embodiments, after training the training set by using the optimal hyperparameters to obtain the analysis model of the infrared spectrum, the method further comprises: calculating a first determination coefficient of the analysis model on the training set and a second determination coefficient of the analysis model on a validation set; analyzing a risk index of overfitting of the analysis model according to the first determination coefficient and the second determination coefficient; performing bias-variance decomposition on the analysis model by using a Bootstrap resampling method; determining whether the analysis model is overfitted according to the risk index of overfitting and the bias-variance decomposition result; and returning to the step of training the regression model by using the data set to adjust the analysis model when the analysis model is overfitted.
[0017] The present application introduces a risk index of overfitting and Bootstrap bias-variance decomposition to construct a multi-dimensional model diagnosis mechanism, which can accurately identify the overfitting state of the model; when overfitting is detected, the model is retrained to form a closed-loop optimization process, thereby effectively improving the robustness and generalization ability of the near-infrared spectrum analysis model.
[0018] In a second aspect, the present application further provides a near-infrared spectrum analysis model, which is constructed by using the construction method of the near-infrared spectrum analysis model according to the first aspect or any one of the corresponding embodiments thereof.
[0019] In a second aspect, the present application further provides a construction device of a near-infrared spectrum analysis model, comprising an acquisition module, a model construction module and a model training module; wherein the acquisition module is used to acquire a data set, the data set comprising a plurality of near-infrared spectrum images; the model construction module is used to construct a regression model by using a Lasso regression algorithm; and the model training module is used to train the regression model by using the data set to obtain an analysis model of the near-infrared spectrum.
[0020] In a third aspect, the present application further provides a computer device comprising a memory and a processor, the memory and the processor being connected to each other in communication, the memory storing computer instructions, and the processor executing the computer instructions to perform the method for constructing a near-infrared spectrogram analysis model according to the first aspect or any one of the corresponding embodiments thereof.
[0021] In a fourth aspect, the present application further provides a computer readable storage medium storing computer instructions, the computer instructions being used to make a computer execute the method for constructing a near-infrared spectrogram analysis model according to the first aspect or any one of the corresponding embodiments thereof.
[0022] In a sixth aspect, the present application further provides a computer program product comprising computer instructions, the computer instructions being used to make a computer execute the method for constructing a near-infrared spectrogram analysis model according to the first aspect or any one of the corresponding embodiments thereof. BRIEF DESCRIPTION OF DRAWINGS
[0023] In order to more clearly illustrate the specific embodiments of the present application or the technical solutions in the prior art, the drawings required to be used in the specific embodiments or the prior art description will be briefly introduced as follows. Obviously, the drawings in the following description are some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative labor on the basis of these drawings.
[0024] Figure 1 is a flow chart of a method for constructing a near-infrared spectrogram analysis model according to an embodiment of the present application;
[0025] Figure 2 is a flow chart of another method for constructing a near-infrared spectrogram analysis model according to an embodiment of the present application;
[0026] Figure 3 is a schematic diagram of spectral analysis according to an embodiment of the present application;
[0027] Figure 4 is a schematic diagram of feature selection analysis according to an embodiment of the present application;
[0028] Figure 5 is a schematic diagram of model performance comparison according to an embodiment of the present application;
[0029] Figure 6 is a schematic diagram of hyperparameter optimization analysis according to an embodiment of the present application;
[0030] Figure 7 is a schematic diagram of SHAP interpretability analysis according to an embodiment of the present application;
[0031] Figure 8is a structural block diagram of a near-infrared spectrogram analysis model construction device according to an embodiment of the present application.
[0032] Figure 9 is a hardware structure schematic diagram of a computer device of an embodiment of the present application. DETAILED DESCRIPTION
[0033] To make the objectives, technical solutions, and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be described below in connection with the drawings of the embodiments of the present application. Obviously, the described embodiments are some but not all of the embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by a person of ordinary skill in the art without creative work fall within the protection scope of the present application.
[0034] Although near-infrared spectroscopy combined with chemometric methods has been widely used in traditional Chinese medicine analysis, there are still many problems in the methodology of existing research. The data division strategy is too simple, most of the research adopts simple training set-test set two-part method, lacks independent validation set, and may lead to model selection bias and overly optimistic performance evaluation. The hyperparameter optimization often adopts simple grid search or manual tuning, lacks systematicness and efficiency. The cross-validation strategy is often too simple, lacks systematic comparison of different cross-validation methods, especially lacks application of unbiased evaluation methods such as nested cross-validation. The evaluation of overfitting problem is not comprehensive enough, and lacks systematic diagnostic indicators and statistical test methods. The explainability analysis of the model is often ignored, and it is difficult to understand the prediction mechanism of the model from the chemical and spectroscopic point of view.
[0035] Therefore, according to the embodiments of the present application, a near-infrared spectrogram analysis model construction method embodiment is provided. It should be noted that the steps shown in the flowchart of the drawings can be executed in a computer system such as a group of computer executable instructions, and although the logical order is shown in the flowchart, in some cases, the steps shown or described herein can be executed in an order different from that shown herein.
[0036] In the present embodiment, a near-infrared spectrogram analysis model construction method is provided, which can be used in a computer device. Figure 1 is a flowchart of a near-infrared spectrogram analysis model construction method according to an embodiment of the present application, as shown in Figure 1 The flowchart includes the following steps:
[0037] Step S101: Obtain a data set, wherein the data set includes a plurality of near-infrared spectrograms.
[0038] Specifically, the near-infrared spectrogram in the data set is a near-infrared spectrogram of the concentrated liquid of red peony root. The preparation process of the concentrated liquid of red peony root is as follows: red peony root medicinal materials are taken, 10 times the amount of purified water is added according to the traditional water extraction process, and decoction extraction is performed for 3 times, each for 2 hours, the extraction liquid is combined, filtered, and the filtrate is concentrated under reduced pressure to a relative density of 1.10-1.15 (60℃) to obtain the concentrated liquid of red peony root. All the concentrated liquid samples are stored in a 4℃ refrigerator, kept away from light, restored to room temperature before use and fully mixed.
[0039] The near-infrared spectrogram of the concentrated liquid of red peony root is collected using an Antaris II FT-NIR analyzer. The instrument is configured as follows: the detector is an InGaAs detector, the spectral range is 4000-10000 cm-1 (corresponding to wavelength 2500-1000 nm), the spectral resolution is 4 cm-1, the scanning number is 64 times, and the sample chamber temperature is controlled at 25±1℃. The spectral acquisition parameters are set as follows: wavelength range 908.1-1676.2 nm, data point interval about 6.1 nm, a total of 125 wavelength points. Each sample is measured repeatedly for 3 times, and the average value is taken as the final spectral data. Before measurement, the standard white plate provided with the instrument is used for background correction, and the background is corrected once every 10 samples.
[0040] In addition, the regression model needs to use the spectrum as x and the content as y to establish the equation, and the content needs to be detected by liquid chromatography, and the standard substance is used for quantifying the detection results in the liquid chromatography process. Specifically, the paeoniflorin standard substance has a purity of ≥98%. Methanol is chromatographically pure, acetonitrile is chromatographically pure, and phosphoric acid is analytically pure. The resistivity of ultrapure water is ≥18.2 MΩ·cm. All reagents are used within the valid period and meet the analysis requirements. The content of paeoniflorin is detected by an Agilent 1260 Infinity high-performance liquid chromatograph equipped with a diode array detector (DAD). The chromatographic column is an Agilent ZORBAX Eclipse XDB-C18 column (4.6 mm x 250 mm, 5 μm). The mobile phase is methanol-0.1% phosphoric acid aqueous solution (30:70, v / v), the flow rate is 1.0 ml / min, the detection wavelength is 230 nm, the column temperature is 30℃, and the injection volume is 10 μl.
[0041] Step S102: constructing a regression model using a Lasso regression algorithm.
[0042] Step S103: training the regression model using the data set to obtain an analysis model of the near-infrared spectrogram.
[0043] The method for constructing a near-infrared spectrogram analysis model provided in the embodiment effectively mines the linear relationship between the spectral characteristics and the concentration of paeoniflorin by modeling and training the near-infrared spectrogram data set by using the Lasso regression algorithm. The constructed model not only has good generalization ability and stability, but also has strong interpretability and high computational efficiency. The experimental results show that the overfitting risk of the linear model is lower than 0.001, which is significantly better than that of the nonlinear model, thereby greatly improving the practicability and reliability of the model while ensuring the prediction accuracy, and being suitable for rapid and non-destructive quantitative analysis of effective components in traditional Chinese medicinal materials.
[0044] In the embodiment, a method for constructing a near-infrared spectrogram analysis model is provided, which can be used for a computer device. Figure 2 FIG. 2 is a flowchart of another method for constructing a near-infrared spectrogram analysis model according to an embodiment of the present application, as shown in the figure, the flow includes the following steps: Figure 2
[0045] Step S201: Constructing a regression model by using a Lasso regression algorithm.
[0046] Step S202: Obtaining a data set, wherein the data set includes a plurality of near-infrared spectrograms.
[0047] Step S203: Dividing the data set into a training set, a validation set and a test set by using a stratified sampling method.
[0048] Specifically, the embodiment divides the data set into a training set (Training Set), a validation set (Validation Set) and a test set (Test Set) by using a strict three-partitioning strategy, and the ratio is 60:20:20. This division method can realize strict separation of model training, selection and evaluation, and avoid data leakage problems.
[0049] To ensure the representativeness and balance of each subset, the embodiment uses a stratified sampling method based on the concentration of paeoniflorin. For example, all samples are divided into five levels according to the concentration of paeoniflorin: a low concentration group (2.3-10.0 mg / ml), a low-to-medium concentration group (10.1-20.0 mg / ml), a medium concentration group (20.1-30.0 mg / ml), a high-to-medium concentration group (30.1-40.0 mg / ml) and a high concentration group (40.1-50.0 mg / ml). Within each concentration level, samples are randomly allocated to the training set, the validation set and the test set according to the ratio of 60:20:20.
[0050] Step S204: Using Kolmogorov-Smirnov test to evaluate the consistency of the concentration distribution of the training set, the validation set and the test set, and judging whether there is a significant difference between the training set, the validation set and the test set according to the evaluation result.
[0051] Step S205: When there is a significant difference between the training set, the validation set and the test set, the data set is re-divided.
[0052] That is, the consistency of the concentration distribution among the three subsets is evaluated using the Kolmogorov-Smirnov test (K-S test). The K-S test is a non-parametric test method used to compare whether two samples come from the same distribution. The null hypothesis of the test is that the two samples come from the same distribution, and the alternative hypothesis is that the two samples come from different distributions. When the p-value is greater than 0.05, the null hypothesis is accepted, and it is considered that there is no significant difference in the distribution of the two samples.
[0053] For example, 201 different batches of red peony root concentrate samples were collected, and the samples were derived from 15 major production areas in China, including Inner Mongolia, Heilongjiang, Jilin, Liaoning, Hebei, Shandong, Anhui, Zhejiang, Jiangsu, Hubei, Sichuan, Yunnan, Gansu, Ningxia and Xinjiang. The collection of samples strictly followed the relevant provisions of the Pharmacopoeia of the People's Republic of China 2020 edition, ensuring the representativeness and quality of the samples. All samples were identified by professional Chinese medicine practitioners and confirmed as the dried roots of Paeonia lactiflora Pall. of the Paeoniaceae Paeonia genus.
[0054] For the data set containing 201 samples, a three-way division strategy based on concentration stratified sampling was used, which was divided into: 120 samples (59.7%) for the training set, 40 samples (19.9%) for the validation set and 41 samples (20.4%) for the test set. The Kolmogorov-Smirnov test results showed that there was no significant difference in the concentration distribution among the three subsets: training set vs validation set (p=0.847), training set vs test set (p=0.923), and validation set vs test set (p=0.756), all greater than the significance level of 0.05, indicating that the data division successfully maintained the distribution balance of each subset.
[0055] The stratified sampling strategy effectively ensured the uniform distribution of each concentration level in the three subsets. The proportion of the low concentration group (2.3-10.0 mg / ml) in the training set, validation set, and test set was 28.3%, 27.5%, and 29.3%, respectively; the proportion of the low-to-moderate concentration group (10.1-20.0 mg / ml) was 31.7%, 32.5%, and 31.7%, respectively; the proportion of the moderate concentration group (20.1-30.0 mg / ml) was 22.5%, 22.5%, and 22.0%, respectively; the proportion of the moderate-to-high concentration group (30.1-40.0 mg / ml) was 12.5%, 12.5%, and 12.2%, respectively; and the proportion of the high concentration group (40.1-50.0 mg / ml) was 5.0%, 5.0%, and 4.9%, respectively. The difference in the distribution of each level in the three subsets was less than 2%, proving the effectiveness of the stratified sampling strategy.
[0056] In some optional embodiments, before the data set is divided into the training set, the validation set, and the test set by the stratified sampling method in step S103, the method further comprises: pre-processing the near-infrared spectrogram in the data set by the Savitzky-Golay second derivative method; constructing a partial least squares regression model based on the pre-processed near-infrared spectrogram, and calculating the variable importance of each wavelength variable to determine the key features according to the variable importance. The key features are the key wavelength points for modeling.
[0057] This is because the near-infrared spectroscopy data is easily affected by factors such as baseline drift, scattering effect, and noise interference, and needs to be pre-processed by an appropriate method to eliminate these interferences and highlight useful spectral information. By systematically comparing the effects of various pre-processing methods, the Savitzky-Golay second derivative method is finally selected as the optimal pre-processing method. The specific parameter settings are: window length of 11 data points, polynomial order of 2, and derivative order of 2. This method can effectively eliminate baseline drift, enhance spectral resolution, and highlight the characteristic absorption peaks related to paeoniflorin.
[0058] Variable importance in projection (VIP) is a feature selection method based on partial least squares regression, which can quantify the contribution of each variable to the prediction ability of the model. Generally, variables with a VIP value greater than 1.0 are considered to have important contributions to the model and should be retained. First, a PLS regression model is established using all 125 wavelength points, and the optimal principal component number is determined by cross-validation. Then, the VIP value of each wavelength point is calculated, and important wavelength points are selected as modeling features according to the VIP>1.0 standard.
[0059] The original near-infrared spectra of the 201 samples of the concentrated liquid of the red peony root show typical absorption characteristics of organic compounds. In the wavelength range of 908.1-1676.2 nm, the following characteristic absorption peaks are mainly observed: the 1200-1300 nm region mainly corresponds to the double frequency and combination frequency vibration of C-H bonds, reflecting the C-H bond information of the sugar ring and aglycone part in the paeoniflorin molecule; the 1350-1450 nm region mainly corresponds to the double frequency vibration of O-H bonds, reflecting the information of the hydroxyl group in the paeoniflorin molecule; the 1450-1550 nm region mainly corresponds to the combination frequency vibration of N-H and O-H bonds, and the double frequency vibration of C-H bonds; and the 1550-1650 nm region mainly corresponds to the double frequency vibration of C=O bonds and the combination frequency vibration of O-H bonds.
[0060] The Savitzky-Golay second derivative pretreatment significantly improves the spectral quality. The pretreated spectrum effectively eliminates the baseline drift caused by the difference in physical properties of the samples, and makes the baseline of all spectra consistent. The second derivative processing enhances the resolution of the spectrum, and makes the overlapping absorption peaks better separated. The Savitzky-Golay filtering performs smoothing processing while deriving, effectively controlling the amplification of noise. The pretreated spectrum better highlights the characteristic absorption related to paeoniflorin, and improves the signal-to-noise ratio.
[0061] Figure 3 is a schematic diagram of spectral analysis according to an embodiment of the present application. As can be seen from A in Figure 3 , the original near-infrared spectrum shows the absorption characteristics of the 201 samples of the concentrated liquid of the red peony root in the wavelength range of 908.1-1676.2 nm; as can be seen from B in Figure 3 , the spectrum after Savitzky-Golay second derivative pretreatment effectively enhances the spectral resolution and eliminates the baseline drift; as can be seen from C in Figure 3 , the concentration distribution of paeoniflorin shows a right-skewed lognormal distribution characteristic, and the concentration range is 2.3-50.0 mg / ml; as can be seen from D in Figure 3 , the absorption intensity at the key wavelength of 1365 nm shows a good linear relationship with the concentration of paeoniflorin.
[0062] PLS-VIP analysis successfully identified 50 important wavelength features (VIP > 1.0), accounting for 40% of the total number of wavelength points. These important features are mainly distributed in the following regions: the 1273.6-1285.4 nm region contains 12 wavelength points (for example, "1273.6-1285.4 nm region contains 12 wavelength points" means that within this wavelength range, there are 12 specific measurement points (such as 1273.6, 1274.6, 1275.6,..., 1284.6 nm, etc.) identified as important features), with an average VIP value of 1.89 ± 0.23, corresponding to the double frequency vibration of the C-H bond; the 1354.2-1385.1 nm region contains 18 wavelength points, with an average VIP value of 2.34 ± 0.45, corresponding to the one-fold frequency vibration of the O-H bond, which is the most important feature region; the 1432.7-1456.3 nm region contains 11 wavelength points, with an average VIP value of 1.67 ± 0.31, corresponding to the combination frequency vibration of the C-H bond and the O-H bond; the 1598.4-1623.7 nm region contains 9 wavelength points, with an average VIP value of 1.45 ± 0.28, corresponding to the one-fold frequency vibration of the C=O bond.
[0063] The performance of the model established using the selected 50 features is significantly better than that of the model using all 125 features. Taking PLS regression as an example, the cross-validation R 2 from 0.9785 to 0.9823, and the RMSE decreased from 1.89 mg / ml to 1.76 mg / ml, while the stability of the model was also improved, with the cross-validation standard deviation decreasing from 0.0156 to 0.0089. Feature selection not only improved the performance of the model, but also significantly reduced the computational complexity, with the model training time shortening from an average of 15.6 seconds to 6.8 seconds, a reduction of 56.4%.
[0064] Figure 4 is a feature selection analysis diagram according to an embodiment of the present application. As can be seen from A in Figure 4 , the PLS-VIP feature importance distribution shows the importance scores of the 125 wavelength points, with the red dashed line representing the threshold of VIP = 1.0; as can be seen from B in Figure 4 , the selected 50 important features (VIP > 1.0) are mainly distributed in the 1273-1450 nm region; as can be seen from C in Figure 4 , the feature importance heat map visually displays the distribution pattern of important wavelengths; as can be seen from D in Figure 4 , the cumulative feature importance curve shows that the first 50 features contribute more than 80% of the prediction ability.
[0065] Step S206: training the regression model using the data set to obtain an analysis model of the near-infrared spectrum.
[0066] In some optional embodiments, training the regression model with the dataset to obtain the analysis model of the near-infrared spectrogram comprises the following steps:
[0067] Step S2061: Using repeated cross-validation on the training set to obtain the average performance index corresponding to the initial hyperparameters of the regression model.
[0068] To ensure the reliability and unbiasedness of the model performance evaluation, the present embodiment implements repeated cross-validation (Repeated CV).
[0069] Step S2062: Using the Bayesian optimization algorithm, taking the average performance index as the objective function, establishing a surrogate model through Gaussian process, and iteratively searching for the optimal hyperparameters based on the expected improvement acquisition function.
[0070] Among them, Bayesian optimization is a global optimization method based on probability model, which is particularly suitable for scenarios where the evaluation cost of the objective function is high. The present embodiment uses the scikit-optimize library to realize Bayesian optimization, uses Gaussian process as the surrogate model, and uses expected improvement (Expected Improvement) as the acquisition function.
[0071] Step S2063: Training the optimal hyperparameters and the training set to obtain the analysis model of the infrared spectrogram.
[0072] In the present embodiment, seven advanced chemometric algorithms are compared, covering different types of methods such as linear and nonlinear, parametric and non-parametric, single and ensemble: partial least squares regression (PLS), Lasso regression, ridge regression (Ridge), elastic network regression (ElasticNet), support vector regression-radial basis kernel (SVR-RBF), support vector regression-linear kernel (SVR-Linear) and random forest (Random Forest). All models are implemented using Python 3.11 and scikit-learn 1.7.0 library.
[0073] The performance of the seven models on the test set is shown in Table 1.
[0074] Table 1. Comprehensive comparison of model performance
[0075]
[0076] The experimental results show that the Lasso regression model performs best, with a test set R 2The model achieved a mean squared error of 0.9994, an RMSE of only 1.11 mg / ml, a mean amplitude of 0.89 mg / ml, and a relative prediction deviation (RPD) of 12.4, far exceeding the excellent standard of 3.0. The overfitting risk of this model was only 0.0008, indicating excellent generalization ability.
[0077] Linear models (PLS, Lasso, Ridge, ElasticNet) generally outperform nonlinear models (SVR-RBF, SVR-Linear, Random Forest). This result indicates that, in the current dataset and feature space, there is primarily a linear relationship between paeoniflorin concentration and spectral features. Linear models possess advantages such as strong generalization ability, good stability, strong interpretability, and high computational efficiency, with overfitting risk less than 0.001, far lower than that of nonlinear models.
[0078] Figure 5 This is a schematic diagram comparing the model performance according to an embodiment of the present invention. Figure 5 As shown in A, the R values of the seven models on the training, validation, and test sets are... 2 In performance comparison, Lasso regression showed the best performance; by Figure 5 As shown in B, the RMSE performance comparison indicates that Lasso regression has the lowest prediction error; from Figure 5 As shown in C, the scatter plot of the optimal model (Lasso) predictions vs. actual values, R 2 =0.9994, RMSE = 1.11 mg / ml; from Figure 5 As shown in D, the overfitting risk analysis indicates that the linear model has better generalization ability.
[0079] This embodiment compares two hyperparameter optimization strategies: grid search and Bayesian optimization. Experimental results show that Bayesian optimization achieves better performance on most models while significantly reducing computation time. Lasso regression obtained the optimal α = 0.0008 through Bayesian optimization, and the validation set R... 2 =0.9996, optimization time 32 seconds, a performance improvement of 0.07% compared to grid search, and a time saving of 73%. PLS regression obtained the optimal principal component number of 9 through Bayesian optimization, and the validation set R... 2 =0.9987, optimization time 25 seconds, performance improvement 0.02%, time saving 44%.
[0080] Bayesian optimization achieved better performance in 5 models (PLS, Lasso, ElasticNet, SVR-RBF, SVR-Linear), with an average performance improvement of 0.072% and an average time saving of 63.2%. The advantages of Bayesian optimization mainly lie in strong global search capability, good parameter space continuity, adaptive search strategy and high computational efficiency.
[0081] Figure 6 is a schematic diagram of hyperparameter optimization analysis according to an embodiment of the application. From A in Figure 6 , the performance comparison between grid search and Bayesian optimization shows that Bayesian optimization performs better on most models; from B in Figure 6 , the calculation time comparison shows that Bayesian optimization significantly improves the optimization efficiency; from C in Figure 6 , the optimization efficiency analysis (performance / time ratio) proves the advantages of Bayesian optimization; from D in Figure 6 , the Bayesian optimization convergence curve (taking Lasso as an example) shows the fast convergence characteristics.
[0082] In this embodiment, four different cross-validation strategies are compared: 5-fold cross-validation (5-Fold CV), 10-fold cross-validation (10-Fold CV), repeated cross-validation (Repeated CV) and nested cross-validation (Nested CV). Nested cross-validation is the gold standard method for obtaining unbiased model performance estimates, the outer 5-fold cross-validation is used for performance evaluation, and the inner 5-fold cross-validation is used for hyperparameter optimization, providing unbiased performance estimates. The results of the four cross-validation strategies show that nested cross-validation provides the most reliable unbiased performance estimate, and its results are slightly lower than those of other methods, because nested cross-validation avoids model selection bias and provides more conservative but more reliable performance evaluation. Taking the Lasso model as an example, the average R 2 = 0.9989 ± 0.0006, the average R 2 = 0.9988 ± 0.0007, the average R 2 = 0.9989 ± 0.0005, and the average R 2 = 0.9988 ± 0.0006.
[0083] Repeated cross-validation shows the highest stability, with a standard deviation of only 0.0005, because multiple repetitions reduce the impact of a single random partition. Although nested cross-validation has the highest computational cost, it provides the most reliable performance evaluation and is the gold standard method for model comparison and selection.
[0084] Step S207: Determine whether the analysis model is overfitting. When the analysis model is overfitting, go to step S108.
[0085] In some optional embodiments, determining whether the analysis model is overfitting includes the following steps:
[0086] Step S2071: calculating a first determination coefficient of the analysis model on the training set and a second determination coefficient on the validation set.
[0087] Step S2072: analyzing the overfitting risk index of the analysis model according to the first determination coefficient and the second determination coefficient.
[0088] Step S2073: performing bias-variance decomposition on the analysis model by Bootstrap resampling method.
[0089] Step S2074: determining whether the analysis model is overfitting according to the overfitting risk index and the bias-variance decomposition result.
[0090] Step S208: when the analysis model is overfitting, returning to the step of training the regression model with the data set and adjusting the analysis model.
[0091] That is, the embodiment establishes a multi-dimensional overfitting diagnosis framework. An important feature of overfitting is that the performance of the model on the training set is significantly better than the performance on the validation set. The overfitting risk index is: overfitting risk = (training set R 2 -validation set R 2 ) / training set R 2 . According to the size of the overfitting risk, the model is divided into four levels: no overfitting (risk <0.01), slight overfitting (0.01≤risk<0.02), moderate overfitting (0.02≤risk<0.05), and severe overfitting (risk≥0.05).
[0092] Bias-variance decomposition is performed by Bootstrap resampling method, and the resampling number is set to 100. For regression problems, the expected mean square error of the model can be decomposed into three parts: bias, variance and noise. Among them, bias (Bias) is the difference between the expected value of the model prediction and the true value; variance (Variance) represents the variation degree of the model prediction value; noise (Noise) is the irreducible error in the data.
[0093] For example, according to the overfitting risk index, the overfitting degrees of the seven models are classified as follows: no overfitting (risk < 0.01) includes PLS (0.0002), Lasso (0.0008), Ridge (0.0002), ElasticNet (0.0002); moderate overfitting (0.02≤risk<0.05) includes SVR-RBF (0.0058), SVR-Linear (0.0066), Random Forest (0.0479). Linear models show excellent generalization ability, while nonlinear models have different degrees of overfitting problems.
[0094] The bias-variance decomposition by Bootstrap resampling reveals the error source characteristics of different models. The bias of Lasso regression is 2=0.89, the variance is =0.34, the noise is =0.88, and the total MSE is =2.11, which achieves the best balance between bias and variance, which explains its excellent overall performance. The bias of Random Forest is 2=2.34, the variance is =1.89, the noise is =0.88, and the total MSE is =5.11, the high variance indicates that it is too sensitive to changes in training data, and there is an overfitting problem.
[0095] Further, the trained analysis model can also be subjected to SHAP explainability analysis. The SHAP analysis determines the most important wavelength regions for the prediction of paeoniflorin. The global feature importance ranking shows that the average |SHAP value| of 1365.2 nm is =0.0456, corresponding to the O-H bond one-fold frequency vibration; the average |SHAP value| of 1378.9 nm is =0.0423, corresponding to the O-H bond one-fold frequency vibration; the average |SHAP value| of 1354.7 nm is =0.0398, corresponding to the O-H bond one-fold frequency vibration; the average |SHAP value| of 1273.6 nm is =0.0345, corresponding to the C-H bond two-fold frequency vibration; the average |SHAP value| of 1445.3 nm is =0.0312, corresponding to the C-H and O-H bond one-fold frequency vibration.
[0096] SHAP analysis of different concentration samples shows that in high concentration samples (>30mg / ml), the SHAP values in the 1365-1378nm region are significantly positive, indicating that these wavelengths contribute most to high concentration prediction; in medium concentration samples (10-30mg / ml), multiple wavelength regions contribute, and the SHAP value distribution is relatively uniform; in low concentration samples (<10mg / ml), the SHAP values in the 1273-1285nm region are relatively large, indicating that these wavelengths are more sensitive to low concentration samples.
[0097] The SHAP analysis result is highly consistent with the molecular structure of paeoniflorin and near-infrared spectrum theory. The 1354-1378 nm region corresponds to the O-H bond vibration of the six hydroxyl groups in the paeoniflorin molecule, which is the most important prediction feature, which is completely consistent with the chemical structure of paeoniflorin. The 1273-1285 nm region corresponds to the C-H bond vibration of the glucose group in the paeoniflorin molecule, which reflects the contribution of the sugar ring part to the spectrum. The 1445-1456 nm region corresponds to the vibration of the paeoniflorin aglycone part, indicating that the aglycone structure also has an important influence on the spectral characteristics of paeoniflorin.
[0098] Figure 7 is a SHAP explainability analysis schematic diagram according to an embodiment of the application. It can be known from A in Figure 7 that the global SHAP feature importance shows that the 1273-1450 nm region is the most important prediction feature; it can be known from B in Figure 7 that the SHAP value distribution box plot of the key wavelength shows the variability of the feature contribution; it can be known from C in Figure 7 that the SHAP value heat map shows the contribution mode of different samples and wavelengths; and it can be known from D in Figure 7 that the average contribution analysis of different wavelength regions shows that the 1300-1500 nm region has the largest contribution.
[0099] Further, the method for constructing the near-infrared spectrum analysis model further comprises: evaluating the analysis model by using a preset evaluation index, wherein the evaluation index comprises at least one of the following: a determination coefficient, a root mean square error, a mean absolute error, and a relative prediction deviation.
[0100] The application realizes comprehensive and quantitative evaluation of the performance of the analysis model by introducing the determination coefficient R 2 , the root mean square error RMSE, the mean absolute error MAE, and the relative prediction deviation RPD, and especially, the applicability and prediction ability of the model can be intuitively judged by using the RPD grading standard, thereby significantly improving the scientificity and reliability of the model evaluation.
[0101] For example, the established method is comprehensively verified according to the ICH Q2(R1) guideline. The linear relationship is good in the linear range of 2.3-50.0 mg / ml, and R 2 =0.9994. In terms of precision, the reproducibility RSD=1.8%, and the intermediate precision RSD=2.1%, both of which are less than 3%. In terms of accuracy, the recovery rate test result is 98.5%-101.8%, which meets the requirement of 98%-102%. The limit of detection LOD=0.15 mg / ml, and the limit of quantification LOQ=0.45 mg / ml. In terms of durability, there is no significant difference (p>0.05) in the results measured by different operators and at different times.
[0102] The comparison results with the traditional HPLC method show that the NIR-chemometrics method has significant advantages in detection time, sample pretreatment, reagent consumption, detection cost, environmental protection and online detection capability. The detection time is shortened from 30-40 minutes to 2-3 minutes, which is increased by 15-20 times; the sample pretreatment is simplified from complex pretreatment to no pretreatment; the reagent consumption is saved from a large amount of organic solvent to none; the detection cost is reduced from 5.2 yuan / sample to 0.5 yuan / sample, which is reduced by 90%; the green and pollution-free detection is realized; and the online detection function is realized. Although the precision (RSD 1.8%) is slightly lower than that of the HPLC method (RSD 1.2%), it still meets the quality control requirements.
[0103] In summary, the present application successfully establishes a rapid detection method for paeoniflorin content in red peony root concentrate based on near-infrared spectroscopy technology combined with chemometrics method, effectively solves the key problems existing in traditional chemometrics modeling. Through the three-way data set division strategy based on concentration stratified sampling, the problems of data leakage and performance evaluation bias are successfully avoided, and the statistical test proves the consistency of the distribution of each subset. The Bayesian optimization strategy shows significant advantages in hyperparameter optimization, compared with the traditional grid search method, not only improves the model performance, but also greatly reduces the calculation time. The application of nested cross-validation provides unbiased estimation for model performance evaluation, ensuring the scientific reliability of the results.
[0104] The optimal model obtains very high prediction accuracy on the test set, with a correlation coefficient of 0.9994 and a prediction residual ratio of more than 12.4, exceeding the excellent standard of quantitative analysis. The detection efficiency is improved by 15-20 times compared with the traditional chromatographic method, the detection cost is reduced by 90%, and green and environmentally friendly detection is realized. These performance indicators fully prove the technical advancement and practical value of the established method, meeting the rapid, accurate and economic detection needs of modern industrial production.
[0105] The model established in the study provides an important theoretical support for near-infrared spectroscopy analysis. The key wavelength region determined by SHAP analysis has a clear correspondence with the characteristic functional groups in the molecular structure of paeoniflorin, providing a chemical-level scientific explanation for spectral prediction. The application of bias-variance decomposition theory reveals the error sources and generalization mechanism of different algorithms, enriching the theoretical foundation of chemometrics.
[0106] The technology provides a modern means for the quality control of red peony root and its preparations, and can be used for real-time monitoring and quality control in the production process. The pilot application in multiple enterprises proves its good industrialization prospect. At the same time, the technology provides an efficient detection means for drug regulatory departments, which helps to improve the efficiency and quality of supervision.
[0107] The methodology framework has good universality and can be applied to the quality control of other Chinese herbal medicines and natural products, providing technical support for the standardization and internationalization development of Chinese medicine quality control. The strict verification strategy and methodology framework established in this study have important scientific significance and practical value for promoting the development of chemometrics theory, promoting the progress of Chinese medicine analysis technology, and supporting the modernization development of traditional Chinese medicine industry.
[0108] In the embodiment, a device for constructing a near-infrared spectrogram analysis model is also provided, which is used to implement the above embodiments and preferred embodiments, and will not be described again. As used below, the term "module" can be a combination of software and / or hardware that implements a predetermined function. Although the device described in the following embodiments is preferably implemented in software, hardware, or a combination of software and hardware is also possible and contemplated.
[0109] The embodiment provides a device for constructing a near-infrared spectrogram analysis model, as shown in Figure 8 , comprising:
[0110] The acquisition module 801 is configured to acquire a data set, wherein the data set includes a plurality of near-infrared spectrograms.
[0111] The model construction module 802 is configured to construct a regression model using a Lasso regression algorithm.
[0112] The model training module 803 is configured to train the regression model using the data set to obtain an analysis model of the near-infrared spectrogram.
[0113] In some optional embodiments, the device for constructing a near-infrared spectrogram analysis model further comprises a data set division module. Before training the regression model using the data set, the data set division module is configured to: divide the data set into a training set, a validation set and a test set using a stratified sampling method; perform consistency evaluation of concentration distribution on the training set, the validation set and the test set using Kolmogorov-Smirnov test, and determine whether there is a significant difference between the training set, the validation set and the test set according to the evaluation result; and when there is a significant difference between the training set, the validation set and the test set, re-divide the data set.
[0114] In some optional embodiments, the device for constructing a near-infrared spectrogram analysis model further comprises a data preprocessing module. Before dividing the data set into a training set, a validation set and a test set using a stratified sampling method, the data preprocessing module is configured to: preprocess the near-infrared spectrograms in the data set using a Savitzky-Golay second derivative method; construct a partial least squares regression model based on the preprocessed near-infrared spectrograms, and calculate the variable importance of each wavelength variable, and determine the key features according to the variable importance.
[0115] In some optional embodiments, the model training module 803 is specifically configured to: obtain an average performance index corresponding to the initial hyperparameters of the regression model on the training set by using repeated cross-validation; use a Bayesian optimization algorithm, take the average performance index as a target function, establish a surrogate model by a Gaussian process, and iteratively search for optimal hyperparameters based on an expected improvement acquisition function; and train the infrared spectrum image analysis model by using the optimal hyperparameters and the training set.
[0116] In some optional embodiments, after the infrared spectrum image analysis model is trained by using the optimal hyperparameters and the training set, the model training module 803 is further configured to: calculate a first determination coefficient of the analysis model on the training set and a second determination coefficient of the analysis model on the validation set; analyze a risk index of overfitting of the analysis model according to the first determination coefficient and the second determination coefficient; perform bias-variance decomposition on the analysis model by a Bootstrap resampling method; determine whether the analysis model is overfitted according to the risk index of overfitting and the bias-variance decomposition result; and when the analysis model is overfitted, return to the step of training the regression model by using the data set and adjust the analysis model.
[0117] In some optional embodiments, the near-infrared spectrum image analysis model construction apparatus further comprises a model evaluation module. The model evaluation module is configured to evaluate the analysis model by using a preset evaluation index, wherein the evaluation index comprises at least one of the following: a determination coefficient, a root mean square error, a mean absolute error, and a relative prediction deviation.
[0118] Further function descriptions of the above-mentioned modules and units are the same as those of the corresponding embodiments, and will not be described here.
[0119] The near-infrared spectrum image analysis model construction apparatus in the embodiment is presented in the form of a functional unit. The unit herein refers to an ASIC (Application Specific Integrated Circuit, Application Specific Integrated Circuit) circuit, a processor and a memory executing one or more software or fixed programs, and / or other devices that can provide the above-mentioned functions.
[0120] The embodiment of the present application also provides a computer device having the near-infrared spectrum image analysis model construction apparatus described above. Figure 8 The near-infrared spectrum image analysis model construction apparatus is shown in the computer device.
[0121] Please refer to Figure 9 , Figure 9 is a structural schematic diagram of a computer device provided by an optional embodiment of the present application, as shown in Figure 9As shown, the computer device includes one or more processors 10, memory 20, and interfaces for connecting the components, including high-speed interfaces and low-speed interfaces. The components communicate with each other via different buses and can be mounted on a common motherboard or otherwise installed as needed. The processors can process instructions executed within the computer device, including instructions stored in or on memory to display graphical information of a GUI on external input / output devices (such as display devices coupled to the interfaces). In some alternative implementations, multiple processors and / or multiple buses can be used with multiple memories and multiple memory modules, if desired. Similarly, multiple computer devices can be connected, each providing some of the necessary operations (e.g., as a server array, a group of blade servers, or a multiprocessor system). Figure 9 Take a processor 10 as an example.
[0122] Processor 10 may be a central processing unit, a network processor, or a combination thereof. Processor 10 may further include a hardware chip. The hardware chip may be an application-specific integrated circuit (ASIC), a programmable logic device (PLD), or a combination thereof. The programmable logic device may be a complex programmable logic device (CAMP), a field-programmable gate array (FPGA), a general-purpose array logic (GDA), or any combination thereof.
[0123] The memory 20 stores instructions executable by at least one processor 10 to cause at least one processor 10 to perform the method shown in the above embodiments.
[0124] The memory 20 may include a program storage area and a data storage area. The program storage area may store the operating system and applications required for at least one function; the data storage area may store data created based on the use of the computer device. Furthermore, the memory 20 may include high-speed random access memory and may also include non-transitory memory, such as at least one disk storage device, flash memory device, or other non-transitory solid-state storage device. In some alternative embodiments, the memory 20 may optionally include memory remotely located relative to the processor 10, and these remote memories may be connected to the computer device via a network. Examples of such networks include, but are not limited to, the Internet, intranets, local area networks, mobile communication networks, and combinations thereof.
[0125] The memory 20 may include volatile memory, such as random access memory; the memory may also include non-volatile memory, such as flash memory, hard disk or solid-state drive; the memory 20 may also include a combination of the above types of memory.
[0126] The computer device also includes an input device 30 and an output device 40. The processor 10, memory 20, input device 30, and output device 40 can be connected via a bus or other means.Figure 9 The bus connection is taken as an example.
[0127] The input device 30 can receive inputted digital or character information, and generate key signal input related to user settings and function control of the computer device, such as a touch screen, a keypad, a mouse, a trackpad, a touchpad, a pointing stick, one or more mouse buttons, a trackball, a joystick, etc. The output device 40 can include a display device, an auxiliary lighting device (e.g., an LED), a tactile feedback device (e.g., a vibration motor), etc. The display device includes, but is not limited to, a liquid crystal display, a light-emitting diode, a display, and a plasma display. In some alternative embodiments, the display device can be a touch screen.
[0128] The embodiments of the present application also provide a computer readable storage medium, the method according to the embodiments of the present application can be implemented in hardware, firmware, or recorded in a storage medium, or stored in a remote storage medium or a non-transitory machine readable storage medium and downloaded from a network and stored in a local storage medium, so that the method described herein can be processed by such software on a storage medium using a general purpose computer, a special purpose processor, or programmable or special purpose hardware. Among them, the storage medium can be a magnetic disk, an optical disk, a read-only memory, a random access memory, a flash memory, a hard disk or a solid state disk, etc.; further, the storage medium can also include a combination of the above types of memories. It can be understood that the computer, processor, microprocessor controller or programmable hardware includes a storage component that can store or receive software or computer code, when the software or computer code is accessed and executed by the computer, processor or hardware, the method shown in the above embodiments is implemented.
[0129] Part of the present application can be applied as a computer program product, for example, computer program instructions, when executed by a computer, the operation of the computer can invoke or provide the method and / or technical solutions according to the present application. Those skilled in the art should understand that the form of computer program instructions in computer readable medium includes but is not limited to source file, executable file, installation package file, etc., and accordingly, the way of computer program instructions executed by computer includes but is not limited to: the computer directly executes the instructions, or the computer compiles the instructions and then executes the corresponding compiled program, or the computer reads and executes the instructions, or the computer reads and installs the instructions and then executes the corresponding installed program. Here, the computer readable medium can be any available computer readable storage medium or communication medium accessible to the computer.
[0130] While embodiments of the application have been described in connection with the preferred embodiments of the various figures, those of ordinary skill in the art will appreciate that various modifications and variations of the preferred embodiments can be employed without departing from the spirit and scope of the application.
Claims
1. A method of constructing a near infrared spectrogram analysis model, characterized by, The method comprises the following steps: acquiring a data set, wherein the data set comprises a plurality of near-infrared spectrograms; constructing a regression model by using a Lasso regression algorithm; training the regression model by using the data set to obtain an analysis model of the near-infrared spectrogram.
2. The method of claim 1, wherein, Before the training of the regression model by using the data set, the method further comprises the following steps: dividing the data set into a training set, a validation set and a test set by using a stratified sampling method; performing consistency evaluation on the concentration distribution of the training set, the validation set and the test set by using a Kolmogorov-Smirnov test, and determining whether there is a significant difference between the training set, the validation set and the test set according to the evaluation result; when there is a significant difference between the training set, the validation set and the test set, re-dividing the data set.
3. The method of claim 1, wherein, Before the data set is divided into the training set, the validation set and the test set by using the stratified sampling method, the method further comprises the following steps: preprocessing the near-infrared spectrograms in the data set by using a Savitzky-Golay second derivative method; constructing a partial least squares regression model based on the preprocessed near-infrared spectrograms, calculating the variable importance of each wavelength variable, and determining the key features according to the variable importance.
4. The method of claim 2, wherein, The training of the regression model by using the data set comprises the following steps: obtaining an average performance index corresponding to the initial hyperparameters of the regression model by using a repeated cross-validation method on the training set; using a Bayesian optimization algorithm, taking the average performance index as a target function, establishing a surrogate model by using a Gaussian process, and iteratively searching for optimal hyperparameters based on an expected improvement acquisition function; training the infrared spectrogram analysis model by using the optimal hyperparameters and the training set.
5. The method of claim 2, wherein, After the training of the infrared spectrogram analysis model by using the optimal hyperparameters and the training set, the method further comprises the following steps: calculating a first determination coefficient of the analysis model on the training set and a second determination coefficient of the analysis model on the validation set; calculating a risk index of overfitting of the analysis model according to the first determination coefficient and the second determination coefficient; performing bias-variance decomposition on the analysis model by using a Bootstrap resampling method; determining whether the analysis model is overfitted according to the risk index of overfitting and the bias-variance decomposition result; when the analysis model is overfitted, returning to the step of training the regression model by using the data set, and adjusting the analysis model.
6. A near infrared spectrogram analysis model, characterized by, The method is constructed by using the near-infrared spectrogram analysis model construction method in any one of claims 1-5.
7. A device for constructing a near-infrared spectral analysis model, characterized in that, The method comprises the following steps: an acquisition module, configured to acquire a data set, wherein the data set comprises a plurality of near-infrared spectrograms; a model construction module, configured to construct a regression model by using a Lasso regression algorithm; a model training module, configured to train the regression model by using the data set to obtain an analysis model of the near-infrared spectrogram.
8. A computer device, comprising: The method comprises the following steps: A memory and a processor, which are in communication connection with each other, the memory has computer instructions stored therein, and the processor executes the computer instructions to perform the method for constructing the near infrared spectrogram analysis model according to any one of claims 1 to 5.
9. A computer-readable storage medium, characterized in that, The computer readable storage medium has computer instructions stored thereon, and the computer instructions are used to make the computer perform the method for constructing the near infrared spectrogram analysis model according to any one of claims 1 to 5.
10. A computer program product, characterised in that, The computer readable storage medium has computer instructions stored thereon, and the computer instructions are used to make the computer perform the method for constructing the near infrared spectrogram analysis model according to any one of claims 1 to 5.
Citation Information
Patent Citations
Near infrared spectrum variable selection method based on LASSO
CN105203498A
Method for rapid determination of pulping material extraction matter content on basis of near infrared spectroscopy technology
CN105352909A
Spectral data processing method and system for integrated modeling, medium, product and equipment
CN118780402A
Soil quick-acting potassium measuring method, system and medium
CN119557752A
Generation of chemometric models
WO2025125102A1