# A Sensor Drift Compensation Method with a Masked Autoencoder Module
## 2 Materials and Methods
### Overall Concept  
In this section, we discuss the fundamental principles of the CFE and how it can be implemented. The steady-state response of gas sensors can be written in an abstract form as follows [31]:  
\[R=f(R_{0},K,T,C),\]  
where \(R\in\mathbb{R}^{n_{s}}\) is the resistance of the sensor chemicals in response to the gas mixture, \(n_{s}\) is the number of gas sensors, \(f\) is a function derived from chemistry, \(R_{0}\in\mathbb{R}^{n_{s}}\) is the base  
\begin{table}
\begin{tabular}{l c c c c c c} \hline \hline \multirow{2}{*}{**Batch ID** (**Months ID**)} & \multicolumn{3}{c}{**Number of Samples**} & & & \\ \cline{2-7}  & **Ethanol** & **Ethylene** & **Ammonia** & **Acetaldehyde** & **Acetone** & **Toluene** \\ \hline Batch 1 & 90 & 98 & 83 & 30 & 70 & 74 \\ (Months 1–2) & 164 & 334 & 100 & 109 & 532 & 5 \\ Batch 3 & 365 & 490 & 216 & 240 & 275 & 0 \\ (Months 14–15) & 64 & 43 & 12 & 30 & 12 & 0 \\ Batch 5 & 28 & 40 & 20 & 46 & 63 & 0 \\ (Months 16) & 514 & 574 & 110 & 29 & 606 & 467 \\ (Months 17–20) & 649 & 662 & 360 & 744 & 630 & 568 \\ (Months 21) & 30 & 30 & 40 & 33 & 143 & 18 \\ Batch 9 & 61 & 55 & 100 & 75 & 78 & 101 \\ (Months 24–30) & 600 & 600 & 600 & 600 & 600 & 600 \\ \hline \hline \end{tabular}
\end{table}
Table 1: Details about the dataset by [PERSON] et al. [27].  
resistance of the sensor chemicals, \(K\in\mathbb{R}^{n_{k}}\) is the sensitivity coefficient, \(n_{k}\) is the number of coefficients, \(T\in\mathbb{R}\) is the temperature, \(C\in\mathbb{R}^{n_{c}}\) is the concentration of gases in the mixture, and \(n_{c}\) is the number of gases. Since the form of the function \(f\) is complex and \(K\) is unknown, we use pattern recognition algorithms to estimate the gas concentration \(C\) given measured values of \(R\), \(R_{0}\), and \(T\). Even if we train a pattern recognition algorithm with samples, the values of \(R_{0}\) and \(K\) change after a long time due to sensor drift, which is the rationale behind drift compensation methods.  
Transfer samples are pairs of a measured sensor signal and a concentration which are taken some time after the first training of the E-nose's pattern recognition algorithm [12]. These samples are collected using the same E-nose over a small time interval in which the drift of the E-nose is negligible. The concept behind the CFE is based on the fact that transfer samples carry information on \(f\), \(R_{0}\), and \(K\). For instance, assuming that we know the form of \(f\) and the temperature \(T\), we can obtain the values of \(R_{0}\) and \(K\) from the transfer samples using optimization or equation-solving techniques, even in the presence of sensor drift. By utilizing transfer samples to train the CFE, sensor drift features are extracted and a calibration feature vector is generated that contains sensor drift information. In normal neural networks for concentration estimation [8; 32], the sensor signal values are input and the corresponding concentration is predicted, as shown in Figure 1a. To address sensor drift, network fine-tuning is performed by using new transfer samples to adapt to the drifted \(R_{0}\) and \(K\) values. In our proposed method, rather than tuning the parameters with new transfer samples, we train the neural network with sensor data concatenated with a calibration feature vector produced from the CFE, which makes the network robust to sensor drift without fine-tuning.