A stability-driven multi-objective optimization method for feature spectral feature extraction
By employing a stability-driven multi-objective optimization method, the optimal wavelength and band operator features were selected, solving the problems of interference and collinearity in spectral analysis. This resulted in high-precision and low-redundancy feature extraction, improving the effectiveness of agricultural product quality detection and near-infrared analysis.
Patent Information
- Application Number
- CN202611277263.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-08-21
- Publication Date
- 2026-11-17
AI Technical Summary
Existing spectral analysis techniques are susceptible to sample morphology differences and instrument fluctuations when processing near-infrared spectra of agricultural products, leading to spectral interference, difficulties in handling collinear variables, redundancy in high-dimensional feature extraction, high model complexity, and difficulty in achieving high predictive power and physicochemical interpretability.
A stability-driven multi-objective optimization method is adopted. By acquiring a full-band spectral dataset, a calibration set is constructed through random sampling and repeated sampling. The optimal wavelength and band operator features are gradually selected by combining the NSGA-II multi-objective evolutionary algorithm and the greedy search algorithm to construct the optimal prediction model.
It achieves high stability, high interpretability and low redundancy in feature wavelength selection, improves the accuracy of spectral modeling and the generalization ability of the model, reduces feature redundancy and enhances the ability to express complex chemical information.
Smart Images

