Sensor drift correction method and system based on transfer learning
Through the domain adaptive method based on transfer learning, the sensor data is drifted, which solves the accuracy and reliability problems caused by sensor drift, and achieves high accuracy in intelligent lung cancer detection.
Patent Information
- Application Number
- CN202411646649.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-18
- Publication Date
- 2025-03-11
- Estimated Expiration
- 2044-11-18
AI Technical Summary
Sensor drift causes gas sensor performance to decline, affecting system accuracy and reliability, especially in intelligent lung cancer detection. The accuracy and stability are not high enough.
Using a transfer learning-based method, domain adaptive correction is performed by collecting sensor response data from healthy individuals and lung cancer patients in two different periods before and after, using domain adaptive correction, using the use of minimizing the distance between edge distribution and conditional distribution, and maximizing cross-domain category information to obtain the drift-corrected target domain data feature set.
Effectively correcting the drift of the sensor improves the accuracy and reliability of the gas sensor, especially in intelligent detection of lung cancer, it obtains a high classification accuracy.
Smart Images

Figure CN119598254A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of gas sensors, and in particular to a sensor drift correction method and system based on transfer learning. Background Art
[0002] The odor detection system is an artificial olfactory system inspired by biological nasal organs, designed to identify various odors and volatile organic compounds (VOCs). Lung cancer is one of the most deadly cancers worldwide. Although treatment methods are constantly improving, its prognosis is poor and detection methods are invasive and harmful to the human body. The application of odor detection systems in lung cancer screening, prevention and regular testing is of great significance. However, there are still some problems to be solved to achieve accurate odor detection and identification. Among them, the sensor array, as a key component of this technology, inevitably has drift problems, making it difficult for the algorithm to make accurate medical decisions.
[0003] Sensor drift is a very common problem that can cause gas sensor performance to degrade, affecting system accuracy and reliability. Drift is usually caused by environmental factors such as sensor aging, poisoning, temperature and humidity changes, which can cause distribution distortion, increase data uncertainty, and reduce performance. In the field of bionic olfaction, the response of the sensor array exhibits nonlinear dynamic changes due to sensor drift. Therefore, when reacting to the same type of gas, the response of the gas sensor is not always the same. There are currently some domain adaptive methods that can correct these drifts, but the accuracy and stability of these methods are still not high enough when directly used for intelligent lung cancer detection. Summary of the invention
[0004] The present invention provides a sensor drift correction method and system based on transfer learning, and solves the technical problem of how to correct drifted sensor data.
[0005] In order to solve the above technical problems, the present invention first provides a sensor drift correction method based on transfer learning, comprising the steps of:
[0006] S1. Collect sensor response data of healthy individuals and lung cancer patients at two different periods, and use the labeled early data as the source domain dataset and the unlabeled later data as the target domain dataset;
[0007] S2, extracting features from the source domain data set and the target domain data set using the same preprocessing process to obtain a source domain data feature set and a target domain data feature set;
[0008] S3. Based on transfer learning, the source domain data feature set is used to perform domain adaptation on the target domain data feature set to obtain a drift-corrected target domain data feature set;
[0009] The step S3 specifically comprises the following steps:
[0010] S31, minimizing the joint distribution distance between the target domain data feature set and the source domain data feature set after projection mapping, maximizing the difference between different categories of the target domain data feature set and the source domain data feature set, and retaining category information for classification as a goal, obtaining a functional relationship for obtaining a transformation matrix P;
[0011] S32, calculating known parameters in the functional relationship based on the target domain data feature set and the source domain data feature set;
[0012] S33, based on the known parameters, solving the functional relationship to obtain an initial transformation matrix P0;
[0013] S34, calculating a new target domain data feature set and a new source domain data feature set based on the initial transformation matrix P0;
[0014] S35, training a classifier using the new source domain data feature set, and predicting the classifier using the new target domain data feature set to obtain a pseudo label of the new target domain data feature set;
[0015] S36, updating the pseudo-label of the target domain data feature set, updating the known parameters related to the pseudo-label in the functional relationship, and returning to step S33;
[0016] S37, repeat steps S33 to S36 until the number of iterations is reached, and output the current transformation matrix P t As the optimal transformation matrix P, output the current classifier f;
[0017] S38. Based on the optimal transformation matrix P and the target domain data feature set, obtain the target domain data feature set after drift correction.
[0018] Further, in the step S32, the functional relationship is: Wherein, Z is the total feature data set including the target domain data feature set and the source domain data feature set, W c is the maximum mean difference matrix of the conditional probability between the source domain feature dataset and the target domain feature dataset after domain adaptation, c=0 corresponds to the case when the label class is not distinguished, c=1,2,…,C represents the cth class label, C represents the label type, K represents the joint probability matrix between the source domain feature dataset and the target domain feature dataset after domain adaptation, φ is the Lagrange multiplier, α is the measurement parameter of the category information, and I is the unit matrix.
[0019] Furthermore, the step S31 specifically includes the steps of:
[0020] Calculate the source domain feature dataset D s and target domain feature dataset D t The marginal difference between m (D s ,D t )=Tr(P T ZWZ T P), W0 is D s With D t The maximum mean difference matrix between them, the superscript T indicates matrix transposition, and Tr() indicates matrix trace;
[0021] Calculate the source domain feature dataset D s and target domain feature dataset D t The conditional distribution difference between W c D s With D t The maximum mean difference matrix of conditional probabilities between ;
[0022] D m (D s ,D t ) and d c (D s ,D t ) add them together to get D s With D t The difference in joint probability distribution between When c=0, the labels are not distinguished, and the difference between the overall sample means of the source domain and the target domain is calculated;
[0023] Based on the Bayesian formula Expand and get d(D s ,D t )=M T +M D , M T is a matrix that measures the transferability of the same category across domains, M D =Tr(P T ZGar T P) is a matrix that measures the distinguishability between different categories in different domains;
[0024] Minimizing the joint distribution distance between the target domain data feature set and the source domain data feature set after projection mapping, maximizing the difference between different categories of the target domain data feature set and the source domain data feature set, and retaining category information for classification as the goal of constructing an objective function;
[0025] The objective function is solved to obtain the functional relationship.
[0026] Furthermore, the objective function is constructed as follows: T ZHZ T Under the condition of P = I, we can get The minimum transformation matrix P.
[0027] Furthermore, solving the objective function comprises the steps of:
[0028] Solving the objective function using the Lagrangian method to obtain a Lagrangian function;
[0029] The Lagrangian function is differentiated with respect to the transformation matrix P to obtain the functional relationship.
[0030] Furthermore, in the step S1, the collected sensor response data includes 6 experimental stages P1-P6, which are respectively an air baseline collection stage, a helium baseline collection stage, a pre-concentration stage, a thermal desorption stage, a sampling stage and a cleaning stage. In the P1 stage, the filtered air enters the system at a higher flow rate; in the P2 stage, helium is used as a carrier gas and blown into the system at a high speed; in the P3 stage, the sample gas is blown into the adsorption tube at a high speed, and the gas outside the adsorption range of the adsorption tube responds; in the P4 stage, the gas adsorbed by the adsorption tube in the P3 stage is desorbed; in the P5 stage, helium is purged from the system at a low speed in the opposite direction, and the gas desorbed from the adsorption tube is blown out and sent into the gas chamber to react with the sensor. At this time, the gas that generates a response is the gas adsorbed by the adsorption tube in the P3 stage; and in the P6 stage, the entire gas path is cleaned.
[0031] Furthermore, in step S2, the preprocessing process includes:
[0032] Each response data of each sensor is filtered using an N-order mean filter;
[0033] Extract the response data of each sensor at stages P1, P2, P3, and P5;
[0034] The response data of the P1 stage is used as the baseline of the response data of the P3 stage, and the first-category features and the second-category features of the two stages are extracted;
[0035] The response data of the P2 stage is used as the baseline of the response data of the P5 stage, and the first-category features and the second-category features of the two stages are extracted;
[0036] Normalizing the first-class features and the second-class features of the P1 stage and the P3 stage to obtain the first-class normalized features of the response data of the sensor;
[0037] The first and second characteristics of the P2 and P5 stages are normalized to obtain second normalized characteristics of the response data of the sensor.
[0038] Furthermore, the process of filtering using an N-order mean filter is as follows: the filtered value of the j-th sensor at the i-th sampling point in the d-th sample Equal to the response value of the jth sensor at the i-th sampling point in the d-th sample of the original data set and the sum of the following (N-1) response values (i.e. ) minus the maximum value of these N response values (i.e. ) minus the minimum value of these N response values (i.e. ) and then divide the difference by (N-2);
[0039] The first type of feature for the P1 and P3 stages is: the mean value of the P3 stage minus the mean value of the P1 stage. The first type of feature for the P1 and P3 stages is: the median value of the response in the P3 stage minus the mean value in the P1 stage.
[0040] The first type of feature in the P2 and P5 stages is: the average value of the P5 stage minus the average value of the P2 stage. The first type of feature in the P2 and P5 stages is: the second type of feature is: the median response of the P5 stage minus the average value of the P2 stage.
[0041] Furthermore, the process of normalizing the first-category features and the second-category features in the P1 stage and the P3 stage is formulated as follows: is the corresponding normalized feature representation, f d,j,1 ,f d,j,2 are the first and second features of the P1 and P3 phases of the j-th response data of the d-th sensor, respectively. β is the weight factor. and σ1,σ2 are f d,j,1 ,f d,j,2 The mean and standard deviation of
[0042] The process of normalizing the first and second features of the P2 and P5 stages is formulated as follows: is the corresponding normalized feature representation, f d,j,3 ,f d,j,4 They are the first and second features of the P2 and P5 phases of the j-th response data of the d-th sensor, and σ3,σ4 are f d,j,3 ,f d,j,4 The mean and standard deviation of .
[0043] The present invention also provides an intelligent lung cancer detection system, the key of which is that it includes an exhalation detection system and a sensor drift correction module, the exhalation detection system is used to execute steps S1 and S2 in the sensor drift correction method based on transfer learning, the sensor drift correction module is used to execute step S3, and the sensor drift correction module is also used to use the classifier f and the optimal transformation matrix P to predict the input exhalation feature data of lung cancer patients, and output the pseudo-label corresponding to the exhalation feature data of lung cancer patients as the lung cancer detection result.
[0044] It should also be noted that the sensor drift correction method and system based on transfer learning provided by the present invention can also be used in other gas sensor intelligent detection applications besides lung cancer detection.
[0045] The present invention provides a sensor drift correction method and system based on transfer learning, which first collects sensor response data of healthy individuals and lung cancer patients in two different periods, and uses the labeled early data as the source domain data set, and the unlabeled later data as the target domain data set, and then pre-processes the data to extract features to obtain source domain data feature sets and target domain data feature sets, and finally performs domain adaptation on the target domain data feature set based on transfer learning to obtain the drift-corrected target domain data feature set. The present invention performs drift correction by minimizing the distance between the marginal distribution and the conditional distribution and forcing the maximization of cross-domain category information, and pre-processes the original data set to extract a small number of representative features to highly characterize the original data, ensuring that the data can be effectively used by the machine learning algorithm. Experimental results show that the present invention can effectively correct the drift of the sensor and obtain a higher classification accuracy in intelligent detection based on gas sensors, such as intelligent detection of lung cancer. BRIEF DESCRIPTION OF THE DRAWINGS
[0046] Figure 1 is a flow chart of a sensor drift correction method based on transfer learning provided by an embodiment of the present invention;
[0047] Figure 2 is a schematic diagram of the gas sampling phase of the breath detection system provided by an embodiment of the present invention;
[0048] Figure 3 is a schematic diagram of a sensor array provided by an embodiment of the present invention;
[0049] Figure 4 is an example diagram of a response curve of a sensor array provided by an embodiment of the present invention;
[0050] Figure 5 is a visualization image of data before and after drift correction provided by an embodiment of the present invention;
[0051] Figure 6It is a confusion matrix provided by an embodiment of the present invention when predicting the response data of the first four sensors. DETAILED DESCRIPTION
[0052] The following specifically illustrates the implementation mode of the present invention in conjunction with the accompanying drawings. The embodiments are provided for illustrative purposes only and cannot be understood as limiting the present invention. The accompanying drawings are provided for reference and illustration only and do not constitute a limitation on the scope of patent protection of the present invention, because many changes can be made to the present invention without departing from the spirit and scope of the present invention.
[0053] The sensor drift correction method based on transfer learning provided by the embodiment of the present invention is as follows: Figure 1 As shown, the steps include:
[0054] S1. Collect sensor response data of healthy individuals and lung cancer patients at two different periods, and use the labeled early data as the source domain dataset and the unlabeled later data as the target domain dataset;
[0055] S2, extracting features from the source domain data set and the target domain data set using the same preprocessing process to obtain a source domain data feature set and a target domain data feature set;
[0056] S3. Based on transfer learning, the source domain data feature set is used to perform domain adaptation on the target domain data feature set to obtain the drift-corrected target domain data feature set.
[0057] Wherein, step S3 specifically includes the steps of:
[0058] S31, with the goal of minimizing the joint distribution distance between the target domain data feature set and the source domain data feature set after projection mapping, and maximizing the difference between different categories of the target domain data feature set and the source domain data feature set, and retaining the category information for classification, obtaining a functional relationship for obtaining the transformation matrix P;
[0059] S32, calculating known parameters in the function relationship based on the target domain data feature set and the source domain data feature set;
[0060] S33, based on known parameters, solving the function relationship to obtain the initial transformation matrix P0;
[0061] S34, calculating a new target domain data feature set and a source domain data feature set based on the initial transformation matrix P0;
[0062] S35, training a classifier using the new source domain data feature set, and predicting the classifier using the new target domain data feature set to obtain a pseudo label of the new target domain data feature set;
[0063] S36, updating the pseudo-label of the target domain data feature set, updating the known parameters related to the pseudo-label in the functional relationship, and returning to step S33;
[0064] S37, repeat steps S33 to S36 until the number of iterations is reached, and output the current transformation matrix P t As the optimal transformation matrix P, output the current classifier f;
[0065] S38. Based on the optimal transformation matrix P and the target domain data feature set, obtain the target domain data feature set after drift correction.
[0066] Based on the above-mentioned sensor drift correction method based on transfer learning, the present invention also provides an intelligent lung cancer detection system, which includes an exhalation detection system and a sensor drift correction module. The exhalation detection system is used to execute steps S1 and S2 in the sensor drift correction method based on transfer learning, and the sensor drift correction module is used to execute step S3. The sensor drift correction module is also used to use the classifier f and the optimal transformation matrix P to predict the input exhalation feature data of the lung cancer patient, and output the pseudo label corresponding to the exhalation feature data of the lung cancer patient as the lung cancer detection result.
[0067] First, in order to effectively collect odor data of lung cancer patients and healthy individuals in the method and system, this embodiment designs an exhaled breath detection system, which mainly includes a gas collection component, a pre-enrichment component, a detection and identification component, and a host computer, which can realize automatic gas sampling, concentration and enrichment of exhaled gas, odor signal conversion, preliminary signal processing and transmission, and overall component control.
[0068] The gas collection component is mainly composed of a polytetrafluoroethylene tube, a mass flow controller (MFC), an air pump, a three-way valve, and a five-way valve. The negative pressure generated by the air pump draws the gas to be tested into the detection and identification component through the polytetrafluoroethylene tube to achieve the effect of automatic sampling. The sampling at different stages is achieved through the interface conversion of the three-way valve and the five-way valve controlled by the host computer.
[0069] The pre-enrichment component consists of a heating device unit (including an adsorption tube, a temperature sensor, a heating tube), a PID (proportional integral differential) temperature controller, and a computer control unit.
[0070] The sensor array composed of gas sensors is the core component of the detection and identification component, which can improve the minimum detection limit of the sensor so that low concentrations of VOCs in exhaled gas can be detected normally by the sensor. The composition of the sensor array will affect the final recognition and detection effect of the system. In order to isolate the influence of external gas, a gas chamber is covered on the sensor array, and the gas is transported to the air inlet chamber to react with the sensor array.
[0071] The host computer is mainly used for odor signal conversion, preliminary signal processing and transmission.
[0072] Gas sampling in breath detection systems can be divided into Figure 2 The six experimental stages P1-P6 shown are respectively the air baseline collection stage (P1), the helium baseline collection stage (P2), the pre-concentration stage (P3), the thermal desorption stage (P4), the sampling stage (P5) and the cleaning stage (P6). The specific operating procedures and principles of each stage of the entire experiment are as follows:
[0073] P1: Filtered air enters the system at a higher flow rate;
[0074] P2: Helium is used as carrier gas and blown into the system at high speed;
[0075] P3: The sample gas is blown into the adsorption tube at high speed. The gas with carbon content within the adsorption range of the adsorption tube is adsorbed by the adsorption tube, and the remaining gas not adsorbed by the adsorption tube enters the gas chamber and reacts with the sensor, generating a response at this stage. That is, the response gas generated at this stage is the gas outside the adsorption range of the adsorption tube.
[0076] P4: In this stage, the system is heated to 270°C. The main purpose is to desorb the gas adsorbed by the adsorption tube in the P3 stage, so that the VOCs in it can be separated from the adsorption tube for the next stage of reaction.
[0077] P5: Helium is purged from the system at a low speed in the opposite direction for 6 minutes, blowing out the gas desorbed from the adsorption tube and sending it into the gas chamber to react with the sensor. The gas that responds at this time is the gas adsorbed by the adsorption tube in the P3 stage.
[0078] P6: Turn off the heating system, turn on the fan, and clean the sensor array with filtered air until the system temperature drops to room temperature. The main purpose of this stage is to clean the entire gas path and ensure that the system is ready for the next gas experiment at any time.
[0079] The sensor array used in this embodiment is as follows Figure 3 As shown in Figure 1, some of them are metal oxide sensors and some are electrochemical sensors. The response curves of the sensor array corresponding to the six experimental stages P1-P6 are shown in Figure 1. Figure 4 As shown, it can be seen that different sensors have different overall response characteristics, and sensors at the same stage also have different performances.
[0080] Next, data preprocessing is performed.
[0081] The breath test data is saved in a.txt file format, which contains the voltage value (mV) of each sensor at each sampling point during the entire experimental phase. The dimension of the data collected by each sensor is the product of the number of sampling points and the number of sensors. This is a set of high-dimensional time series matrices. Each sensor has hundreds or thousands of sampling points. The amount of calculation is too large to be used directly in machine learning algorithms. Therefore, it is necessary to preprocess the raw data to extract a small number of representative features to highly characterize the raw data to ensure that the data can be effectively used by the machine learning algorithm. The preprocessing process includes steps such as filtering, feature extraction, and normalization.
[0082] In order to clearly represent the data preprocessing process, the original data set is defined as Where D is the total number of odor data, and each time the data collected by all sensors in the six experimental stages P1-P6 is one odor data, Z d and c d Represent the d-th odor data and its corresponding class label respectively. Where m is the number of sampling points, n is the number of sensors in the sensor array, that is, each odor data includes m×n sampling voltage values, forming an m×n dimensional voltage value array, where That is, it represents the voltage value of the jth sensor at the ith sampling point of the dth odor data (the element of the ith row and jth column of the voltage value array). In the experimental design, D = 278, m = 3990, n = 19. The data set used in this paper is the exhaled gas data collected from healthy individuals and lung cancer patients at different times.
[0083] During the normal operation of the sensor, some glitches, oscillations or fluctuations often appear in the signal due to factors such as electromagnetic interference, noise, and ripple voltage in the circuit. Therefore, before extracting features, it is necessary to filter the response signal. For each sensor response in a single odor data, an N-order (15-order in this example) mean filter is designed and implemented to reduce the noise introduced during the entire data collection process.
[0084] The filtering process is expressed as:
[0085]
[0086] in, is the filtered value of the jth sensor at the i-th sampling point in the d-th sample, is the response value of the jth sensor at the i-th sampling point in the d-th sample of the original data set, N is the order of the filtering equation, max{} represents the maximum value within {}, and min{} represents the minimum value within {}. The filtering process can be explained as: the filtering value of the jth sensor at the i-th sampling point in the d-th sample Equal to the response value of the jth sensor at the i-th sampling point in the d-th sample of the original data set and the sum of the following (N-1) response values (i.e. ) minus the maximum value of these N response values (i.e. ) minus the minimum value of these N response values (i.e. ) and then divide the difference by (N-2).
[0087] Next, a small number of representative features are extracted to characterize the raw data. Two features are selected for each sensor, namely: (1) the average value; (2) the median value. Let F be the feature matrix obtained after feature extraction, and the feature elements contained are expressed as (f d,j,k ) D×n (d=1,...,D,j=1,...,n,k=1,2), d represents the dth sample, D is the total number of samples, j represents the jth sensor, the total number of sensors is represented by n, and k is the kth feature extracted by feature extraction. For the two selected features, it is necessary to subtract the stable value of the baseline phase in the corresponding extraction process.
[0088] In the feature extraction of this example, since the experimental design is a multi-stage mode, each experimental data contains 6 stages, but only a part of them is used for feature extraction. For each experimental data sample, the stages used for feature extraction are P1, P2, P3 and P5 respectively. Among them, the P1 baseline stage is used as the P3 stage baseline, and the P2 gas baseline stage is used as the P5 stage baseline. Here, P3 and P1 are called a group of stages, and P5 and P2 are called a group of stages. For each experimental sample data, two groups of experimental stage features are extracted. The first and second types of features extracted from the pre-concentration stage (P3) using the P1 stage as the baseline are expressed as:
[0089]
[0090] Among them, z avg,P3 is the average value of the P3 stage, z mid,P3 is the median response of the P3 stage, z base,P1 is the average value of stage P1. Similarly, taking stage P2 as the baseline, the first and second features extracted from stage P5 are expressed as:
[0091]
[0092] Among them, z avg,P5 is the average value of P5 stage, z mid,P5 is the median response of stage P5, z base,P2 is the average value of the P2 stage.
[0093] After feature extraction, each experimental data generates 4×19-dimensional feature data, and a feature matrix F with lower data dimension is obtained. The vectorized representation of the feature is:
[0094]
[0095] Among them, F1 and F2 are the vectorized representations of the features extracted in the P3 and P5 stages, and the superscript T represents the matrix transpose.
[0096] Through this transformation, multiple features extracted from the sensor signal can be converted into a one-to-one correspondence between feature vectors and sensors. In the subsequent optimization process, the optimized sensor ranking will be directly obtained. There are many types of sensors in the sensor array, with different performances and significant differences in output signals. In order to eliminate the differences in response data attributes between sensors and solve the problem of incomparable sensor data, a weighted modified "Z-score" normalization method is derived to standardize the data. Since the two features extracted in the same stage are vectorized, the two features in stages P3 and P5 are uniformly normalized during the normalization process:
[0097]
[0098] in, are the normalized feature representations of the features extracted in stages P3 and P5, β is the weight factor, 0≤β≤1, and σ1, σ2, σ3, σ4 are f d,j,1 ,f d,j,2 ,f d,j,3 ,f d,j,4 After data preprocessing, common machine learning methods can be used for sensor drift correction and intelligent lung cancer detection.
[0099] This embodiment uses data with a certain time span in the same breath detection system to study the time drift. Table 1 shows the distribution of the data set used in this example. The time of the breath test is divided into early experiments and late experiments. In transfer learning, the data is usually divided into a source domain and a target domain. The source domain refers to a domain where labeled data or knowledge already exists, usually the domain of the training data set or the domain of the training task. In the source domain, there is a large amount of labeled data or trained models that can be used for training learning tasks. The target domain is the domain where knowledge or models are transferred from the source domain to a new domain or task.
[0100] Table 1 Distribution of experimental sample categories in two different periods
[0101]
[0102] The target domain is usually a field where practical problems need to be solved, but due to data scarcity, difficulty in labeling, etc., it may not be possible to directly use traditional machine learning methods for training. In drift calibration, the source domain and the target domain are usually divided according to whether the data drifts, that is, the source domain data is the data that has not drifted, and the target domain data is the data that has drifted. The samples in the later stage of the experiment have produced different degrees of drift, which is considered to be the target domain. Therefore, this embodiment proposes a joint domain adaptation method to overcome the differences caused by time drift.
[0103] Definition: Source Domain There are s feature data, target domain There are t feature data, Z s , Z t are the feature datasets of the source domain and the target domain respectively, L s is the label set of the source domain; Z s Include s eigenvectors, where the i-th eigenvector is denoted as z s,i Similarly, Z t Include t eigenvectors, of which the jth eigenvector is denoted as z t,j ; L s Including C-type label, z s,i The corresponding label is represented by l s,i The target domain does not contain labels, but during the training process, since the training needs to output the labels of the target domain, it is assumed here that the feature space and label space of the two domains are the same. In domain adaptation, a transformation matrix P is defined to map the feature data to the regenerated Hilbert space (RHS), and the data distribution is aligned after the feature transformation. In terms of distribution, it is assumed that the marginal distribution and conditional distribution of the source domain and the target domain are different, that is, P(Z s )≠P(Z t ),P(L s ∣Z s )≠P(L t ∣Z t ), the joint distribution is also different: P(Z s ,L s )≠P(Z t ,L t ).
[0104] The design of domain adaptation methods can be considered from two aspects: minimizing the joint distribution distance after projection mapping, reducing the difference between domains, and achieving migration; maximizing the difference between different categories in the source domain and the target domain, and retaining category information for classification. Specifically, the measurement of distribution distance is based on MMD (Maximum Mean Discrepancy) distance calculation. By minimizing the MMD distance design, the similarity and traction of the distribution can be achieved, so that the target domain distribution is closer to the source domain to achieve migration. For the preservation of cross-domain category information, the Bayesian formula is used to expand the representation of cross-domain information of different categories, and it is maximized when designing the optimization target.
[0105] First, for the migration operation, the marginal distribution and conditional distribution between data are uniformly represented from the perspective of data distribution. The marginal distribution difference between the source domain and the target domain can be expressed as d m (D s ,D t ) and expands to:
[0106]
[0107] Z is inclusive of Z s , Z t The total feature data set is P, P is the transformation matrix, W0 is the MMD matrix, and Tr() represents the matrix trace. The elements of the i-th row and j-th column of W0 are calculated according to the following rules:
[0108]
[0109] Among them, z i and z j They represent the i-th and j-th samples in the total feature data set Z respectively.
[0110] The conditional distribution difference d between the source domain and the target domain c (D s ,D t ) is recorded as:
[0111]
[0112] in, Represent the number of samples of category c in the source domain and target domain respectively, represents the c-th class samples in the source domain and the target domain, W represents the square of the Frobenius norm of the matrix, that is, the sum of the squares of all elements of the matrix. c is the MMD matrix of conditional probability, expressed as:
[0113]
[0114] Adding equation (6) and equation (8), we get the expression of the joint probability distribution difference:
[0115]
[0116] Here c=0 corresponds to the case of formula (6), which calculates the difference between the overall sample means of the source domain and the target domain, and c=1 to c=C represent the conditional distribution differences between different categories.
[0117] Next, we consider the maximum representation of category difference information. Based on the Bayesian formula, we expand equation (10):
[0118]
[0119] in, They are the labels of the source domain data and the pseudo labels of the target domain data, respectively. Represents the label belonging to category c in the source domain data. Indicates that the target domain belongs to the class . is the target domain and the source domain (i.e. ) have labels of the same category. They represent the conditional probability distribution of the source domain and the target domain respectively when the category c is given, It represents the difference in the joint probability distribution between the two conditional probability distributions of the source domain and the target domain. Represents the category in the target domain The conditional probability distribution of hour, represents the difference in joint probability distribution between different categories in the source domain and the target domain, M T is a matrix that measures the transferability of the same category across domains, M D is a matrix that measures the distinguishability between different categories in different domains. Therefore, we obtain a representation of the category difference and constrain it to maximize it, M D It is stripped out of the formula as a subsequent optimization to ensure maximum preservation of category information.
[0120] Next, we can get M D The expanded derivation of :
[0121] M D =Tr(P T ZGar T P) (12)
[0122] The joint probability matrix Expressed as G s and G t One-Hot encoding is defined as: G s=[L s (:,1)×(C-1),...,L s (:,C)×(C-1)], L s (:,i) represents the i-th column of all rows of the source domain feature dataset, and ×(C-1) represents repetition (C-1) times. express hour All rows and columns 1 to C.
[0123] So far, the cross-domain distribution distance and class differential have been expressed by the trace of the matrix. Combining equations (9) and (12), adding regularization terms to prevent overfitting, we can construct an architecture with the minimum distribution distance. Considering the special case of minimization will lead to the global optimal solution P = 0, which is meaningless. To avoid this situation, the projection should also consider the data variance before and after the transformation, so as to maximize the data to maintain the original properties. Therefore, the constructed objective function can be expressed as:
[0124]
[0125] The objective function can be interpreted as: T ZHZ T Under the condition of P = I, we can get The smallest transformation matrix P, where λ represents the regularization coefficient and I represents the identity matrix, Represents the square of the Frobenius norm.
[0126] Solving equation (13) using the Lagrangian method yields the Lagrangian function:
[0127]
[0128] Among them, φ is the Lagrange multiplier and α is the measurement parameter of category information.
[0129] Taking the derivative of L with respect to P, we get:
[0130]
[0131] By solving equation (15), the optimal transformation matrix P can be obtained.
[0132] The process of solving the optimal transformation matrix P includes the following steps:
[0133] According to the source domain and target domain feature data sets, construct the MMD matrices W0 and W c , construct the joint probability matrix K;
[0134] Based on W0, W c , K solves equation (15) and obtains the initial transformation matrix P0;
[0135] exist Train the classifier f on Predict the pseudo-label in the target domain
[0136] Update the pseudo labels of the target domain feature dataset Update W c ;
[0137] Repeat the above steps until the number of iterations t is reached, and output the current transformation matrix P t is the optimal transformation matrix P, and outputs the current classifier f.
[0138] During the test, the classifier f outputs the pseudo-label corresponding to the target domain data as the detection result based on the input target domain data and the optimal transformation matrix P. When applied in intelligent lung cancer detection, the classifier f outputs the pseudo-label corresponding to the lung cancer patient's breath feature data as the detection result based on the input lung cancer patient's breath feature data and the optimal transformation matrix P.
[0139] The data used in the experiment are breath gas samples collected from lung cancer patients and healthy individuals on a breath detection system. Due to the large time span of the experiment, there is obvious drift, which affects the validity of the data. The transfer learning algorithm proposed in this paper is used to correct the drift of the data, and the data is divided into source domain and target domain for migration according to the order of the experimental time.
[0140] Figure 5 is a visualization image of the data before and after drift correction, where (a) is the visualization of the original data, and (b) is the visualization image of the data after the drift correction process of the present invention is adopted. S-cancer, S-health, T-cancer, and T-health correspond to the source domain lung cancer samples, source domain health samples, target domain lung cancer samples, and target domain health samples, respectively. Figure 5 From (a), we can see that the distribution of target domain data is quite different from that of source domain data, and some samples in the target domain are significantly different from the overall distribution, indicating that there is a large drift between the target domain data and the source domain data, and the drift is uncertain, which shows the necessity of using domain adaptation algorithm. Figure 5 It can be seen from (b) that after the drift correction of the present invention, the difference between the distribution of the target domain data and the distribution of the source domain data is greatly reduced, which is beneficial to improving the classification accuracy of the target domain.
[0141] Since the accuracy is highest when the first four sensors are used, the classification method proposed in the present invention is used to classify the features of these four sensors, and the following is obtained: Figure 6The confusion matrix shown in Figure 1 shows the number of samples predicted correctly, while the value of the sub-diagonal element indicates the number of samples predicted incorrectly in each of the two categories. After calculation, the classification accuracy is 50 / 58=86.2%. The accuracy is 79.31% when all sensor data are used for classification.
[0142] It can be seen that the sensor drift correction method and system based on transfer learning provided by the present invention can effectively correct the drift of the sensor, and a higher classification accuracy can be obtained in the intelligent detection of lung cancer. In summary, the embodiment of the present invention provides a sensor drift correction method and system based on transfer learning, which first collects sensor response data of healthy individuals and lung cancer patients in two different periods, and uses the labeled early data as the source domain data set, and the unlabeled late data as the target domain data set, and then pre-processes the data to extract features to obtain the source domain data feature set and the target domain data feature set, and finally performs domain adaptation on the target domain data feature set based on transfer learning to obtain the drift-corrected target domain data feature set. The present invention performs drift correction by minimizing the distance between the marginal distribution and the conditional distribution and forcing the maximization of cross-domain category information, and pre-processes the original data set to extract a small number of representative features to highly characterize the original data, ensuring that the data can be effectively used by the machine learning algorithm. Experimental results show that the present invention can effectively correct the drift of the sensor and obtain a higher classification accuracy in the intelligent detection of lung cancer.
[0143] The above embodiments are preferred implementation modes of the present invention, but the implementation modes of the present invention are not limited to the above embodiments. Any other changes, modifications, substitutions, combinations, and simplifications that do not deviate from the spirit and principles of the present invention should be equivalent replacement methods and are included in the protection scope of the present invention.
Claims
1. A sensor drift correction method based on transfer learning, characterized in that: Includes steps: S1. Collect sensor response data of healthy individuals and lung cancer patients at two different periods, and use the labeled early data as the source domain dataset and the unlabeled later data as the target domain dataset; S2, extracting features from the source domain data set and the target domain data set using the same preprocessing process to obtain a source domain data feature set and a target domain data feature set; S3. Based on transfer learning, the source domain data feature set is used to perform domain adaptation on the target domain data feature set to obtain a drift-corrected target domain data feature set; The step S3 specifically comprises the following steps: S31, minimizing the joint distribution distance between the target domain data feature set and the source domain data feature set after projection mapping, maximizing the difference between different categories of the target domain data feature set and the source domain data feature set, and retaining category information for classification as a goal, obtaining a functional relationship for obtaining a transformation matrix P; S32, calculating known parameters in the functional relationship based on the target domain data feature set and the source domain data feature set; S33, based on the known parameters, solving the functional relationship to obtain an initial transformation matrix P0; S34, calculating a new target domain data feature set and a new source domain data feature set based on the initial transformation matrix P0; S35, training a classifier using the new source domain data feature set, and predicting the classifier using the new target domain data feature set to obtain a pseudo label of the new target domain data feature set; S36, updating the pseudo-label of the target domain data feature set, updating the known parameters related to the pseudo-label in the functional relationship, and returning to step S33; S37, repeat steps S33 to S36 until the number of iterations is reached, and output the current transformation matrix P t As the optimal transformation matrix P, output the current classifier f; S38. Based on the optimal transformation matrix P and the target domain data feature set, obtain the target domain data feature set after drift correction.
2. The sensor drift correction method based on transfer learning according to claim 1, characterized in that: In step S32, the functional relationship is: Wherein, Z is the total feature data set including the target domain data feature set and the source domain data feature set, W c is the maximum mean difference matrix of the conditional probability between the source domain feature dataset and the target domain feature dataset after domain adaptation, c=0 corresponds to the case when the label class is not distinguished, c=1,2,…,C represents the cth class label, C represents the label type, K represents the joint probability matrix between the source domain feature dataset and the target domain feature dataset after domain adaptation, φ is the Lagrange multiplier, α is the measurement parameter of the category information, and I is the unit matrix.
3. The sensor drift correction method based on transfer learning according to claim 2, characterized in that: The step S31 specifically includes the following steps: Calculate the source domain feature dataset D s and target domain feature dataset D t The marginal difference between m (D s ,D t )=Tr(P T ZWZ T P), W0 is D s With D t The maximum mean difference matrix between them, the superscript T indicates matrix transposition, and Tr() indicates matrix trace; Calculate the source domain feature dataset D s and target domain feature dataset D t The conditional distribution difference between W c D s With D t The maximum mean difference matrix of conditional probabilities between ; D m (D s ,D t ) and d c (D s ,D t ) add them together to get D s With D t The difference in the joint probability distribution between When c=0, the labels are not distinguished, and the difference between the overall sample means of the source domain and the target domain is calculated; Based on the Bayesian formula Expand and get d(D s ,D t )=M T +M D , M T is a matrix that measures the transferability of the same category across domains, M D =Tr(P T ZGar T P) is a matrix that measures the distinguishability between different categories in different domains; Minimizing the joint distribution distance between the target domain data feature set and the source domain data feature set after projection mapping, maximizing the difference between different categories of the target domain data feature set and the source domain data feature set, and retaining category information for classification as the goal of constructing an objective function; The objective function is solved to obtain the functional relationship.
4. The sensor drift correction method based on transfer learning according to claim 3 is characterized in that: The objective function is constructed as follows: T ZHZ T Under the condition of P = I, we can get The minimum transformation matrix P.
5. The sensor drift correction method based on transfer learning according to claim 4 is characterized in that: Solving the objective function comprises the steps of: Solving the objective function using the Lagrangian method to obtain a Lagrangian function; The Lagrangian function is differentiated with respect to the transformation matrix P to obtain the functional relationship.
6. The sensor drift correction method based on transfer learning according to any one of claims 1 to 5, characterized in that: In the step S1, the collected sensor response data includes 6 experimental stages P1-P6, which are respectively an air baseline collection stage, a helium baseline collection stage, a pre-concentration stage, a thermal desorption stage, a sampling stage and a cleaning stage. In the P1 stage, the filtered air enters the system at a higher flow rate; in the P2 stage, helium is used as a carrier gas and blown into the system at a high speed; in the P3 stage, the sample gas is blown into the adsorption tube at a high speed, and the gas outside the adsorption range of the adsorption tube responds; in the P4 stage, the gas adsorbed by the adsorption tube in the P3 stage is desorbed; in the P5 stage, helium is purged from the system at a low speed in the opposite direction, and the gas desorbed from the adsorption tube is blown out and sent into the gas chamber to react with the sensor. At this time, the gas that generates a response is the gas adsorbed by the adsorption tube in the P3 stage; and in the P6 stage, the entire gas path is cleaned.
7. The sensor drift correction method based on transfer learning according to claim 6, characterized in that: In step S2, the preprocessing process includes: Each response data of each sensor is filtered using an N-order mean filter; Extract the response data of each sensor at stages P1, P2, P3, and P5; The response data of the P1 stage is used as the baseline of the response data of the P3 stage, and the first-category features and the second-category features of the two stages are extracted; The response data of the P2 stage is used as the baseline of the response data of the P5 stage, and the first-category features and the second-category features of the two stages are extracted; Normalizing the first-class features and the second-class features of the P1 stage and the P3 stage to obtain the first-class normalized features of the response data of the sensor; The first and second characteristics of the P2 and P5 stages are normalized to obtain second normalized characteristics of the response data of the sensor.
8. The sensor drift correction method based on transfer learning according to claim 7, characterized in that: The process of filtering with an N-order mean filter is as follows: the filtered value of the j-th sensor at the i-th sampling point in the d-th sample is Equal to the response value of the jth sensor at the i-th sampling point in the d-th sample of the original data set The difference between the sum of the next (N-1) response values minus the maximum value of these N response values minus the minimum value of these N response values is divided by (N-2); The first type of feature for the P1 and P3 stages is: the mean value of the P3 stage minus the mean value of the P1 stage. The first type of feature for the P1 and P3 stages is: the median value of the response in the P3 stage minus the mean value in the P1 stage. The first type of feature in the P2 and P5 stages is: the average value of the P5 stage minus the average value of the P2 stage. The first type of feature in the P2 and P5 stages is: the second type of feature is: the median response of the P5 stage minus the average value of the P2 stage.
9. The sensor drift correction method based on transfer learning according to claim 8, characterized in that: The process of normalizing the first and second features of the P1 and P3 stages is formulated as follows: is the corresponding normalized feature representation, f d,j,1 ,f d,j,2 are the first and second features of the P1 and P3 phases of the j-th response data of the d-th sensor, respectively. β is the weight factor. and σ1,σ2 are f d,j,1 ,f d,j,2 The mean and standard deviation of The process of normalizing the first and second features of the P2 and P5 stages is formulated as follows: is the corresponding normalized feature representation, f d,j,3 ,f d,j,4 They are the first and second features of the P2 and P5 phases of the j-th response data of the d-th sensor, and σ3,σ4 are f d,j,3 ,f d,j,4 The mean and standard deviation of .
10. A sensor drift correction system based on transfer learning, characterized in that: It includes a breath detection system and a sensor drift correction module, wherein the breath detection system is used to execute steps S1 and S2 in the sensor drift correction method based on transfer learning according to any one of claims 1 to 9, and the sensor drift correction module is used to execute step S3. The sensor drift correction module is also used to use the classifier f and the optimal transformation matrix P to predict the input breath feature data of lung cancer patients, and output the pseudo-label corresponding to the breath feature data of lung cancer patients as the lung cancer detection result.
Citation Information
Patent Citations
Target domain migration extreme learning-based electronic nose heterogeneous data identification method
CN105913079A
Drift suppression method for electronic nose of domain self-adaptive extreme learning machine (ELM) based on domain correction
CN109669009A
Cross-domain migration electronic nose drift suppression method based on migration samples
CN111931815A
Gas sensor drift compensation method
CN113030197A
Gas sensor drift compensation method based on subspace learning and cross-domain adaptive extreme learning machine
CN114925762A
Cited By
Penthorum chinense pursh seed inspection data correction method based on transfer learning
CN121278494A