A method for Raman spectrum classification using stacking ensemble learning model
Through the improved stacking ensemble learning model, the Raman spectral data set is divided into multiple subsets and a two-layer model is constructed, which solves the problem of limitations in the existing technology of single model recognition effect, realizes efficient substance classification of microbial single cells, and improves recognition accuracy and stability.
Patent Information
- Application Number
- CN202211521853.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-11-30
- Publication Date
- 2025-08-29
- Estimated Expiration
- 2042-11-30
AI Technical Summary
When the existing Raman spectroscopy analysis methods identify microbial single cells, the single classification model has limited effect and failed to fully utilize spectral characteristics, resulting in insufficient recognition accuracy and stability.
The improved stacking integrated learning model is adopted to divide the Raman spectral data set into multiple subsets, and the optimal basic model and meta-model are selected through cross-validation, and the two-layer integrated learning model is constructed for spectral feature fusion, and the advantages of different algorithms are used for identification.
The utilization rate of Raman spectral data is improved, the accuracy and stability of identification are enhanced, and the efficient classification of microbial single cells is achieved.
Smart Images

Figure CN115862007B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of Raman spectrum classification methods, and in particular to a method for classifying Raman spectra using a stacking ensemble learning model. Background Art
[0002] Raman spectroscopy is an important technical means for analyzing the chemical structure of substances. It can provide a label-free, non-invasive in situ cell identification method and is particularly suitable for species identification and metabolic research of single-cell microorganisms. The Raman map of single-cell microorganisms can be used as a "chemical fingerprint" for bacterial species identification, containing rich biochemical information about the microorganism under specific physiological states. Compared with other microbial identification methods such as fluorescent labeling, Raman spectroscopy has the advantages of being label-free, non-invasive, non-destructive, real-time, and rapid, and can truly realize in situ analysis of single-cell microorganisms.
[0003] Raman features associated with DNA, RNA, proteins, lipids, collagen, and other biomacromolecules are primarily found in the 800-1800 cm-1 region of the Raman spectrum. -1 Most studies have analyzed the spectrum in the fingerprint (FP) region, and a small number of studies have explored the high wavenumber (HP) region (2800-3800cm -1 ) for spectral recognition; related studies have shown that the effect of analyzing the FP region alone is better than that of analyzing the HW region alone, and the effect of analyzing the FP and HW regions simultaneously is better than that of analyzing the FP or HW region alone.
[0004] When analyzing Raman spectra, all spectral data are preprocessed to remove the spectral baseline using algorithms such as airPLS. Some studies have also shown that the spectral baseline is somewhat correlated with the fluorescence background of the sample, but existing technologies have not further explored whether the spectral baseline of Raman spectra can be used for Raman spectral analysis.
[0005] Because the characteristic differences between Raman spectra are very subtle, computer methods such as machine learning and deep learning are often used to distinguish spectra when analyzing them. For example, algorithms such as principal component analysis-linear discriminant analysis (PCA-LDA), K-nearest neighbor (KNN), partial least squares-discriminant analysis (PLS-DA), support vector machines (SVM), artificial neural networks (ANN) or convolutional neural networks (CNN) are widely used. Existing Raman spectroscopy studies mostly use LDA and SVM classification models, which can only perform identification and analysis on a single spectral dataset.
[0006] The stacking ensemble learning algorithm is one of the commonly used algorithms in data mining. It can integrate different models to perform recognition and analysis on the same data set. The present invention aims to optimize and improve the stacking ensemble learning algorithm and use it to fuse models for different data sets. Summary of the Invention
[0007] To overcome the shortcomings of the existing technology, the present invention provides a method for classifying Raman spectra using a stacking ensemble learning model. This new model, targeting different data sets, can increase the accuracy and stability of Raman spectral material identification, addressing the limitations of a single classification model and the inability to fully utilize spectral features.
[0008] A method for classifying Raman spectra using a stacking ensemble learning model, comprising:
[0009] Step 1: Divide a Raman spectral data set into 5 data sets by data segmentation and merging. The 5 data sets are:
[0010] ① Complete data set: 400-3800cm -1 The spectral data within the spectral range is taken as a data set, i.e., a complete spectrum, and spectral preprocessing is performed;
[0011] ② Fingerprint area data set: 800-1800cm -1 The spectral data within the spectral range is taken as a data set and spectral preprocessing is performed;
[0012] ③ High wavenumber region data set: 2800-3800cm -1 The spectral data within the spectral range is taken as a data set and spectral preprocessing is performed;
[0013] ④ Background data set: The spectral background removed by the baseline removal algorithm is retained as a new data set; pre-processing is performed according to the cosmic ray removal, filtering, and background removal processes, and then the spectral background data is obtained by subtracting the background removal data from the data before background removal, and then normalization is performed;
[0014] As an example, the background data method uses the air-PLS algorithm;
[0015] As an example, the normalization method adopts minimum-maximum normalization;
[0016] As an example, the spectrum preprocessing process described in ① to ③ includes: removing cosmic rays, filtering, removing background and normalization, and the normalized data is within the threshold of 0-1.
[0017] As an example, the spectral intensities at the same wavenumber position in data sets ① to ④ are different, which means that the degree of amplification and reduction of different features is different.
[0018] As an example, the same wavenumber position means that the X-axis position range of the spectrum is the same, that is, the same spectral range; the values corresponding to the same X-axis position in different data sets are different because normalization has been performed;
[0019] ⑤Integrated dataset: Merge the first four datasets into one dataset containing all information;
[0020] As an example, the integrated dataset is the sum of the complete dataset, the fingerprint region dataset, the high-wavenumber region dataset, and the background dataset. Therefore, the integrated dataset has more features and a larger dimension.
[0021] As an example, a Raman spectroscopy data set can be divided into multiple data sets by data segmentation and merging, and is not limited to 5 data sets.
[0022] Step 2: Select the first-level basic model for the five data sets; the model selection includes:
[0023] ① Divide the five data sets into training sets and test sets using cross-validation;
[0024] ②Train different classification models in the training set;
[0025] ③ Use the trained different classification models to predict the test set;
[0026] That is, the five data sets are input into different classification models, and different machine learning or deep learning algorithms are used to train different classification models for each of the five data sets, and then prediction is performed;
[0027] As an example, the different classification models include: support vector machine model (SVM), linear discriminant analysis model (LDA), k-nearest neighbor model (KNN), extreme gradient boosting model (XGBoost), and decision tree model.
[0028] As an example, the different classification models may also select other machine learning or deep learning recognition models, including but not limited to artificial neural networks (ANN), convolutional neural networks (CNN), and recurrent neural networks (RNN).
[0029] Step 3: Select one optimal classification model from each of the five data sets as the retained one, and then obtain five optimal models; after completing all the cross-validation classification model training and prediction in step 2, we will also obtain the prediction results of the five data sets;
[0030] Step 4: Merge the prediction results of the five data sets using the five optimal models to complete new feature integration and construct a new feature data set;
[0031] Step 5: Input the new feature data set into the second-level meta-model, and again use different classification models to train and predict the new feature data set, and compare the results of different models;
[0032] That is, the new feature data sets are input into different classification models respectively;
[0033] As an example, the different classification models include: support vector machine model (SVM), linear discriminant analysis model (LDA), k-nearest neighbor model (KNN), extreme gradient boosting model (XGBoost) and decision tree model.
[0034] As an example, the different classification models may also select other machine learning or deep learning recognition models, including but not limited to ANN, CNN, RNN, etc.
[0035] Step 6: After completing all comparisons in step 5, select the optimal metamodel result of the second-level metamodel;
[0036] Step 7: In this way, the optimal two-layer ensemble learning model for the five data sets is obtained, and the final prediction is completed;
[0037] As an example, in order to ensure that different data sets correspond to the same samples when predicting, we shuffle the samples before training and ensure that the order of the samples remains unchanged in all subsequent training processes.
[0038] As an example, the same sample means: in order to ensure that each data item in different data sets is derived from the same Raman spectrum, that is, the order is not disrupted during the data splitting and model training process, so that the data at the same position in each data set is derived from the same original spectrum.
[0039] Beneficial effects of the present invention:
[0040] ① The present invention can fully utilize all the characteristics of Raman spectroscopy and greatly improve the utilization rate of Raman spectroscopy data;
[0041] ② It integrates the advantages of different recognition model algorithms and is a stable spectral recognition model.
[0042] ③By extracting different features of Raman spectra to construct different data sets, the improved stacking ensemble learning model is used to build spectral recognition models for different data sets to achieve accurate classification of materials based on Raman spectra. BRIEF DESCRIPTION OF THE DRAWINGS
[0043] Figure 1 This is a schematic diagram of the composition of five data sets in a method of classifying Raman spectra using a stacking ensemble learning model according to the present invention.
[0044] Figure 2 This is a principle design block diagram of a method for classifying Raman spectra using a stacking ensemble learning model in the present invention. DETAILED DESCRIPTION
[0045] The preferred embodiments of the present invention are described in detail below with reference to the accompanying drawings.
[0046] Reference Figures 1 to 2 As shown, a method for classifying Raman spectra using a stacking ensemble learning model includes:
[0047] Step 1: Divide a Raman spectral data set into 5 data sets by data segmentation and merging. The 5 data sets are:
[0048] ① Complete data set: 400-3800cm -1 The spectral data within the spectral range is taken as a data set, i.e., a complete spectrum, and spectral preprocessing is performed;
[0049] ② Fingerprint area data set: 800-1800cm -1 The spectral data within the spectral range is taken as a data set and spectral preprocessing is performed;
[0050] ③ High wavenumber region data set: 2800-3800cm -1 The spectral data within the spectral range is taken as a data set and spectral preprocessing is performed;
[0051] ④ Background data set: The spectral background removed by the baseline removal algorithm is retained as a new data set; pre-processing is performed according to the cosmic ray removal, filtering, and background removal processes, and then the spectral background data is obtained by subtracting the background removal data from the data before background removal, and then normalization is performed;
[0052] As an example, the background data method uses the air-PLS algorithm;
[0053] As an example, the normalization method adopts minimum-maximum normalization;
[0054] As an example, the spectrum preprocessing process described in ① to ③ includes: removing cosmic rays, filtering, removing background and normalization, and the normalized data is within the threshold of 0-1.
[0055] As an example, the spectral intensities at the same wavenumber position in data sets ① to ④ are different, which means that the degree of amplification and reduction of different features is different.
[0056] As an example, the same wavenumber position means that the X-axis position range of the spectrum is the same, that is, the same spectral range; the values corresponding to the same X-axis position in different data sets are different because normalization has been performed;
[0057] ⑤Integrated dataset: Merge the first four datasets into one dataset containing all information;
[0058] As an example, the integrated dataset is the sum of the complete dataset, the fingerprint region dataset, the high-wavenumber region dataset, and the background dataset. Therefore, the integrated dataset has more features and a larger dimension.
[0059] As an example, a Raman spectroscopy data set can be divided into multiple data sets by data segmentation and merging, and is not limited to 5 data sets.
[0060] Step 2: Select the first-level basic model for the five data sets; the model selection includes:
[0061] ① Divide the five data sets into training sets and test sets using cross-validation;
[0062] ②Train different classification models in the training set;
[0063] ③ Use the trained different classification models to predict the test set;
[0064] That is, the five data sets are input into different classification models, and different machine learning or deep learning algorithms are used to train different classification models for each of the five data sets, and then prediction is performed;
[0065] As an example, the different classification models include: support vector machine model (SVM), linear discriminant analysis model (LDA), k-nearest neighbor model (KNN), extreme gradient boosting model (XGBoost), and decision tree model.
[0066] As an example, the different classification models may also select other machine learning or deep learning recognition models, including but not limited to artificial neural networks (ANN), convolutional neural networks (CNN), and recurrent neural networks (RNN).
[0067] Step 3: Select one optimal classification model from each of the five data sets as the retained one, and then obtain five optimal models; after completing all the cross-validation classification model training and prediction in step 2, we will also obtain the prediction results of the five data sets;
[0068] Step 4: Merge the prediction results of the five data sets using the five optimal models to complete new feature integration and construct a new feature data set;
[0069] Step 5: Input the new feature data set into the second-level meta-model, and again use different classification models to train and predict the new feature data set, and compare the results of different models;
[0070] That is, the new feature data sets are input into different classification models respectively;
[0071] As an example, the different classification models include: support vector machine model (SVM), linear discriminant analysis model (LDA), k-nearest neighbor model (KNN), extreme gradient boosting model (XGBoost) and decision tree model.
[0072] As an example, the different classification models may also select other machine learning or deep learning recognition models, including but not limited to ANN, CNN, RNN, etc.
[0073] Step 6: After completing all comparisons in step 5, select the optimal metamodel result of the second-level metamodel;
[0074] Step 7: In this way, the optimal two-layer ensemble learning model for the five data sets is obtained, and the final prediction is completed;
[0075] As an example, in order to ensure that different data sets correspond to the same samples when predicting, we shuffle the samples before training and ensure that the order of the samples remains unchanged in all subsequent training processes.
[0076] As an example, the same sample means: in order to ensure that each data item in different data sets is derived from the same Raman spectrum, that is, the order is not disrupted during the data splitting and model training process, so that the data at the same position in each data set is derived from the same original spectrum.
[0077] In order to better illustrate the design and classification principles of the invention, a specific embodiment is now used to illustrate the invention. This example uses gastric cancer cell line analysis and research:
[0078] Example 1:
[0079] This example illustrates the application of this method to the Raman spectra of various gastric cancer cell lines. Figure 1 As shown: The Raman spectral dataset of each cell line is collected to construct a Raman spectral dataset containing all gastric cancer cell lines; then the above method is used to identify the gastric cancer cell lines.
[0080] The specific steps include:
[0081] Dataset division: The gastric cancer Raman spectroscopy dataset was reconstructed into five spectral datasets: full spectrum dataset (400-3800cm -1 ), fingerprint area dataset (800-1800cm -1 ), high wavenumber region dataset (2800-3800cm -1 ), background dataset (400-3800cm -1 ) and integrated datasets.
[0082] The preprocessing process for the full spectrum dataset, fingerprint region dataset, and high-wavenumber dataset is as follows: cosmic ray removal, SG filtering, air-PLS background removal, and minimum-maximum normalization. The background dataset first undergoes basic spectral preprocessing: cosmic ray removal, SG filtering, and air-PLS background removal. The background data is then obtained by subtracting the background-removed data from the pre-background-removed data, and then performing minimum-maximum normalization on the data.
[0083] Model building;
[0084] Dataset division: To ensure the stability of the model prediction results, we chose five-fold cross-validation, dividing each dataset into five parts, dividing the training set and test set in a 4:1 ratio, and using each part as the test set for prediction.
[0085] Basic model training: Each dataset was input into five machine learning models (LDA, SVM, XGBoost, KNN, and decision tree). After 5-fold cross-validation, the five test accuracy rates were obtained. The average of the five test accuracy rates was used to obtain the prediction accuracy of each model for each dataset.
[0086] Basic model selection:
[0087] Select a model with the highest accuracy for each data set and use cross-validation training again; assuming that the most suitable model for the full spectrum data set is LDA, then we get the LDA prediction results for each cell spectrum data in the full spectrum data set; it is a matrix of size number of samples × number of sample categories.
[0088] Construction of a new feature dataset: The best model prediction results of each dataset are integrated to construct a new dataset. Since these five datasets are split from a single dataset, they essentially correspond to the same batch of individual cells. In other words, the data at the same position in each cell set comes from the same cell. Therefore, each piece of data in the constructed new feature dataset is the prediction result of the five selected models for the five data of one cell.
[0089] Meta-model training: The new feature dataset is input into the five different machine learning models in the second layer (LDA, SVM, XGBoost, KNN, and decision tree). After 5-fold cross-validation, the five test accuracy rates are obtained. The average is then used to obtain the prediction accuracy of each model for the new feature dataset.
[0090] Metamodel selection: The model that selects the best classification results is the metamodel of the algorithm.
[0091] This method fully utilizes all the characteristics of Raman spectroscopy, significantly improving the utilization rate of Raman spectral data. It also integrates the advantages of different recognition model algorithms to create a stable spectral recognition model. By extracting different features from the Raman spectrum to construct different data sets, an improved stacking ensemble learning model is used to construct spectral recognition models tailored to each data set, enabling accurate classification of substances using Raman spectra.
[0092] The above are only preferred embodiments of the present invention. It should be understood that the description of the above embodiments is only used to help understand the method and core ideas of the present invention, and is not used to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, etc. made within the ideas and principles of the present invention should be included in the scope of protection of the present invention.
Claims
1. A method for classifying Raman spectra using a stacking ensemble learning model, comprising: Step 1: Divide a Raman spectral data set into 5 data sets by data segmentation and merging. The 5 data sets are: ① Complete data set: 400-3800cm -1 The spectral data within the spectral range are taken as a data set, i.e., the complete spectrum; And perform spectral preprocessing; ② Fingerprint area data set: 800-1800cm -1 The spectral data within the spectral range are taken as a data set; And perform spectral preprocessing; ③ High wavenumber region data set: 2800-3800cm -1 The spectral data within the spectral range are taken as a data set; And perform spectral preprocessing; ④ Background data set: The spectral background removed by the baseline removal algorithm is retained as a new data set; pre-processing is performed according to the cosmic ray removal, filtering, and background removal processes, and then the spectral background data is obtained by subtracting the background removal data from the data before background removal, and then normalization is performed; ⑤Integrated dataset: Merge the first four datasets into one dataset containing all information; Step 2: Select the first-level basic model for the five data sets; the model selection includes: ① Divide the five data sets into training sets and test sets using cross-validation; ②Train different classification models in the training set; ③ Use the trained different classification models to predict the test set; That is, the five data sets are input into different classification models, and different machine learning or deep learning algorithms are used to train different classification models for each of the five data sets, and then prediction is performed; Step 3: Select one optimal classification model from each of the five data sets as the retained model, thereby obtaining five optimal models; after completing all cross-validation classification model training and prediction in step 2, the prediction results of the five data sets will also be obtained; Step 4: Merge the prediction results of the five data sets using the five optimal models to complete new feature integration and construct a new feature data set; Step 5: Input the new feature data set into the second-level meta-model, and again use different classification models to train and predict the new feature data set, and compare the results of different models; That is, the new feature data sets are input into different classification models respectively; Step 6: After completing all comparisons in step 5, select the optimal metamodel result of the second-level metamodel; Step 7: In this way, the optimal two-layer ensemble learning model for the five data sets is obtained to complete the final prediction.
2. The method for classifying Raman spectra using a stacking ensemble learning model according to claim 1, characterized in that: The background data set uses the air-PLS algorithm to extract the spectral background signal.
3. The method for classifying Raman spectra using a stacking ensemble learning model according to claim 1, characterized in that: The spectral preprocessing process of the complete data set, fingerprint region data set and high wavenumber region data set includes: removing cosmic rays, filtering, removing background and normalization, and the normalized data is within the threshold of 0-1.
4. The method for classifying Raman spectra using a stacking ensemble learning model according to claim 1, wherein: The spectral intensities at the same wavenumber position in the complete data set, the fingerprint region data set, the high wavenumber region data set and the background data set are different, that is, the degree of amplification and reduction of different features are different.
5. The method for classifying Raman spectra using a stacking ensemble learning model according to claim 4, characterized in that: The same wavenumber position means that the X-axis position range of the spectrum is the same, that is, the same spectral range; the values corresponding to the same X-axis position in different data sets are different because normalization operation has been performed.
6. The method for classifying Raman spectra using a stacking ensemble learning model according to claim 1, characterized in that: The different classification models include: support vector machine model SVM, linear discriminant analysis model LDA, k-nearest neighbor model KNN, extreme gradient boosting model XGBoost and decision tree model.
7. The method for classifying Raman spectra using a stacking ensemble learning model according to claim 1, characterized in that: The different classification models may also select other machine learning or deep learning recognition models.
8. The method for classifying Raman spectra using a stacking ensemble learning model according to claim 1, characterized in that: In order to ensure that different data sets correspond to the same sample during prediction, the samples are shuffled before training, and the order of the samples remains unchanged in all subsequent training processes.
9. The method for classifying Raman spectra using a stacking ensemble learning model according to claim 8, wherein: The same sample means that in order to ensure that each data item in different data sets is derived from the same Raman spectrum, the order is not disrupted during data splitting and model training, so that the data at the same position in each data set is derived from the same original spectrum.
10. The method for classifying Raman spectra using a stacking ensemble learning model according to claim 1, wherein: A Raman spectroscopy dataset is divided into multiple datasets through data segmentation and merging.