Drug open set identification method based on interval variable-free elimination feature selection algorithm
Through interval-free variable elimination feature selection algorithm and Bayesian regularization screening, the problem of false-related spectral variables and response variables under the influence of impurities in drug identification is solved, and the identification accuracy and model reliability of drugs and non-drugs are improved, thus achieving Effective prediction of out-of-store samples.
Patent Information
- Application Number
- CN202411401565.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-09
- Publication Date
- 2025-01-03
AI Technical Summary
The prior art is difficult to effectively identify the opening sets of drugs and non-drugs, especially when impurities exist, which leads to a ‘false correlation’ problem between spectral variables and response variables, affecting the accuracy of identification.
Using the interval-free variable elimination feature selection algorithm, the features related to the response variable are filtered out through the PLS model and Bayesian regularization idea, unnecessary features are eliminated, and partial least squares recognition model is constructed to improve the classification accuracy of the model and reliability.
Effectively reduce the number of characteristic variables and reduce the complexity of the model, significantly improve the recognition accuracy of drugs and non-drugs, especially when impurities exist, and significantly improve the model's prediction ability of samples outside the database.
Smart Images

Figure CN119252365A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of open set drug recognition, and in particular to an open set drug recognition method based on an interval variable-free elimination feature selection algorithm. Background Art
[0002] With the legalization of marijuana in Canada, the United States, and many European countries, the risk of drug globalization continues to rise. The intensification of foreign drug infiltration has put forward new requirements for the crackdown on domestic drug abuse and drug production activities. Some drug traffickers accidentally or deliberately add impurities to common drugs such as methamphetamine and heroin during the production process, intending to interfere with the detection of psychoactive substances, increase the difficulty of detecting substances such as heroin and methamphetamine, and make market supervision difficult. Traditional methods are time-consuming and labor-intensive. The realization of on-site rapid and accurate identification and analysis of drugs and non-drugs is of great significance to improving the law enforcement efficiency of public security departments and effectively combating drug crimes.
[0003] Near infrared spectroscopy is widely used in the medical, environmental, petroleum and biological fields due to its rapid, non-invasive and multi-component simultaneous analysis characteristics. However, most classification models are based on sample databases composed of actual collected samples. For samples such as drugs that are difficult to obtain, have a wide variety of impurities and additives, and cannot be fully covered by the database, it is difficult to obtain only the drug's own spectral data to achieve open set identification of drugs and non-drugs. How to effectively select the characteristic signals of the target components and reliably distinguish them from the impurity signals is a major problem. The currently commonly used feature selection methods such as UVE and VIP have a feature selection logic of selecting bands in the spectral information that have a high correlation with the response variable (concentration, type label). This type of method is more suitable for selecting effective chemical information from environmental noise. However, the "false correlation" problem between spectral variables and response variables caused by factors such as different impurities and contents in different drug samples and the masking of the response variable signal by the impurity signal cannot be effectively solved.
[0004] Based on the above situation, the present invention proposes an open set drug identification method based on an interval variable-free elimination feature selection algorithm, which can effectively solve the above problems. Summary of the invention
[0005] The purpose of the present invention is to provide a drug open set identification method based on an interval-free variable elimination feature selection algorithm. The drug open set identification method based on an interval-free variable elimination feature selection algorithm of the present invention is easy to use, and the interval-free variable elimination feature selection algorithm can effectively mine information with high correlation with species in the spectrum of the sample library, improve the accuracy and reliability of the model open set identification classification, and effectively solve the "false correlation" problem between the spectral variable and the response variable caused by factors such as different impurities and contents in different drug samples and the masking of the response variable signal by the impurity signal.
[0006] The present invention is achieved through the following technical solutions:
[0007] A drug open set identification method based on interval variable-free elimination feature selection algorithm comprises the following steps:
[0008] Step S1: preparing a plurality of methamphetamine samples, heroin samples and non-drug samples;
[0009] Step S2: After the spectrometer is preheated, the wavelength resolution and wavelength range are set to collect the sample spectrum;
[0010] Step S3: removing abnormal heroin samples and methamphetamine samples, and using Gaussian filtering to preliminarily reduce the noise in the sample spectral data after the removal of the heroin samples and methamphetamine samples, so as to make the spectrum smoother and more continuous;
[0011] Step S4: using an interval-invariant elimination feature selection algorithm to perform feature selection on the preprocessed spectrum to determine a characteristic spectrum segment;
[0012] Step S5: Select 5 methamphetamine samples, 5 heroin samples, and 50 non-drug samples to form a prediction set, and the remaining drug samples are used as a calibration set;
[0013] Step S6: using partial least squares method to establish a category recognition model;
[0014] Step S7: Use the established type recognition model to verify the prediction set data that has undergone the same processing, and compare the accuracy of identifying the types of the two drugs, as well as the accuracy of identifying drugs and non-drugs.
[0015] The purpose of the present invention is to provide a drug open set identification method based on an interval-free variable elimination feature selection algorithm. The drug open set identification method based on an interval-free variable elimination feature selection algorithm of the present invention is easy to use, and the interval-free variable elimination feature selection algorithm can effectively mine information with high correlation with species in the spectrum of the sample library, improve the accuracy and reliability of the model open set identification classification, and effectively solve the "false correlation" problem between the spectral variable and the response variable caused by factors such as different impurities and contents in different drug samples and the masking of the response variable signal by the impurity signal.
[0016] Preferably, in step S2, the preheating time of the spectrometer is 30 minutes, the wavelength resolution is set to 12 nm, and the wavelength range is set to 900 nm to 1700 nm.
[0017] Preferably, step S2 includes the following steps:
[0018] Step S21: using a pure polystyrene pressed sheet as the background for detection, scanning each sample 7 times, and taking the average value as the spectrum scanning result of that time;
[0019] Step S22: Repeat the test for each sample 5 times, and take the average value as the input spectral variable for modeling;
[0020] Step S23: Non-drug samples are collected once every two days according to the above steps, and each non-drug sample is collected 10 times in total.
[0021] Preferably, the specific steps of removing abnormal heroin samples and methamphetamine samples in step S3 include:
[0022] Step S31: After using the PCA algorithm to perform outlier detection on 58 sets of spectral data, the Hotelling statistic and F-residual are obtained;
[0023] Step S32: Draw a scatter plot based on the Hotelling statistic and the F-residual for outlier observation, and remove abnormal samples that exceed the critical values of the two statistics.
[0024] Preferably, the interval invariant elimination feature selection algorithm comprises the following steps:
[0025] Step S41: Given a spectral matrix X∈R n×m , where n represents the number of samples, m represents the number of spectral variables, and the response variable vector y∈R n , by constructing a PLS model to find the potential features with greater correlation between the spectral variable X and the response variable y, this feature also considers the maximum covariance between X and y:
[0026] w k = arg max w Cov(Xw,y), subject to w T X T Xw=1
[0027] Where k represents the kth PLS component;
[0028] Step S42: For each spectral variable X j , calculate its importance among all PLS components:
[0029]
[0030] Among them, w kj is the weight of the jth feature in the kth PLS component;
[0031] Step S43: Select Importance I j The higher features constitute the feature set S:
[0032] s={j:I j >γ}
[0033] Among them, γ is a pre-set threshold;
[0034] Step S44: The threshold γ uses the idea of Bayesian regularization to integrate prior knowledge into the threshold selection process. Assume that each feature I j Following a normal prior distribution, μ represents the prior mean and σ represents the prior standard deviation:
[0035] p(I j )~N(μ,σ 2 )
[0036] Step S45: Calculate the I of each feature in the observed data j value, and update its importance. The final threshold γ selects the value that exceeds I in the posterior distribution. j The 40% quantile of values:
[0037] γ=Φ -1 (0.4)·σ+μ
[0038] Where Φ is the quantile function of the standard normal distribution;
[0039] Step S46: Finally, the feature set S is sorted according to the importance I j The values are divided into multiple subsets S 1 , S 2 , …, S p , each subset contains features with similar importance range, for each subset S i Use the UVE algorithm for optimization to identify invalid variables in each subset and remove features that cannot provide additional information:
[0040]
[0041]
[0042] Among them, Ω is the selected feature subset, X Ω is the submatrix corresponding to the feature subset selected in X, and β is the regression coefficient;
[0043] Step S47: merging the selected subsets to form a final feature set F;
[0044] Step S48: Use the final feature set F to build a PLS model to achieve effective prediction of the response variable y.
[0045] Preferably, step S6 comprises the following steps:
[0046] Step S61: assigning values to different types of drug samples (0 for methamphetamine and 1 for heroin);
[0047] Step S62: fitting and mapping different types of samples using a fitting method;
[0048] Step S63: construct a model based on the spectral data matrix X and the dependent variable matrix Y describing the spectral class, so that Y=XB+E;
[0049] Among them, B is the regression coefficient matrix, E is the residual matrix, the X matrix has n rows and m columns, each row is related to the sample and the signal strength of each wave value, and the Y matrix has n rows, each row is a categorical variable specifying the sample type.
[0050] Compared with the prior art, the present invention has the following advantages and beneficial effects:
[0051] 1. By extracting effective information through the interval variable-free elimination feature selection algorithm, the number of feature variables can be reduced, the model complexity can be reduced, and the samples in the database and the samples outside the database can be significantly spatially separated. The model prediction results are reflected in the fact that the prediction results of the samples outside the database far exceed the assignment range of the samples in the database itself.
[0052] 2. First, use weights combined with Bayesian regularization to preliminarily screen the variables. Set a 40% quantile selection threshold to ensure the reliability of the screened information and provide sufficient information for subsequent processes. Divide according to the range of variation of the eigenvalues to form multiple subsets, each of which contains features with similar ranges of variation. Apply the UVE algorithm to each subset to eliminate features that do not provide additional information within a similar range of variation. The goal of the UVE algorithm is to minimize the complexity of the model while retaining the most informative features. Merge the features screened by the UVE algorithm in all subsets to form the final feature set for subsequent modeling and analysis. Through this interval UVE feature selection method, features that have a significant impact on sample classification can be more effectively extracted from spectral data, thereby improving the performance of the model for identifying samples outside the library.
[0053] 3. The importance of the variables of interest is screened based on the weight of each wavelength combined with the Bayesian regularization idea. Sometimes some unstable variables may be selected in the model. UVE further optimizes the result of feature selection by removing these unstable variables and screening features with similar variation ranges. The combination of the two can improve the reliability of feature selection and the predictive ability of the model. BRIEF DESCRIPTION OF THE DRAWINGS
[0054] Figure 1 It is a schematic block diagram of the process of the present invention;
[0055] Figure 2 This is the scatter plot of the present invention, wherein a is methamphetamine and b is heroin;
[0056] Figure 3This is the confusion matrix diagram for qualitative identification of drugs and non-drugs, where a is the full spectrum, b is VIP feature selection, c is UVE feature selection, and d is interval variable-free screening feature selection;
[0057] Figure 4 This is a qualitative identification diagram of drug types, where a is the full spectrum, b is VIP feature selection, c is UVE feature selection, and d is interval variable-free screening feature selection;
[0058] Figure 5 This is the prediction result diagram of the classification model, where a is the full spectrum, b is VIP feature selection, c is UVE feature selection, and d is interval variable-free screening feature selection. DETAILED DESCRIPTION
[0059] In order to enable those skilled in the art to better understand the technical solution of the present invention, the preferred implementation scheme of the present invention is described below in conjunction with specific embodiments. However, it should be understood that the drawings are only used for exemplary description and cannot be understood as a limitation on this patent. In order to better illustrate this embodiment, some parts of the drawings may be omitted, enlarged or reduced, and do not represent the size of the actual product. For those skilled in the art, it is understandable that some well-known structures and their descriptions in the drawings may be omitted. The positional relationship described in the drawings is only for exemplary description and cannot be understood as a limitation on this patent.
[0060] Embodiment 1:
[0061] like Figures 1 to 5 As shown, the present invention provides a drug open set identification method based on interval variable-free elimination feature selection algorithm, comprising the following steps:
[0062] Step S1: preparing a plurality of methamphetamine samples, heroin samples and non-drug samples;
[0063] Step S2: After the spectrometer is preheated, the wavelength resolution and wavelength range are set to collect the sample spectrum;
[0064] Step S3: removing abnormal heroin samples and methamphetamine samples, and using Gaussian filtering to preliminarily reduce the noise in the sample spectral data after the removal of the heroin samples and methamphetamine samples, so as to make the spectrum smoother and more continuous;
[0065] Step S4: using an interval-invariant elimination feature selection algorithm to perform feature selection on the preprocessed spectrum to determine a characteristic spectrum segment;
[0066] Step S5: Select 5 methamphetamine samples, 5 heroin samples, and 50 non-drug samples to form a prediction set, and the remaining drug samples are used as a calibration set;
[0067] Step S6: using partial least squares method to establish a category recognition model;
[0068] Step S7: Use the established type recognition model to verify the prediction set data that has undergone the same processing, and compare the accuracy of identifying the types of the two drugs, as well as the accuracy of identifying drugs and non-drugs.
[0069] Embodiment 2:
[0070] like Figures 1 to 5 As shown, the present invention provides a drug open set identification method based on interval variable-free elimination feature selection algorithm, comprising the following steps:
[0071] Step S1: The samples used in the experiment were provided by the Beijing Anti-Drug Science and Technology Center, and the samples were collected in its professional laboratory using a diffuse reflectance near-infrared spectrometer independently developed by the China Institute of Metrology. 58 samples were collected, including 42 methamphetamine samples and 16 heroin samples. The content of active ingredients was greater than 10%. The content of psychotropic substances and their impurities in the samples were determined after analysis by the Beijing Anti-Drug Science and Technology Center. Five impurities in the samples, including 2.4-di-tert-butylphenol, acetaminophenol, N-methylcyclohexylamine, ammonium chloride, and antioxidant 2246, which have large coverage, low cost, and are easy to obtain, were used as non-drug samples;
[0072] Step S2: Use a diffuse reflectance portable NIR spectrometer to collect sample spectra. The instrument uses a halogen tungsten lamp as a light source and is equipped with a 300g constant pressure counterweight. After the spectrometer is preheated, set the wavelength resolution and wavelength range to collect sample spectra;
[0073] Step S3: removing abnormal heroin samples and methamphetamine samples, and using Gaussian filtering to preliminarily reduce the noise in the sample spectral data after the removal of the heroin samples and methamphetamine samples, so as to make the spectrum smoother and more continuous;
[0074] Step S4: using an interval-invariant elimination feature selection algorithm to perform feature selection on the preprocessed spectrum to determine a characteristic spectrum segment;
[0075] Step S5: Select 5 methamphetamine samples, 5 heroin samples, and 50 non-drug samples to form a prediction set, and the remaining drug samples are used as a calibration set;
[0076] Step S6: using partial least squares method to establish a category recognition model;
[0077] Step S7: Use the established type recognition model to verify the prediction set data that has undergone the same processing, and compare the accuracy of identifying the types of the two drugs, as well as the accuracy of identifying drugs and non-drugs.
[0078] In step S2, the preheating time of the spectrometer is 30 minutes, the wavelength resolution is set to 12 nm, and the wavelength range is set to 900 nm to 1700 nm.
[0079] Further, in another embodiment, the step S2 includes the following steps:
[0080] Step S21: using a pure polystyrene pressed sheet as the background for detection, scanning each sample 7 times, and taking the average value as the spectrum scanning result of that time;
[0081] Step S22: Repeat the test for each sample 5 times, and take the average value as the input spectral variable for modeling;
[0082] Step S23: Non-drug samples are collected once every two days according to the above steps, and each non-drug sample is collected 10 times in total.
[0083] Furthermore, in another embodiment, the specific steps of removing abnormal heroin samples and methamphetamine samples in step S3 include:
[0084] Step S31: After using the PCA algorithm to perform outlier detection on 58 sets of spectral data, the Hotelling statistic and F-residual are obtained;
[0085] Step S32: Draw a scatter plot based on Hotelling's T2 and F-Residuals for outlier observation, and remove outlier samples that exceed the critical values of the two statistics.
[0086] Further, in another embodiment, the interval invariant elimination feature selection algorithm comprises the following steps:
[0087] Step S41: Given a spectral matrix X∈R n×m , where n represents the number of samples, m represents the number of spectral variables, and the response variable vector y∈R n , by constructing a PLS model to find the potential features with greater correlation between the spectral variable X and the response variable y, this feature also considers the maximum covariance between X and y:
[0088] w k = arg max w Cov(Xw,y), subject to w T x T Xw=1
[0089] Where k represents the kth PLS component;
[0090] Step S42: For each spectral variable X j , calculate its importance among all PLS components:
[0091]
[0092] Among them, w kj is the weight of the jth feature in the kth PLS component;
[0093] Step S43: Select Importance I j The higher features constitute the feature set S:
[0094] S={j:I j >γ}
[0095] Among them, γ is a pre-set threshold;
[0096] Step S44: The threshold γ uses the idea of Bayesian regularization to integrate prior knowledge into the threshold selection process. Assume that each feature I j Following a normal prior distribution, μ represents the prior mean and σ represents the prior standard deviation:
[0097] p(I j )~N(μ,σ 2
[0098] Step S45: Calculate the I of each feature in the observed data j value, and update its importance. The final threshold γ selects the value that exceeds I in the posterior distribution. j The 40% quantile of values:
[0099] γ=Φ -1 (0.4)·σ+μ
[0100] where Φ is the quantile function of the standard normal distribution; in this way, we combine prior knowledge and observed data to determine a reasonable threshold γ to strike a balance between model complexity and predictive performance.
[0101] Step S46: Finally, the feature set S is sorted according to the importance I j The values are divided into multiple subsets S 1 , S 2 , …, S p , each subset contains features with similar importance range, for each subset S i Use the UVE algorithm for optimization to identify invalid variables in each subset and remove features that cannot provide additional information:
[0102]
[0103] Among them, Ω is the selected feature subset, X Ω is the submatrix corresponding to the feature subset selected in X, and β is the regression coefficient;
[0104] Step S47: merging the selected subsets to form a final feature set F;
[0105] Step S48: Use the final feature set F to build a PLS model to achieve effective prediction of the response variable y.
[0106] Further, in another embodiment, the step S6 includes the following steps:
[0107] Step S61: assigning values to different types of drug samples (0 for methamphetamine and 1 for heroin);
[0108] Step S62: fitting and mapping different types of samples using a fitting method;
[0109] Step S63: construct a model based on the spectral data matrix X and the dependent variable matrix Y describing the spectral class, so that Y=XB+E;
[0110] Among them, B is the regression coefficient matrix, E is the residual matrix, the X matrix has n rows and m columns, each row is related to the sample and the signal strength of each wave value, and the Y matrix has n rows, each row is a categorical variable specifying the sample type.
[0111] The drug open set identification method of the present invention can be used to perform performance evaluation using the following method:
[0112] Using the confusion matrix with F β The models were evaluated by using different feature selection methods (no treatment, VIP, UVE and interval no variable elimination) to compare their performance in the prediction set.
[0113] In the process of model building, accuracy (Acc), precision rate (PPV), recall rate (TPR) and F are usually used. β The performance evaluation formula for the established category discrimination model is as follows:
[0114] TPR=TP / (TP+FN)
[0115] PPV=TP / (TP+FP)
[0116] Acc=(TP+TN) / (TP+FP+TN+FN)
[0117] TP, FP, TN and FN are the number of samples where positive samples are correctly predicted, the number of samples where negative samples are incorrectly predicted as positive samples, the number of samples where negative samples are correctly predicted and the number of samples where positive samples are incorrectly predicted, respectively.
[0118] TPR: sensitivity, which describes the proportion of correctly identified positive samples to all positive samples.
[0119] PPV: Precision, which describes the proportion of correctly identified positive samples to predicted positive samples.
[0120] Acc: Accuracy, which describes the classification accuracy of the classifier.
[0121] The recall rate represents the model's ability to recognize positive samples. The higher the recall rate, the lower the probability of missed recognition. The precision rate represents the difference between positive samples and negative samples. The higher the precision rate, the higher the probability of correct judgment of positive samples.
[0122] F β The value is the weighted harmonic mean of the accuracy and recall rate, which can balance the advantages and disadvantages of the accuracy and recall rate of the classifier. The calculation formula is shown in the formula. In order to prevent the misidentification of non-drug samples in the drug inspection process from causing serious consequences, more attention is paid to the misidentification of negative samples (non-drugs). In order to select a model with a lower false positive rate, β is set 2 is 0.5, F β The larger the value, the better the model performance.
[0123]
[0124] Figure 3 The confusion matrix of qualitative identification of drugs and non-drugs with different feature selection methods. When the prediction set is externally verified by the model with interval variable elimination for feature selection, the accurate identification rate of non-drugs can reach 100%, and no false positives occur. Figure 4 It can be seen that this method also has a high accuracy rate in distinguishing the types of drugs.
[0125] Table 1 Evaluation of Gaussian filter-PLS model prediction set
[0126]
[0127] Table 1 shows the prediction performance of the Gaussian filter-PLS qualitative recognition model under different preprocessing conditions. The model established by the spectrum after interval variable elimination has a better performance evaluation, with higher PPV, TPR and Acc values, and F β The value is 1.000. Compared with other feature selection methods, the performance of the qualitative recognition model focusing on precision established by the interval variable elimination method has increased by more than 50%, and has achieved better performance in the open set recognition process. In addition, the prediction results of the spectra processed by the interval variable elimination method have a significant spatial distance from the two drugs in the modeling library ( Figure 5), the number of non-drug prediction results falling within the drug threshold interval is the least, and the distance from the drug threshold interval is far, with a higher difference performance than the other models. Therefore, the interval variable-free elimination feature selection algorithm can effectively mine the information with high correlation with the type in the sample library spectrum, and improve the accuracy and reliability of the model open set recognition classification.
[0128] According to the description and drawings of the present invention, those skilled in the art can easily manufacture or use the open set drug identification method based on the interval-invariant elimination feature selection algorithm of the present invention, and can produce the positive effects recorded in the present invention.
[0129] Unless otherwise specified, in the present invention, the terms "length", "width", "up", "down", "front", "back", "left", "right", "vertical", "horizontal", "top", "bottom", "inside", "outside", "clockwise", "counterclockwise", "axial", "radial", "circumferential" and the like indicating orientation or positional relationships are based on the orientation or positional relationships shown in the drawings, which are only for the convenience of describing the present invention and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, be constructed and operate in a specific orientation. Therefore, the terms describing the orientation or positional relationship in the present invention are only used for illustrative purposes and cannot be understood as limitations on this patent. For ordinary technicians in this field, the specific meanings of the above terms can be understood in conjunction with the drawings and according to specific circumstances.
[0130] Unless otherwise clearly specified and limited, in the present invention, the terms "disposed", "connected" and "connected" should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be directly connected, or indirectly connected through an intermediate medium, or it can be the internal communication of two elements. For ordinary technicians in this field, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.
[0131] The above description is only a preferred embodiment of the present invention and does not limit the present invention in any form. Any simple modification or equivalent change made to the above embodiment based on the technical essence of the present invention shall fall within the protection scope of the present invention.
Claims
1. A drug open set identification method based on interval variable-free elimination feature selection algorithm, characterized by: The following steps are involved: Step S1: preparing a plurality of methamphetamine samples, heroin samples and non-drug samples; Step S2: After the spectrometer is preheated, the wavelength resolution and wavelength range are set to collect the sample spectrum; Step S3: removing abnormal heroin samples and methamphetamine samples, and using Gaussian filtering to preliminarily reduce the noise in the sample spectral data after the removal of the heroin samples and methamphetamine samples, so as to make the spectrum smoother and more continuous; Step S4: using an interval-invariant elimination feature selection algorithm to perform feature selection on the preprocessed spectrum to determine a characteristic spectrum segment; Step S5: Select 5 methamphetamine samples, 5 heroin samples, and 50 non-drug samples to form a prediction set, and the remaining drug samples are used as a calibration set; Step S6: using partial least squares method to establish a category recognition model; Step S7: Use the established type recognition model to verify the prediction set data that has undergone the same processing, and compare the accuracy of identifying the types of the two drugs, as well as the accuracy of identifying drugs and non-drugs.
2. The open set drug identification method based on the interval-invariant elimination feature selection algorithm according to claim 1 is characterized in that: In step S2, the preheating time of the spectrometer is 30 minutes, the wavelength resolution is set to 12 nm, and the wavelength range is set to 900 nm to 1700 nm.
3. The open set drug identification method based on the interval-invariant elimination feature selection algorithm according to claim 1 is characterized in that: The step S2 includes the following steps: Step S21: using a pure polystyrene pressed sheet as the background for detection, scanning each sample 7 times, and taking the average value as the spectrum scanning result of that time; Step S22: Repeat the test for each sample 5 times, and take the average value as the input spectral variable for modeling; Step S23: Non-drug samples are collected once every two days according to the above steps, and each non-drug sample is collected 10 times in total.
4. The open set drug identification method based on the interval-invariant elimination feature selection algorithm according to claim 1 is characterized in that: The specific steps of removing abnormal heroin samples and methamphetamine samples in step S3 include: Step S31: After using the PCA algorithm to perform outlier detection on 58 sets of spectral data, Hotelling statistics and F-residuals are obtained; Step S32: Draw a scatter plot based on the Hotelling statistic and the F-residual for outlier observation, and remove abnormal samples that exceed the critical values of the two statistics.
5. The open set drug identification method based on the interval-invariant elimination feature selection algorithm according to claim 1 is characterized in that: The interval-invariant elimination feature selection algorithm comprises the following steps: Step S41: Given a spectral matrix X∈R n×m , where n represents the number of samples, m represents the number of spectral variables, and the response variable vector y∈Rn. By constructing a PLS model, we can find the potential features with large correlation between the spectral variable X and the response variable y, which also considers the maximum covariance between X and y: W k =arg max w Cov(Xw,y),subject to w T X T Xw=1 Where k represents the kth PLS component; Step S42: For each spectral variable Xj, calculate its importance in all PLS components: Among them, w kj is the weight of the jth feature in the kth PLS component; Step S43: Select Importance I j The higher features constitute the feature set S: S={j:I j >c} Among them, γ is a pre-set threshold; Step S44: The threshold γ uses the idea of Bayesian regularization to integrate prior knowledge into the threshold selection process. Assume that each feature I j Following a normal prior distribution, μ represents the prior mean and σ represents the prior standard deviation: p(I j )~N(μ,σ 2 ) Step S45: Calculate the I of each feature in the observed data j value, and update its importance, and finally the threshold γ selects the value that exceeds I in the posterior distribution j The 40% quantile of values: γ=Φ- 1 (0.4)·s+μ Where Φ is the quantile function of the standard normal distribution; Step S46: Finally, the feature set S is sorted according to the importance I j The values are divided into multiple subsets S1, S2, ..., S p , each subset contains features with similar importance range, for each subset S i Use the UVE algorithm for optimization to identify invalid variables in each subset and remove features that cannot provide additional information: in, Ω is the selected feature subset, X Ω is the submatrix corresponding to the feature subset selected in X, and β is the regression coefficient; Step S47: merging the selected subsets to form a final feature set F; Step S48: Use the final feature set F to build a PLS model to achieve effective prediction of the response variable y.
6. The open set drug identification method based on the interval-invariant elimination feature selection algorithm according to claim 1 is characterized in that: The step S6 comprises the following steps: Step S61: assigning values to different types of drug samples (0 for methamphetamine and 1 for heroin); Step S62: fitting and mapping different types of samples using a fitting method; Step S63: construct a model based on the spectral data matrix X and the dependent variable matrix Y describing the spectral class, so that Y=XB+E; Among them, B is the regression coefficient matrix, E is the residual matrix, the X matrix has n rows and m columns, each row is related to the sample and the signal strength of each wave value, and the Y matrix has n rows, each row is a categorical variable specifying the sample type.
Citation Information
Cited By
Drug identification method, device and equipment based on spectrum correlation dimension raising and medium
CN119810575A
