Real-Time Correction and Long-Term Drift Compensation in MOS Gas Sensor Arrays Using Iterative Random Forests and Incremental Domain-Adversarial Networks
Abstract
1. Introduction
2. Dataset
3. Real-Time Data Error Correction Method Based on Random Forest
3.1. Model Training and Validation
3.1.1. Polarity Correction
3.1.2. Model Training
3.1.3. Model Validation
3.2. Real-Time Error Correction
3.2.1. Data Preprocessing
3.2.2. Error Prediction
3.2.3. Correction Decision Rule
3.2.4. Iterative Correction
3.3. Effect of Error Correction
4. Incremental Domain-Adversarial Network
4.1. Network Architecture
- Feature Extractor . The feature extractor processes an input vector (to accommodate the sensor array) using a stack of convolutional and pooling layers, followed by a fully connected transformation to obtain a compact latent representation .
- Label Predictor . This branch, implemented as a fully connected layer, predicts the task class , supporting multi-class classification (, with in this experiment).
- Domain Classifier . Also a fully connected layer, the domain classifier aims to infer from which domain or batch () the feature embedding stems, promoting domain-invariant representation learning.
4.2. Domain-Adversarial Training
4.3. Incremental Adaptation Mechanism
- Initial Training. We train the network using labeled data from the first two sensor batches (domains). Each data sample is labeled as belonging to its batch for domain-discriminative learning. Let , denote these batches.
- Dynamic Domain Expansion. Upon the arrival of a new batch , IDAN extends its domain classifier to accommodate the new domain by expanding the output layer and copying previous weights. Given a previously trained model with domains, the domain classifier is extended to outputs; new weights for the additional domain are randomly initialized, while the existing ones are preserved to maintain prior knowledge. For a domain classifier with parameters , the extension is
- Online Fine-Tuning. For each incoming batch, data is first normalized using parameters fitted from the initial training batches to ensure consistent feature scaling. The new batch is incrementally introduced in small chunks (buffer size is 50 in this experiment), mixed with a reservoir of historical samples (i.e., pool). For each chunk, IDAN is fine-tuned using combined current and historic batches, adapting to the new domain while retaining knowledge of previous ones. The combined sample update for each mini-batch can be formalized as
5. Experimental Comparison and Analysis
5.1. Experimental Datasets and Environment
- Dataset1: Batch 1 is exclusively used as the training set, while batches k (where k = 2, 3, …, 10) are each used independently as the test set. This sequential evaluation is designed to assess the impact of temporal drift by examining the model’s predictive performance as the time gap between training and testing increases.
- Dataset2: Batches 1 and 2 are jointly used to form the training set, and evaluation is conducted separately on batches k (k = 3, 4, …, 10). This approach aims to determine whether the inclusion of more initial data can mitigate the adverse effects of temporal drift and improve generalization to later, temporally distant batches.
5.2. Experimental Results on Dataset1
5.3. Experimental Results on Dataset2
5.4. Experimental Results Analysis
6. Discussion
7. Conclusions
Author Contributions
Funding
Data Availability Statement
Acknowledgments
Conflicts of Interest
References
- Albert, K.J.; Lewis, N.S.; Schauer, C.L.; Sotzing, G.A.; Stitzel, S.E.; Vaid, T.P.; Walt, D.R. Cross-Reactive Chemical Sensor Arrays. Chem. Rev. 2000, 100, 2595–2626. [Google Scholar] [CrossRef]
- Askim, J.R.; Mahmoudi, M.; Suslick, K.S. Optical Sensor Arrays for Chemical Sensing: The Optoelectronic Nose. Chem. Soc. Rev. 2013, 42, 8649–8682. [Google Scholar] [CrossRef]
- Krantz-Rülcker, C.; Stenberg, M.; Winquist, F.; Lundström, I. Electronic Tongues for Environmental Monitoring Based on Sensor Arrays and Pattern Recognition: A Review. Anal. Chim. Acta 2001, 426, 217–226. [Google Scholar] [CrossRef]
- Leon-Medina, J.X.; Pineda-Muñoz, W.A.; Burgos, D.A.T. Joint Distribution Adaptation for Drift Correction in Electronic Nose Type Sensor Arrays. IEEE Access 2020, 8, 134413–134421. [Google Scholar] [CrossRef]
- Ziyatdinov, A.; Marco, S.; Chaudry, A.; Persaud, K.; Caminal, P.; Perera, A. Drift Compensation of Gas Sensor Array Data by Common Principal Component Analysis. Sens. Actuators B Chem. 2010, 146, 460–465. [Google Scholar] [CrossRef]
- Vergara, A.; Vembu, S.; Ayhan, T.; Ryan, M.A.; Homer, M.L.; Huerta, R. Chemical Gas Sensor Drift Compensation Using Classifier Ensembles. Sens. Actuators B Chem. 2012, 166–167, 320–329. [Google Scholar] [CrossRef]
- Dong, X.; Han, S.; Wang, A.; Shang, K. Online Inertial Machine Learning for Sensor Array Long-Term Drift Compensation. Chemosensors 2021, 9, 353. [Google Scholar] [CrossRef]
- Pereira, M.; Glisic, B. Detection and Quantification of Temperature Sensor Drift Using Probabilistic Neural Networks. Expert Syst. Appl. 2023, 213, 118884. [Google Scholar] [CrossRef]
- Grover, A.; Lall, B. A Novel Method for Removing Baseline Drifts in Multivariate Chemical Sensor. IEEE Trans. Instrum. Meas. 2020, 69, 7306–7316. [Google Scholar] [CrossRef]
- Ahmad, R. Enhanced Drift Self-Calibration of Low-Cost Sensor Networks Based on Cluster and Advanced Statistical Tools. Measurement 2024, 236, 115158. [Google Scholar] [CrossRef]
- Rudnitskaya, A. Calibration Update and Drift Correction for Electronic Noses and Tongues. Front. Chem. 2018, 6, 433. [Google Scholar] [CrossRef]
- Wang, S.; Wu, Z.; Lim, A. Denoising, Outlier/Dropout Correction, and Sensor Selection in Range-Based Positioning. IEEE Trans. Instrum. Meas. 2021, 70, 1007613. [Google Scholar] [CrossRef]
- Paul, S.; Sharma, R.; Tathireddy, P.; Gutierrez-Osuna, R. On-Line Drift Compensation for Continuous Monitoring with Arrays of Cross-Sensitive Chemical Sensors. Sens. Actuators B Chem. 2022, 368, 132080. [Google Scholar] [CrossRef]
- Padilla, M.; Perera, A.; Montoliu, I.; Chaudry, A.; Persaud, K.; Marco, S. Drift Compensation of Gas Sensor Array Data by Orthogonal Signal Correction. Chemom. Intell. Lab. Syst. 2010, 100, 28–35. [Google Scholar] [CrossRef]
- Peng, Y.; Yang, X.; Li, D.; Ma, Z.; Liu, Z.; Bai, X.; Mao, Z. Predicting Flow Status of a Flexible Rectifier Using Cognitive Computing. Expert Syst. Appl. 2025, 264, 125878. [Google Scholar] [CrossRef]
- Mao, Z.; Suzuki, S.; Wiranata, A.; Zheng, Y.; Miyagawa, S. Bio-Inspired Circular Soft Actuators for Simulating Defecation Process of Human Rectum. J. Artif. Organs 2025, 28, 252–261. [Google Scholar] [CrossRef] [PubMed]
- Liu, Q.; Dai, Y.; Li, M.; Yao, B.; Xin, Y.; Zhang, J. Real-Time Processing of Force Sensor Signals Based on LSTM-RNN. In Proceedings of the 2022 IEEE International Conference on Robotics and Biomimetics (ROBIO), Jinghong, China, 5–9 December 2022; pp. 167–171. [Google Scholar]
- Liang, Z.; Chen, D.; Yang, L.; Chen, Y. A Multibranch LSTM-Attention Ensemble Classification Network for Sensor Drift Compensation. IEEE Sens. J. 2024, 24, 25830–25841. [Google Scholar] [CrossRef]
- Bhadola, P.; Khosla, A. Multiplex Network-Based Approach to Gas Sensing. IEEE Access 2025, 13, 67588–67598. [Google Scholar] [CrossRef]
- Gao, L.; Tian, Y.; Hussain, A.; Guan, Y.; Xu, G. Recent Developments and Challenges in Resistance-Based Hydrogen Gas Sensors Based on Metal Oxide Semiconductors. Anal. Bioanal. Chem. 2024, 416, 3697–3715. [Google Scholar] [CrossRef]
- Dennler, N.; Rastogi, S.; Fonollosa, J.; van Schaik, A.; Schmuker, M. Drift in a Popular Metal Oxide Sensor Dataset Reveals Limitations for Gas Classification Benchmarks. Sens. Actuators B Chem. 2022, 361, 131668. [Google Scholar] [CrossRef]
- Salman, H.A.; Kalakech, A.; Steiti, A. Random Forest Algorithm Overview. Babylon. J. Mach. Learn. 2024, 2024, 69–79. [Google Scholar] [CrossRef]
- Mayer, M.J.; Yang, D. Potential Root Mean Square Error Skill Score. J. Renew. Sustain. Energy 2024, 16, 016501. [Google Scholar] [CrossRef]
- Roustaei, N. Application and Interpretation of Linear-Regression Analysis. Med. Hypothesis Discov. Innov. Ophthalmol. 2024, 13, 151–159. [Google Scholar] [CrossRef]
- Shantal, M.; Othman, Z.; Abu Bakar, A. Missing Data Imputation Using Correlation Coefficient and Min-Max Normalization Weighting. Intell. Data Anal. 2025, 29, 372–384. [Google Scholar] [CrossRef]
- Zhang, Z.; Wang, Y.; Ruan, X.; Zhang, X. Lithium-Ion Batteries Lifetime Early Prediction Using Domain Adversarial Learning. Renew. Sustain. Energy Rev. 2025, 208, 115035. [Google Scholar] [CrossRef]
- Lee, D.; Yoo, M.; Kim, W.K.; Choi, W.; Woo, H. Incremental Learning of Retrievable Skills For Efficient Continual Task Adaptation. Adv. Neural Inf. Process. Syst. 2024, 37, 17286–17312. [Google Scholar]
- Zhao, X.; Wang, L.; Zhang, Y.; Han, X.; Deveci, M.; Parmar, M. A Review of Convolutional Neural Networks in Computer Vision. Artif. Intell. Rev. 2024, 57, 99. [Google Scholar] [CrossRef]
- Ige, A.O.; Sibiya, M. State-of-the-Art in 1D Convolutional Neural Networks: A Survey. IEEE Access 2024, 12, 144082–144105. [Google Scholar] [CrossRef]
- Nagahama, H.; Yoshioka, M.; Inoue, K.; Todorokihara, M.; Omori, K. Improvement of Anomaly Detection Through Enhanced Feature Extraction in TimesNet. In Distributed Computing and Artificial Intelligence, 21st International Conference; Chinthaginjala, R., Sitek, P., Min-Allah, N., Matsui, K., Ossowski, S., Rodríguez, S., Eds.; Springer Nature: Cham, Switzerland, 2025; pp. 11–20. [Google Scholar]
- Al-Selwi, S.M.; Hassan, M.F.; Abdulkadir, S.J.; Muneer, A.; Sumiea, E.H.; Alqushaibi, A.; Ragab, M.G. RNN-LSTM: From Applications to Modeling Techniques and beyond—Systematic Review. J. King Saud Univ. Comput. Inf. Sci. 2024, 36, 102068. [Google Scholar] [CrossRef]
Feature Type Abbr. | Features (S1) | Features (S2) | Features (S3) | … | Features (S16) |
---|---|---|---|---|---|
F1 | 1. | 9. | 17. | … | 121. |
F2 | 2. | 10. | 18. | … | 122. |
F3 | 3. | 11. | 19. | … | 123. |
F4 | 4. | 12. | 20. | … | 124. |
F5 | 5. | 13. | 21. | … | 125. |
F6 | 6. | 14. | 22. | … | 126. |
F7 | 7. | 15. | 23. | … | 127. |
F8 | 8. | 16. | 24. | … | 128. |
Batch Id | Month Ids | Total Number | The Number of Records for Each Gas in Each Batch | |||||
---|---|---|---|---|---|---|---|---|
Ethanol | Ethylene | Ammonia | Acetaldehyde | Acetone | Toluene | |||
1 | 1, 2 | 445 | 90 | 98 | 83 | 30 | 70 | 74 |
2 | 3, 4, 8, 9, 10 | 1244 | 164 | 334 | 100 | 109 | 532 | 5 |
3 | 11, 12, 13 | 1586 | 365 | 490 | 216 | 240 | 275 | 0 |
4 | 14, 15 | 161 | 64 | 43 | 12 | 30 | 12 | 0 |
5 | 16 | 197 | 28 | 40 | 20 | 46 | 63 | 0 |
6 | 17, 18, 19, 20 | 2300 | 514 | 574 | 110 | 29 | 606 | 467 |
7 | 21 | 3613 | 649 | 662 | 360 | 744 | 630 | 568 |
8 | 22, 23 | 294 | 30 | 30 | 40 | 33 | 143 | 18 |
9 | 24, 30 | 470 | 61 | 55 | 100 | 75 | 78 | 101 |
10 | 36 | 3600 | 600 | 600 | 600 | 600 | 600 | 600 |
Total Number | 13,910 | 2565 | 2926 | 1641 | 1936 | 3009 | 1833 |
Train Set | Dimension | Min_MSE | Max_MSE | MSE | R2 |
---|---|---|---|---|---|
batch 1 | F1 | 3,863,654 | 1824 | 685,523 | 0.9995 |
F2 | 0.0728 | 0.0026 | 0.0151 | 0.9990 | |
F3 | 0.5913 | 0.0004 | 0.0904 | 0.9990 | |
F4 | 0.7696 | 0.0039 | 0.1738 | 0.9984 | |
F5 | 22.6928 | 0.0400 | 3.8387 | 0.9863 | |
F6 | 0.2083 | 0.0003 | 0.0354 | 0.9994 | |
F7 | 2.6754 | 0.0012 | 0.3308 | 0.9989 | |
F8 | 48.4364 | 0.0656 | 7.6114 | 0.9816 | |
batch 1–2 | F1 | 1,652,796 | 1580 | 324,721 | 0.9995 |
F2 | 117,057 | 0.0007 | 9881 | 0.9278 | |
F3 | 0.9593 | 0.0004 | 0.1241 | 0.9926 | |
F4 | 20.6208 | 0.0346 | 3.6756 | 0.9787 | |
F5 | 4970.1092 | 1.4989 | 417.5656 | 0.9532 | |
F6 | 0.1426 | 0.0001 | 0.0337 | 0.9969 | |
F7 | 7.4404 | 0.0240 | 1.2041 | 0.9736 | |
F8 | 403.4141 | 7.4268 | 45.2815 | 0.9253 | |
batch 1–3 | F1 | 804,049 | 1257 | 174,602 | 0.9997 |
F2 | 56,162 | 0.0006 | 4700.3703 | 0.9383 | |
F3 | 0.6775 | 0.0002 | 0.0799 | 0.9945 | |
F4 | 11.4853 | 0.0212 | 2.0481 | 0.9865 | |
F5 | 3608.4700 | 0.7870 | 297.3978 | 0.9580 | |
F6 | 0.0931 | 0.0001 | 0.0210 | 0.9985 | |
F7 | 2.7795 | 0.0113 | 0.4674 | 0.9801 | |
F8 | 142.3704 | 2.4981 | 19.1085 | 0.9470 |
Models | Overall ACC(%) | ACC (%) of Test Set Batch | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | ||
SVM | 41.13 | 76.21 | 49.43 | 33.54 | 23.85 | 33.73 | 33.29 | 25.51 | 34.25 | 41.41 |
ISVM | 52.07 | 87.94 | 83.35 | 80.75 | 73.10 | 70.83 | 56.88 | 43.20 | 45.11 | 8.31 |
CNN | 37.46 | 67.28 | 60.28 | 32.30 | 22.34 | 24.13 | 21.26 | 22.11 | 45.11 | 43.19 |
1DCNN | 42.72 | 48.47 | 61.73 | 54.04 | 42.64 | 32.35 | 39.03 | 23.47 | 43.40 | 43.67 |
TimesNet | 25.02 | 47.03 | 37.33 | 24.22 | 10.15 | 9.26 | 20.51 | 19.39 | 34.26 | 26.69 |
LSTM | 25.05 | 50.08 | 29.57 | 32.30 | 5.08 | 10.74 | 18.74 | 4.08 | 2.98 | 35.25 |
IDAN | 71.34 | 82.72 | 80.64 | 61.49 | 69.04 | 70.83 | 70.33 | 81.63 | 63.40 | 65.42 |
Models | Overall ACC(%) | ACC (%) of Test Set Batch | |||||||
---|---|---|---|---|---|---|---|---|---|
3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | ||
SVM | 47.28 | 88.27 | 86.95 | 87.3 | 32.52 | 43.75 | 29.25 | 53.4 | 38.91 |
ISVM | 61.22 | 98.8 | 90.68 | 95.43 | 72.22 | 67.37 | 47.96 | 51.28 | 30.67 |
CNN | 57.58 | 97.48 | 90.06 | 71.57 | 60.0 | 59.76 | 57.82 | 72.13 | 32.14 |
1DCNN | 56.17 | 93.13 | 90.06 | 78.17 | 62.61 | 56.85 | 50.68 | 66.38 | 31.50 |
TimesNet | 43.90 | 70.18 | 47.20 | 77.66 | 34.22 | 45.78 | 40.82 | 58.94 | 32.92 |
LSTM | 32.68 | 69.23 | 40.99 | 49.75 | 30.04 | 35.82 | 15.99 | 37.02 | 14.61 |
IDAN | 76.29 | 92.50 | 93.79 | 91.37 | 83.30 | 75.37 | 69.73 | 76.60 | 64.47 |
Test Set Batch | ACC (%) | PR (%) | RC (%) | F1 (%) |
---|---|---|---|---|
2 | 82.72 | 84.95 | 82.72 | 81.97 |
3 | 80.64 | 84.55 | 80.64 | 80.27 |
4 | 61.49 | 70.03 | 61.49 | 58.62 |
5 | 69.04 | 61.99 | 69.04 | 62.56 |
6 | 70.83 | 94.79 | 70.83 | 73.11 |
7 | 70.33 | 81.04 | 70.33 | 66.07 |
8 | 81.63 | 83.98 | 81.63 | 81.00 |
9 | 63.40 | 54.48 | 63.40 | 56.24 |
10 | 65.42 | 75.54 | 65.42 | 65.91 |
Test Set Batch | ACC (%) | PR (%) | RC (%) | F1 (%) |
---|---|---|---|---|
3 | 92.50 | 93.95 | 92.50 | 92.50 |
4 | 93.79 | 93.87 | 93.79 | 93.73 |
5 | 91.37 | 92.57 | 91.37 | 91.28 |
6 | 83.3 | 97.41 | 83.30 | 87.40 |
7 | 75.37 | 86.27 | 75.37 | 71.63 |
8 | 69.39 | 80.67 | 69.39 | 71.39 |
9 | 76.60 | 68.84 | 76.60 | 70.70 |
10 | 64.47 | 67.77 | 64.47 | 64.88 |
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content. |
© 2025 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https://creativecommons.org/licenses/by/4.0/).
Share and Cite
Dong, X.; Han, S. Real-Time Correction and Long-Term Drift Compensation in MOS Gas Sensor Arrays Using Iterative Random Forests and Incremental Domain-Adversarial Networks. Micromachines 2025, 16, 991. https://doi.org/10.3390/mi16090991
Dong X, Han S. Real-Time Correction and Long-Term Drift Compensation in MOS Gas Sensor Arrays Using Iterative Random Forests and Incremental Domain-Adversarial Networks. Micromachines. 2025; 16(9):991. https://doi.org/10.3390/mi16090991
Chicago/Turabian StyleDong, Xiaorui, and Shijing Han. 2025. "Real-Time Correction and Long-Term Drift Compensation in MOS Gas Sensor Arrays Using Iterative Random Forests and Incremental Domain-Adversarial Networks" Micromachines 16, no. 9: 991. https://doi.org/10.3390/mi16090991
APA StyleDong, X., & Han, S. (2025). Real-Time Correction and Long-Term Drift Compensation in MOS Gas Sensor Arrays Using Iterative Random Forests and Incremental Domain-Adversarial Networks. Micromachines, 16(9), 991. https://doi.org/10.3390/mi16090991