Figure CN123115757A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to a characteristic spectral target optimization method, which relates to the fields of near-infrared spectroscopy analysis and chemometrics modeling, and specifically to a stability-driven multi-objective optimization method for characteristic spectral feature extraction. Background Technology
[0002] Near-infrared spectra of agricultural products are often affected by differences in sample morphology and instrument fluctuations, resulting in optical path variations and baseline drift, manifesting as widespread multiplicative and additive interference in the acquired spectra. Existing global preprocessing methods (such as Standard Normal Variate (SNV) or Multiplicative Scatter Correction (MSC)) rely on full-spectrum statistics for correction. When distortion occurs in local spectral regions, it can easily cause a global baseline shift, reducing the stability of subsequent feature extraction. In contrast, local algebraic operations such as band ratios or normalized differences are less affected by fluctuations in non-overlapping bands. Therefore, it is necessary to develop local adaptive anti-interference methods to effectively eliminate additive and multiplicative interference.
[0003] Near-infrared spectroscopy reflects the overtones and combination absorptions of chemical bonds, with overlapping bands and multicollinearity. Conventional feature extraction algorithms based on single wavelengths are susceptible to physical fluctuations and often extract redundant band clusters, failing to substantially reduce model complexity and increasing the risk of overfitting and random correlations. Although algebraically derived features such as band differences and ratios can compensate for physical interference, one-dimensional screening algorithms struggle to generate and evaluate such high-dimensional interactive features. Exploring band combinations across the entire spectrum leads to an exponentially growing search space; traditional exhaustive methods are computationally expensive, while conventional heuristic algorithms are prone to getting trapped in local optima when dealing with high-dimensional noisy data.
[0004] Furthermore, while existing band relationship features can effectively suppress the effects of light scattering and baseline drift, their generation results are highly dependent on the quality of the initial wavelength selection. If the input wavelengths exhibit strong randomness or redundancy, subsequent band relationship construction is prone to generating a large number of invalid combinations. Therefore, it is necessary to establish a stable and reliable wavelength selection mechanism before constructing band relationships, coupled with feature selection rules that have multi-objective optimization, to obtain a concise feature set that combines high predictive power with physicochemical interpretability.
[0005] In summary, existing spectral analysis techniques have limitations in areas such as interference mitigation, handling of collinear variables, extraction of high-dimensional algebraic features, and feature interpretability. Summary of the Invention
[0006] To address the problems existing in the background technology, the present invention provides a stability-driven multi-objective optimization method for feature spectral feature extraction.
[0007] The technical solution adopted in this invention is:
[0008] The stability-driven multi-objective optimization method for feature spectral feature extraction of the present invention includes:
[0009] Step S1: Obtain the full-band spectral dataset of the sample to be analyzed, and randomly sample and repeatedly construct a calibration set. Based on each calibration set, construct a comprehensive wavelength evaluation index for each wavelength variable of the sample to be analyzed, and then gradually reduce the wavelength variables using a progressive variable elimination method to obtain a candidate wavelength set.
[0010] Step S2: Perform multi-objective optimization on the candidate wavelength set to obtain the optimal solution set, and then perform wavelength local distillation screening on the optimal solution set to obtain the original optimal wavelength set.
[0011] Step S3: Construct a candidate pool of band operators based on the original optimal wavelength set, and gradually introduce band operator features using a forward evaluation method to construct the optimal wavelength feature set. Establish a prediction model based on the optimal wavelength feature set to obtain the prediction results of the sample to be analyzed, thereby realizing the extraction of the characteristic spectral features of the sample to be analyzed.
[0012] In step S1, the samples to be analyzed include several different samples of the same variety. First, the original spectral data matrix and its response variable matrix of the samples to be analyzed are obtained. The original spectral data matrix is composed of the spectral data of different wavelength variables of each sample, and the response variable matrix is composed of the response variables of each sample. Then, the original spectral data matrix is preprocessed by mean centering and together with the response variable matrix, it constitutes the full-band spectral dataset of the samples to be analyzed.
[0013] In step S1, for each calibration set obtained from random sampling, a partial least squares regression (PLSR) model is first established based on the calibration set. Then, the regression coefficients of each wavelength variable are extracted to construct a regression coefficient vector. Finally, the regression coefficient vectors obtained from each random sampling are concatenated to form a regression coefficient matrix. Based on the regression coefficient matrix, importance indicators and stability indicators of each wavelength variable are constructed, and then a comprehensive wavelength evaluation index for each wavelength variable is constructed. Based on the comprehensive wavelength evaluation index, each wavelength variable is sorted in descending order. When using a progressive variable elimination method, an exponential decreasing function is used to iteratively reduce the number of wavelength variables with low comprehensive wavelength evaluation indices to obtain a candidate wavelength set.
[0014] In step S1, the specific wavelength comprehensive evaluation indicators are as follows:
[0015]
[0016]
[0017]
[0018] Among them, I b and S b These represent the importance and stability indices of the b-th wavelength variable, respectively; M represents the total number of random samples; β b (m) Let represent the regression coefficient of the b-th wavelength variable in the m-th random sampling. τ is an indicator function that takes the value 1 when the condition is met and 0 otherwise; τ is the stability threshold.
[0019] In step S2, the candidate wavelength set and its response variable matrix are used as a multi-objective search space. The NSGA-II multi-objective evolutionary algorithm is used to determine the optimal number of wavelengths to be retained and the indices of each retained wavelength variable. Then, the optimized combination of wavelength variables is extracted from the candidate wavelength set. The NSGA-II multi-objective evolutionary algorithm is optimized based on the objective function, as follows:
[0020]
[0021]
[0022]
[0023] Where f1, f2, and f3 represent the first, second, and third objective functions to be optimized, respectively; This represents the root mean square error of cross-validation obtained after inputting the current combination of wavelength variables and its response variable matrix into the partial least squares regression model; n v S represents the number of wavelength variables in the current wavelength variable combination; b This represents the stability index of the b-th wavelength variable in the current wavelength variable combination;
[0024] The Pareto optimal solution set, which includes multiple combinations of wavelength variables and their response variable matrices, is obtained through iterative optimization using the NSGA-II multi-objective evolutionary algorithm.
[0025] In step S2, for each wavelength variable combination in the optimal solution set, the wavelength variables in the wavelength variable combination are arranged from smallest to largest according to the physical spectral dimension. Then, wavelength local distillation is performed, and adjacent wavelength variables in the wavelength variable combination are divided into several screening groups according to a preset window width interval W. Only the wavelength variable with the highest comprehensive wavelength evaluation index in each screening group is retained as the representative wavelength variable, and other wavelength variables in the same screening group are deleted. This process continues until all wavelength variable combinations in the optimal solution set have been screened. The representative wavelength variables obtained from the screening of each wavelength variable combination are merged, and duplicate wavelength variables are removed to obtain the original optimal wavelength set.
[0026] In step S3, for each pair of wavelength variables in the original optimal wavelength set, the band operator features between the spectral intensities of the two wavelength variables are obtained. The band operator features are one or more of the band difference features, band sum features, band ratio features, and normalized difference features between the two wavelength variables. Each band operator feature is used to construct a band operator candidate pool.
[0027] In step S3, an initial partial least squares regression model is established based on the original optimal wavelength set and its response variable matrix, thereby obtaining the initial root mean square error of cross-validation (RMSECV) and the coefficient of determination (R²). 2 Using the initial root mean square error (RMSE) and coefficient of determination (CCD) of cross-validation as evaluation metrics, a forward evaluation method is employed. A greedy search algorithm is used to search for the optimal band operator features. For each round of the greedy search algorithm, the band operator features updated in the current round's candidate pool are used as candidate features to be evaluated. The response variable matrix for each wavelength variable corresponding to each candidate feature is obtained as the response variable matrix to be evaluated. For each candidate feature and its response variable matrix, a partial least squares regression model is constructed to obtain the RMSE and CCD of the current candidate feature. The first difference (ΔRMSECV) between the current RMSE and the initial RMSE is obtained, along with the second difference (ΔR) between the current CCD and the initial CCD. 2 When △RMSECV<0 or △R 2If the value is greater than 0, the current candidate feature to be evaluated is determined to meet the model improvement conditions, and the current candidate feature to be evaluated is taken as the initial optimal feature. The initial optimal feature with the smallest first difference ΔRMSECV among the initial optimal features is taken as the optimal band operator feature of the current round and added to the current optimal feature set. The optimal band operator features retained in the previous rounds are retained in the current optimal feature set in subsequent rounds and removed from the band operator candidate pool. The optimal feature set of the current round and the response variable matrix of each corresponding wavelength variable are obtained as the search response variable matrix. Based on the optimal feature set of the current round and the search response variable matrix, the partial least squares regression model of the current round is constructed. The root mean square error of cross-validation and the coefficient of determination of the current round are used as the evaluation index of the greedy search process of the next round. The greedy search process is repeated until there are no candidate features to be evaluated that meet the model improvement conditions in the current round, or the greedy search for a preset number of consecutive times fails to obtain candidate features to be evaluated that meet the model improvement conditions, and then the search is terminated.
[0028] The wavelength variables corresponding to the final optimal feature set are extracted to construct the final optimal wavelength set; the final partial least squares regression model is established based on the optimal feature set, the final optimal wavelength set and their corresponding response variable matrix, and the final partial least squares regression model is used as the prediction model.
[0029] The electronic device of the present invention includes: a memory and a processor coupled to each other, wherein the memory stores program data, and the processor invokes the program data to execute the method described above.
[0030] The present invention provides a computer-readable storage medium having program data stored thereon, which, when executed by a processor, implements the method described above.
[0031] The beneficial effects of this invention are:
[0032] This invention addresses the problems of high randomness, high redundancy, poor model reliability, and poor ability to express linear spectral relationships in existing spectral feature wavelength screening methods during high-dimensional spectral data analysis. It can achieve automatic screening of feature wavelengths with high stability, high interpretability, and low redundancy, effectively uncovering synergistic relationships between different spectral regions, reducing feature redundancy, and improving the model's ability to express complex chemical information. This improves the accuracy of spectral modeling and the model's generalization ability, and can be used as a general method in fields such as agricultural product quality detection, multispectral system band design, and rapid non-destructive near-infrared analysis. Attached Figure Description
[0033] Figure 1 This is a flowchart of the method of the present invention;
[0034] Figure 2 This is a spectral curve of the dataset used in this invention, wherein, Figure 2 (a) is a spectral curve of the SIMUIN simulation dataset (dataset D1). Figure 2 (b) is the spectral curve of the chili pepper dataset (dataset D2);
[0035] Figure 3 This is a visualization of the solution set distribution of the NSGA-II multi-objective optimization method of the present invention, wherein... Figure 3 (a) is a visualization of the distribution of the multi-objective optimization solution set based on the SIMUIN simulation dataset (dataset D1). Figure 3 (b) is a visualization of the distribution of the multi-objective optimization solution set based on the chili pepper dataset (dataset D2);
[0036] Figure 4 This is a schematic diagram showing the distribution of the feature wavelengths extracted by the method of this invention and the competitive adaptive reweighted sampling algorithm CARS on the SIMUIN simulated dataset (dataset D1);
[0037] Figure 5 This is a schematic diagram showing the distribution of the feature wavelengths extracted by the method of this invention and the competitive adaptive reweighting algorithm CARS on the chili pepper dataset (dataset D2). Detailed Implementation
[0038] The present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments.
[0039] like Figure 1 As shown, the stability-driven multi-objective optimization method for feature spectral feature extraction of the present invention is as follows:
[0040] Step S1: Obtain the full-band spectral dataset of the samples to be analyzed. The samples to be analyzed include several different samples of the same variety. Specifically, the samples to be analyzed are intact, fresh, and undamaged agricultural products, such as chili peppers of the same variety. First, obtain the original spectral data matrix and its response variable matrix of the samples to be analyzed. The original spectral data matrix consists of the spectral data of different wavelength variables of each sample collected by the spectrometer. The response variable matrix consists of the response variables of each sample, such as the total capsaicin content of chili peppers collected in advance. Then, after the original spectral data matrix is preprocessed by mean centering, it together with the response variable matrix to form the full-band spectral dataset of the samples to be analyzed.
[0041] This embodiment uses the SIMUIN simulation dataset (denoted as dataset D1) and a chili pepper dataset (denoted as dataset D2) to verify the effectiveness of the method of the present invention. Dataset D1 combines a noise-free data matrix, an additional matrix of uninformative variables, and noise. It is a classic simulation benchmark dataset in the fields of chemometrics and spectroscopic analysis, initially used to test algorithms for eliminating uninformative variables, and subsequently widely used to evaluate various spectral variable screening algorithms. This dataset contains 150 data points, each containing 200 simulated wavelength variables, with a wavelength range of 1-200 nm and a wavelength interval of 1 nm. Dataset D2 contains 143 real chili pepper samples and their total capsaicin content. This set of data was acquired online using a near-infrared spectrometer on a chili pepper sorting production line; the wavelength range is 791-1150 nm, with a wavelength interval of 0.35 nm, totaling 1024 wavelengths. The spectral curves of datasets D1 and D2 are shown below. Figure 2 (a) and Figure 2 As shown in (b).
[0042] In practice, datasets D1 and D2 are imported into the MATLAB variable space, and the original spectral data matrix is set to X. all (N sample , B), N sample Let B be the number of samples, B be the number of wavelengths, and y be the response variable matrix. all (N sample 1) The spectral matrix is preprocessed by mean centering, and then divided into a calibration set and a prediction set according to a preset ratio. The initial calibration set accounts for 80% of the total samples, and the prediction set accounts for 20% of the total samples, i.e., N sample_cal =0.8N sample N sample_val =0.2N sample The initial calibration set is used for wavelength variable selection and model training, and its spectral matrix is denoted as X. cal (N sample_cal B), the response variable matrix is denoted as y cal (N sample_cal , 1); The prediction set is used for independent performance verification, and its spectral matrix is denoted as X. val (N sample_val B) The response variable matrix is denoted as y val (N sample_val , 1). In this embodiment, for dataset D1, N sample = 150, B=200, X cal (N sample_cal B) X val (N sample_val B) , This represents the size of the real matrix. For dataset D2, N sample =143, B=1024, X cal (N sample_cal B) X val (N sample_val B) .
[0043] Random sampling is repeatedly used to construct calibration sets. Based on each calibration set, a comprehensive wavelength evaluation index for each wavelength variable of the sample to be analyzed is constructed. Then, a progressive variable elimination method is used to gradually reduce the wavelength variables to obtain a candidate wavelength set. For each calibration set obtained from random sampling, a partial least squares regression (PLSR) model is first established based on the calibration set. Then, the regression coefficients of each wavelength variable are extracted to construct a regression coefficient vector. Finally, the regression coefficient vectors obtained from each random sampling are concatenated to form a regression coefficient matrix. Based on the regression coefficient matrix, importance and stability indicators for each wavelength variable are constructed, and then a comprehensive wavelength evaluation index for each wavelength variable is constructed. Based on the comprehensive wavelength evaluation index, each wavelength variable is sorted in descending order. When using the progressive variable elimination method, an exponential decreasing function is used to iteratively reduce the number of wavelength variables with low comprehensive wavelength evaluation indices to obtain a candidate wavelength set.
[0044] In practice, M Monte Carlo random samplings are performed on the calibration set. Each time, 80% of the initial calibration set samples are randomly selected to construct a sub-calibration set. The sub-calibration set obtained from the m-th (m≤M) sampling is represented as... , where N sub N is the number of samples in the sub-calibration set. sub =0.8N sample_cal A PLSR model is built for each sub-calibration set, thereby obtaining a regression coefficient vector of length B for the sub-calibration set sampled for the m-th time. That is, each modeling operation generates a row vector containing regression coefficients of B wavelength variables, as follows:
[0045]
[0046] in, Let represent the regression coefficients corresponding to the 1st, 2nd, ..., Bth wavelength variables in the PLSR model established by the mth random sampling.
[0047] After M Monte Carlo modeling iterations, all regression coefficients are concatenated to form a regression coefficient matrix. In this embodiment, M is preferably set to 100 times. For dataset D1, each sampling... The regression coefficient vector for each iteration is... After all rounds of sampling are completed, the total regression coefficient matrix is calculated as follows: For dataset D2, the sub-calibration set obtained at each sampling time The regression coefficient vector is After all rounds of sampling are completed, the total regression coefficient matrix is calculated as follows: .
[0048] When using a progressive variable elimination method, all wavelength variables sorted in descending order are used as the initial variable set. An exponentially decreasing function is used to control the number of wavelength variables retained in each round as follows:
[0049]
[0050] Where, N k λ represents the number of wavelength variables retained in the k-th round, N0 represents the initial number of variables (N0=B), λ represents the elimination rate parameter, and k represents the elimination round.
[0051] During the incremental variable elimination process, all wavelengths sorted from largest to smallest are used as the initial variable set. An exponentially decreasing function is used to control the number of retained variables, and the highest-scoring N is retained in each round. k Each wavelength variable will be used in the next round of optimization.
[0052] In this embodiment, the compression rate λ = 0.08 and the number of elimination rounds k = 20 are set. After 20 rounds of elimination, the size of the candidate wavelength matrix obtained for datasets D1 and D2 is reduced to 0.8N. sample_cal ×N 20 .
[0053] Step 5: Multi-objective optimization, setting the candidate wavelength set N k As a multi-objective search space, the NSGA-II multi-objective evolutionary algorithm is used for wavelength combination optimization. The optimization objectives are: minimizing the root mean square error of cross-validation, maximizing the average stability of variables, and minimizing the number of wavelength variables.
[0054] In each round, only N, which has the highest comprehensive wavelength evaluation index, is retained. k Each wavelength variable enters the next round of optimization, and after the iteration is completed, a set of candidate wavelengths is obtained.
[0055] The final comprehensive wavelength evaluation indicators are as follows:
[0056]
[0057]
[0058]
[0059] Among them, Ib and S b These represent the importance and stability indices of the b-th wavelength variable, respectively; M represents the total number of random samples; β b (m) Let represent the regression coefficient of the b-th wavelength variable in the m-th random sampling. The indicator function takes the value 1 when the condition is met and 0 otherwise; τ is the stability threshold; the wavelength importance index vector is calculated based on the regression coefficient matrix. The stability index vector is represented as .
[0060] In this embodiment, the stability threshold τ is preferably set to 0.05. For dataset D1, the size of I, S and Score is 200×1; for dataset D2, the size of I, S and Score is 1024×1.
[0061] Specifically, the full-band spectral dataset is divided into a calibration set and a prediction set according to a preset ratio; random repeated sampling is performed on the calibration set to construct multiple calibration subsets, and the wavelength comprehensive evaluation index of each wavelength variable of the sample to be analyzed is calculated based on each calibration subset. A progressive variable elimination method is used to gradually reduce the wavelength variables to obtain a candidate wavelength set; the prediction set does not participate in the wavelength variable selection process, but is only used to independently evaluate the performance of the prediction model constructed based on the candidate wavelength set.
[0062] This step involves repeated evaluation of each wavelength variable through multiple random samplings to reduce the impact of a single sample partitioning on the feature selection results and to comprehensively characterize the importance and stability of the wavelength variables. A progressive variable elimination approach is used to gradually reduce low-contribution or redundant wavelength variables, reducing the spectral dimension while retaining candidate wavelengths with high evaluation results, thus providing a candidate search space for subsequent multi-objective optimization.
[0063] Step S2: Perform multi-objective optimization on the candidate wavelength set to obtain the optimal solution set. Specifically, the candidate wavelength set and its response variable matrix are used as the multi-objective search space. The NSGA-II multi-objective evolutionary algorithm is used to determine the optimal number of wavelengths to retain and the indices of each retained wavelength variable. Then, the optimized combination of wavelength variables is extracted from the candidate wavelength set. The NSGA-II multi-objective evolutionary algorithm is optimized based on the objective function, as follows:
[0064]
[0065]
[0066]
[0067] Where f1, f2, and f3 represent the first, second, and third objective functions to be optimized, respectively; This represents the root mean square error of cross-validation obtained after inputting the current combination of wavelength variables and its response variable matrix into the partial least squares regression model; n v S represents the number of wavelength variables in the current wavelength variable combination; b This represents the stability index of the b-th wavelength variable in the current wavelength variable combination.
[0068] The Pareto optimal solution set, which includes multiple combinations of wavelength variables and their response variable matrices, is obtained through iterative optimization using the NSGA-II multi-objective evolutionary algorithm.
[0069] In this embodiment, after a preset number of iterations, NSGA-II obtains the dominant solution set and Pareto front for multi-objective optimization. The Pareto optimal solution with the smallest RMSECV, the fewest wavelength variables, and the highest stability is selected from the Pareto front as the final optimized solution. The population size of NSGA-II is set to 100, and the number of iterations is set to 200. The spatial distribution of the obtained dominant solution set and Pareto front for multi-objective optimization is as follows: Figure 3 (a) and Figure 3 As shown in (b).
[0070] After performing wavelength local distillation screening on the optimal solution set, the original optimal wavelength set is obtained. Specifically, for each wavelength variable combination in the optimal solution set, the wavelength variables in the combination are arranged from smallest to largest according to the physical spectral dimension. Then, wavelength local distillation is performed, dividing adjacent wavelength variables in the combination into several screening groups according to a preset window width interval W, where W=20 nm. Only the wavelength variable with the highest comprehensive wavelength evaluation index in each screening group is retained as the representative wavelength variable, and other wavelength variables in the same screening group are deleted. This process continues until all wavelength variable combinations in the optimal solution set have been screened. The representative wavelength variables obtained from the screening of each wavelength variable combination are merged, and duplicate wavelength variables are removed to obtain the original optimal wavelength set. The original optimal wavelength set contains N. opt The original optimal wavelength variables are unique; the original optimal wavelength set can be directly selected for characteristic spectral feature extraction of the sample to be analyzed without subsequent steps. In this embodiment, after wavelength local distillation screening, N unique wavelength variables are obtained for dataset D1. opt =13 original feature wavelengths; for dataset D2, a total of N were obtained. opt =38 original optimal wavelengths.
[0071] This step addresses the trade-off between wavelength prediction error, feature quantity, and stability. Multi-objective optimization is employed to obtain non-dominated solutions among different objectives, and the optimal wavelength combination with the best overall performance is determined from the Pareto front. Incorporating stability into the optimization objective reduces the likelihood of wavelength variables sensitive to specific sample partitioning being selected, thus improving the stability of the feature selection results. Given that different Pareto optimal solutions may contain wavelength variables with similar spectral positions and redundant information, local distillation is further performed after multi-objective optimization. This retains the representative wavelength with the highest overall evaluation index within a preset spectral window, thereby reducing redundancy between adjacent wavelengths and obtaining a reasonably sized original optimal wavelength set.
[0072] Step S3: Construct a candidate pool of band operators based on the original optimal wavelength set. For each pair of wavelength variables in the original optimal wavelength set, obtain the band operator features between the spectral intensities of the two wavelength variables. The band operator features are one or more of the band difference features, band sum features, band ratio features, and normalized difference features between the two wavelength variables. Construct a candidate pool of band operators based on each band operator feature.
[0073] Specifically, the spectral intensities of any two wavelength variables in the original optimal wavelength set are traversed to generate band difference operators, band sum operators, band ratio operators, and normalized difference operator features, as follows:
[0074]
[0075]
[0076]
[0077]
[0078] in, , , and The spectral intensity X of the i-th wavelength variable in the original optimal wavelength set is respectively. i The spectral intensity X of the j-th wavelength variable j Characteristics of band difference operators, band sum operators, band ratio operators, and normalized difference operators; ε is a constant to prevent the denominator from reaching a minimum value of 0, specifically 1 × 10⁻⁶. -4 .
[0079] All generated band operators are added to the band operator candidate pool, the capacity of which is based on N. opt Each wavelength is paired and combined, and then substituted into each enabled operator feature to generate derived features. Furthermore, when the above n wavelengths are enabled... operator When planting operators, noperator =1, 2, 3, or 4, the characteristic capacity of the band operator candidate pool is as follows:
[0080]
[0081] Where C represents permutation and combination operations.
[0082] In this embodiment, for dataset D1, there are 13 original optimal wavelengths. All four operators are used for feature calculation, and the resulting operator candidate pool capacity includes... There are 38 derived features; for dataset D2, there are 38 original optimal wavelengths, and all 4 operators are used for feature calculation. The resulting operator candidate pool capacity includes... A derived feature.
[0083] Then, a forward evaluation approach is used to progressively introduce band operator features to construct the optimal wavelength feature set. Specifically, an initial partial least squares regression model is established based on the original optimal wavelength set and its response variable matrix, thereby obtaining the initial root mean square error of cross-validation (RMSECV) and the coefficient of determination (R²). 2 Using the initial root mean square error (RMSE) and coefficient of determination (CCD) of cross-validation as evaluation metrics, a forward evaluation method is employed. A greedy search algorithm is used to search for the optimal band operator features. For each round of the greedy search algorithm, the band operator features updated in the current round's candidate pool are used as candidate features to be evaluated. The response variable matrix for each wavelength variable corresponding to each candidate feature is obtained as the response variable matrix to be evaluated. For each candidate feature and its response variable matrix, a partial least squares regression model is constructed to obtain the RMSE and CCD of the current candidate feature. The first difference (ΔRMSECV) between the current RMSE and the initial RMSE is obtained, along with the second difference (ΔR) between the current CCD and the initial CCD. 2 When △RMSECV<0 or △R 2If the value is greater than 0, the current candidate feature to be evaluated is determined to meet the model improvement conditions, and the current candidate feature to be evaluated is taken as the initial optimal feature. The initial optimal feature with the smallest first difference ΔRMSECV among the initial optimal features is taken as the optimal band operator feature of the current round and added to the current optimal feature set. The optimal band operator features retained in the previous rounds are retained in the current optimal feature set in subsequent rounds and removed from the band operator candidate pool. The optimal feature set of the current round and the response variable matrix of each corresponding wavelength variable are obtained as the search response variable matrix. Based on the optimal feature set of the current round and the search response variable matrix, the partial least squares regression model of the current round is constructed. The root mean square error of cross-validation and the coefficient of determination of the current round are used as the evaluation index of the greedy search process of the next round. The greedy search process is repeated until there are no candidate features to be evaluated that meet the model improvement conditions in the current round, or the greedy search for a preset number of consecutive times fails to obtain candidate features to be evaluated that meet the model improvement conditions, and then the search is terminated.
[0084] The wavelength variables corresponding to the final retained optimal feature set are extracted to construct the final optimal wavelength set. The final optimal wavelength set is determined by the original wavelength variables corresponding to the final retained band operator features, without further secondary screening of the original wavelength variables. Based on the optimal feature set, the final optimal wavelength set and their corresponding response variable matrix, a final partial least squares regression model is established, and the final partial least squares regression model is used as the prediction model to obtain the prediction results of the sample to be analyzed, thereby obtaining the target components or target attributes of the sample to be analyzed and realizing the extraction of characteristic spectral features of the sample to be analyzed.
[0085] In this embodiment, for dataset D1, a total of 6 optimal operator features were obtained; for dataset D2, a total of 24 optimal operator features were obtained. These features are then combined with the results from step 6 to obtain the optimal spectral wavelength index N. final For dataset D1, N final For dataset D2, N is 16 (13 original optimal wavelengths + 3 operator features). final It is 62 (38 original optimal wavelengths + 24 operator features).
[0086] Based on the original optimal wavelength index in the final feature set, from the calibration set spectral matrix X cal Extract the corresponding original optimal wavelength variables and construct the original wavelength feature matrix X of the calibration set. band The correction set band operator feature matrix X is calculated based on the final retained band operator features and their corresponding original wavelength variables. operator The two are then concatenated along their feature dimensions to obtain the final calibration set feature matrix X. cal_final =[X bandX operator ], with the corresponding calibration set response variable matrix y cal The PLSR algorithm is used to establish the final prediction model as the model output variable.
[0087] Specifically, the optimal partial least squares regression model obtained from the calibration set is used as the optimal model for validation on the subsequent prediction set, so as to compare the RMSECV and R of each candidate feature. 2 Comparing the current optimal model's RMSECV and R respectively 2 Compare them.
[0088] This step constructs a candidate pool of band operators based on the original optimal wavelength. It characterizes the combination relationships between different wavelength variables through operations such as difference, sum, ratio, and normalized difference, expanding feature representation while preserving the original spectral information. Using the original optimal wavelength as the basis for operator construction reduces the number of candidate features resulting from full-band combinations. Forward evaluation addresses potentially redundant features in the candidate pool by employing a greedy forward strategy to evaluate the model gain of candidate operator features round by round. Based on model improvement conditions, it selects operator features with incremental information, thereby improving model prediction performance while controlling the number of features.
[0089] The main idea behind the above steps is to provide a step-by-step feature extraction process, from stability evaluation to multi-objective optimization, and then to local distillation and operator enhancement. Step S1 provides a basis for evaluating the importance and stability of wavelength variables; Step S2, based on this, takes into account prediction error, feature quantity, and stability to obtain the original optimal wavelength, and reduces wavelength redundancy through local distillation; Step S3 further mines the combination information between the original optimal wavelengths, and retains operator features with incremental contributions through forward screening, ultimately forming a final feature set composed of the original optimal wavelength variables and the optimal band operator features.
[0090] For the prediction set, based on the final feature set determined by the correction set and the same band operator calculation rules, the spectral matrix X of the prediction set is used... val Extract the corresponding original optimal wavelength variables and calculate the band operator features to obtain the final prediction set feature matrix X. val_final X val_final Input the final PLSR prediction model built based on the calibration set to obtain the predicted value. and compared it with the measured response variable y in the prediction set. val Compare and calculate the performance evaluation indicators of the model prediction.
[0091] Model evaluation metrics include the coefficient of determination (R²). 2The factors include root mean square error (RMSE), relative predictive deviation (RPD), and the number of characteristic variables. Among these, the coefficient of determination R0... 2 The root mean square error (RMSE) characterizes the model's ability to explain the variation in the response variable; the closer its value is to 1, the stronger the model's fitting or predictive ability. The smaller the RMSE value, the smaller the model's prediction error. The relative analysis error (RPD) is the ratio of the standard deviation of the response variable to the root mean square error of the prediction; it is used to evaluate the model's predictive ability, and the larger its value, the better the model's predictive performance. The final feature count characterizes the feature scale used by the final prediction model, including the total number of original optimal wavelength variables and optimal band operator features. Under similar predictive performance, a smaller final feature count indicates a higher degree of feature compression in the model.
[0092] To verify the effectiveness of the proposed method, experiments were conducted on datasets D1 and D2, and the proposed method was compared with the classic variable selection method, the Competitive Adaptive Reweighting Algorithm (CARS). The experimental results for datasets D1 and D2 are shown in Table 1 and Table 2, respectively.
[0093] Table 1 index This method CARS <![CDATA[Prediction set R 2 > 1.0000 1.0000 Prediction set RMSE 0.0230 0.0146 Prediction set RPD 160.3598 252.2473 Final number of features 16 104
[0094] Table 2 index This method CARS <![CDATA[Prediction set R 2 > 0.6649 0.5174 Prediction set RMSE 0.4222 0.8984 Prediction set RPD 1.7582 0.8262 Final number of features 62 99
[0095] As can be seen from Table 1, both the method of this invention and the CARS method achieved high prediction accuracy, and the coefficient of determination R on the test set was [value missing]. 2 Both methods achieved a score of 1.0000, indicating that both methods can effectively identify the main valid information variables in dataset D1.
[0096] Regarding variable compression capability, while maintaining R... 2 Under the same conditions, this method can achieve the same prediction effect as CARS using 104 variables with only 16 variables, with a variable compression rate of 81.7%, which effectively reduces the complexity of subsequent models.
[0097] As can be seen from Table 2, on real agricultural product near-infrared spectral datasets, the method of this invention shows better prediction performance than the CARS algorithm.
[0098] The determination coefficient R of the prediction set of the model established using the method of this invention 2The mean square error (RMSE) of the prediction set was reduced from 0.8984 to 0.4222, while the residual prediction bias (RPD) was increased from 0.8262 to 1.7582. The method of this invention retains only 62 characteristic wavelengths, while CARS retains 99.
[0099] The distributions of the characteristic wavelengths selected by this method and the CARS algorithm on datasets D1 and D2 are as follows: Figure 4 and Figure 5 As shown. "Characteristic wavelength" refers to the original spectral wavelength variable selected to characterize the target response variable information of the sample to be analyzed after wavelength variable evaluation, optimization, and screening; "Operator anchor wavelength" refers to the original spectral wavelength variable used to construct the band operator features. The two operator anchor wavelengths are used as input variables for the band operator features, and corresponding band operator features are generated through operations such as difference, sum, ratio, or normalized difference; "Operator anchor frequency" refers to the cumulative number of times each original spectral wavelength participates in the band operator construction process as an operator anchor wavelength, used to characterize the frequency of use of different wavelengths in the band operator construction process; "Cumulative frequency" refers to the count value obtained by accumulating the number of times the same wavelength variable is selected as an operator anchor wavelength during the preset band operator feature construction or optimization process.
[0100] Experimental results show that for complex real samples, due to strong spectral noise, scattering interference and variable collinearity among samples, the traditional CARS method tends to retain a large number of redundant wavelengths, resulting in a decrease in the model's generalization ability.
[0101] The experimental results from datasets D1 and D2 show that the method of this invention has both strong variable compression and model prediction capabilities. It can solve the problems of high randomness, many redundant variables, and insufficient model stability in traditional variable screening methods, and achieve stable and efficient screening of characteristic wavelengths in high-dimensional spectral data.
[0102] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, optical storage, etc.) containing computer-usable program code. The solutions in the embodiments of this application can be implemented using various computer languages. This application is described with flowcharts of methods, systems, and computer program products according to embodiments of this application.
[0103] Although preferred embodiments of this application have been described, those skilled in the art, upon learning the basic inventive concept, can make other changes and modifications to these embodiments. Therefore, this invention is intended to be interpreted as including the preferred embodiments as well as all changes and modifications falling within the scope of this application.
[0104] Obviously, those skilled in the art can make various modifications and variations to this application without departing from the spirit and scope of this application. Therefore, if these modifications and variations of this application fall within the scope of the equivalent technology of this invention, this application also intends to include these modifications and variations.
Claims
1. A stability-driven multi-objective optimization method for feature spectral feature extraction, characterized in that, include: Step S1: Obtain the full-band spectral dataset of the sample to be analyzed, and randomly sample and repeatedly construct a calibration set. Based on each calibration set, construct a comprehensive wavelength evaluation index for each wavelength variable of the sample to be analyzed, and then gradually reduce the wavelength variables using a progressive variable elimination method to obtain a candidate wavelength set. Step S2: Perform multi-objective optimization on the candidate wavelength set to obtain the optimal solution set, and then perform wavelength local distillation screening on the optimal solution set to obtain the original optimal wavelength set; Step S3: Construct a candidate pool of band operators based on the original optimal wavelength set, and gradually introduce band operator features using a forward evaluation method to construct the optimal wavelength feature set. Establish a prediction model based on the optimal wavelength feature set to obtain the prediction results of the sample to be analyzed, thereby realizing the extraction of the characteristic spectral features of the sample to be analyzed.
2. The stability-driven multi-objective optimization method for feature spectral feature extraction according to claim 1, characterized in that: In step S1, the samples to be analyzed include several different samples of the same variety. First, the original spectral data matrix and its response variable matrix of the samples to be analyzed are obtained. The original spectral data matrix is composed of the spectral data of different wavelength variables of each sample, and the response variable matrix is composed of the response variables of each sample. Then, the original spectral data matrix is preprocessed by mean centering and together with the response variable matrix, it constitutes the full-band spectral dataset of the samples to be analyzed.
3. The stability-driven multi-objective optimization method for feature spectral feature extraction according to claim 1, characterized in that: In step S1, for each calibration set obtained from random sampling, a partial least squares regression model is first established based on the calibration set. Then, the regression coefficients of each wavelength variable are extracted to construct a regression coefficient vector. Finally, the regression coefficient vectors obtained from each random sampling are concatenated to form a regression coefficient matrix. Based on the regression coefficient matrix, importance indicators and stability indicators of each wavelength variable are constructed, and then a comprehensive wavelength evaluation index for each wavelength variable is constructed. Based on the comprehensive wavelength evaluation index, each wavelength variable is sorted in descending order. When using a progressive variable elimination method, an exponential decreasing function is used to iteratively reduce the number of wavelength variables with low comprehensive wavelength evaluation indices to obtain a candidate wavelength set.
4. The stability-driven multi-objective optimization method for feature spectral feature extraction according to claim 3, characterized in that: In step S1, the specific wavelength comprehensive evaluation indicators are as follows: Among them, I b and S b These represent the importance and stability indices of the b-th wavelength variable, respectively; M represents the total number of random samples; β b (m) Let represent the regression coefficient of the b-th wavelength variable in the m-th random sampling. τ is an indicator function that takes the value 1 when the condition is met and 0 otherwise; τ is the stability threshold.
5. The stability-driven multi-objective optimization method for feature spectral feature extraction according to claim 2, characterized in that: In step S2, the candidate wavelength set and its response variable matrix are used as a multi-objective search space. A multi-objective evolutionary algorithm is employed to determine the optimal number of wavelengths to retain and the indices of each retained wavelength variable. Then, the optimized combination of wavelength variables is extracted from the candidate wavelength set. The multi-objective evolutionary algorithm optimizes based on the objective function, as detailed below: Where f1, f2, and f3 represent the first, second, and third objective functions to be optimized, respectively; This represents the root mean square error of cross-validation obtained after inputting the current combination of wavelength variables and its response variable matrix into the partial least squares regression model; n v S represents the number of wavelength variables in the current wavelength variable combination; b This represents the stability index of the b-th wavelength variable in the current wavelength variable combination; The optimal solution set, which includes multiple combinations of wavelength variables and their response variable matrices, is obtained through iterative optimization using a multi-objective evolutionary algorithm.
6. The stability-driven multi-objective optimization method for feature spectral feature extraction according to claim 5, characterized in that: In step S2, for each wavelength variable combination in the optimal solution set, the wavelength variables in the wavelength variable combination are arranged from smallest to largest according to the physical spectral dimension. Then, wavelength local distillation is performed, and adjacent wavelength variables in the wavelength variable combination are divided into several screening groups according to a preset window width interval W. Only the wavelength variable with the highest comprehensive wavelength evaluation index in each screening group is retained as the representative wavelength variable, and other wavelength variables in the same screening group are deleted. This process continues until all wavelength variable combinations in the optimal solution set have been screened. The representative wavelength variables obtained from the screening of each wavelength variable combination are merged, and duplicate wavelength variables are removed to obtain the original optimal wavelength set.
7. The stability-driven multi-objective optimization method for feature spectral feature extraction according to claim 1, characterized in that: In step S3, for each pair of wavelength variables in the original optimal wavelength set, the band operator features between the spectral intensities of the two wavelength variables are obtained. The band operator features are one or more of the band difference features, band sum features, band ratio features, and normalized difference features between the two wavelength variables. Each band operator feature is used to construct a band operator candidate pool.
8. The stability-driven multi-objective optimization method for feature spectral feature extraction according to claim 1, characterized in that: In step S3, an initial partial least squares regression model is established based on the original optimal wavelength set and its response variable matrix to obtain the initial root mean square error (RMSE) and coefficient of determination (CCD). Using the initial RMSE and CCD as evaluation metrics, a forward evaluation method is employed, utilizing a greedy search algorithm to search for optimal band operator features. For each round of the greedy search algorithm, the band operator features updated in the current round's candidate pool are used as candidate features to be evaluated. The response variable matrix of each wavelength variable corresponding to each candidate feature is obtained as the response variable matrix to be evaluated. For each candidate feature and its response variable matrix, a partial least squares regression model is constructed to obtain the current RMSE and CCD of the candidate feature. The first difference ΔRMSECV between the current RMSE and the initial RMSE is obtained, along with the second difference ΔR between the current CCD and the initial CCD. 2 When △RMSECV<0 or △R 2 If the value is greater than 0, the current candidate feature to be evaluated is determined to meet the model improvement conditions, and the current candidate feature to be evaluated is taken as the initial optimal feature. The initial optimal feature with the smallest first difference ΔRMSECV among the initial optimal features is taken as the optimal band operator feature of the current round and added to the current optimal feature set, while being removed from the band operator candidate pool. The optimal feature set of the current round and the corresponding response variable matrix of each wavelength variable are obtained as the search response variable matrix. Based on the optimal feature set of the current round and the search response variable matrix, the partial least squares regression model of the current round is constructed. The root mean square error of cross-validation and the coefficient of determination of the current round are used as the evaluation index of the greedy search process of the next round. The greedy search process is repeated until there are no candidate features to be evaluated that meet the model improvement conditions in the current round, or the greedy search for a preset number of consecutive times fails to obtain candidate features to be evaluated that meet the model improvement conditions, and then the search is terminated. The wavelength variables corresponding to the final optimal feature set are extracted to construct the final optimal wavelength set; the final partial least squares regression model is established based on the optimal feature set, the final optimal wavelength set and their corresponding response variable matrix, and the final partial least squares regression model is used as the prediction model.
9. An electronic device, characterized in that, include: A memory and a processor are coupled to each other, wherein the memory stores program data, and the processor invokes the program data to perform the method as described in any one of claims 1-8.
10. A computer-readable storage medium storing program data thereon, characterized in that, When the program data is executed by the processor, the method as described in any one of claims 1-8 is implemented.
