# Methane Gas Density Monitoring and Predicting Based on RFID Sensor Tag and CNN Algorithm
## 3 Proposed Algorithm
### Least Squares Support Vector Regression  
For a training dataset \(\{(x_{i},y_{i})\mid i=1,2,\ldots,n\}\), \(x_{i}\in R^{N}\), \(y_{i}\in R\), (\(n\) is the elements number in the data set and \(N\) is the dimension of \(x\)), the LS-SVR model is defined as [39]:  
\[f(x)=w^{T}\cdot\varphi(x)+b \tag{5}\]  
where \(w\) is the coefficient matrix, \(b\) is the bias term, and \(\varphi(x)\) is employed to project the data \(x\) into a higher dimensional space. The LS-SVR is determined by \(w\) and \(b\), so the target is to search for the parameters which can acquire a satisfactory generalization performance. This target can be achieved by minimizing:  
\[ \begin{array}{c}\frac{1}{2}\|w\|^{2}+\frac{C}{2}\sum\limits_{i=1}^{n}e_{i}^{ 2}\\ s.t.\;\;y_{i}=w^{T}x+b+e_{i},\;\;\;\;i=1,2,\cdots,n\end{array}  \tag{6}\]  
where \(e_{i}\) is used to minimize the deviations of the regression function, and \(C\) is used to control the compromise between the complexity and the fitness to the data. The Lagrange multiplier approach is employed to solve the optimization problem:  
\[\left[ \begin{array}{c}b\\ \mathbf{\alpha}\end{array} \right]=\left[ \begin{array}{cc}0&\mathbf{1}^{T}\\ \mathbf{1}&K+I/c\end{array} \right]^{-1}\left[ \begin{array}{c}0\\ \mathbf{y}\end{array} \right] \tag{7}\]  
where \(\mathbf{1}=[1,1,\ldots,1]\), \(\mathbf{\alpha}=[\alpha_{1},\,\alpha_{2},\ldots,\,\alpha_{n}]^{T}\), \(\mathbf{y}=[y_{1},y_{2},\ldots,y_{n}]^{T}\), and \(K=k(x_{i},x_{j})\) is the kernel function. It can be obtained by the kernel trick: \(k(x_{i},x_{j})=\varphi(x_{i})\times(x_{j})\). Finally, the LS-SVR model is equivalent to [36]:  
\[f(x)=\sum\limits_{i=1}^{n}\alpha_{i}k(x_{i},x)+b \tag{8}\]  
The kernel function significantly influences the performance of the LS-SVR model. Since the raw signal is characterized as non-linear and non-stationary, the radial basis function (RBF) is used as the kernel function [40]:  
\[K(x_{i},x)=\exp\Bigl{\{}-\|x-x_{i}\|^{2}/\sigma^{2}\Bigr{\}} \tag{9}\]  
where \(\sigma\) is the bandwidth of the kernel. For a series of observations \(X_{t}=[x_{t-(n-1)s},\,x_{t-(n-2)s},\,\ldots,\,x_{t}]\), \(s\) is the interval of measurement and \(n\) is the series length. The goal of prediction is to estimate \(x_{t+r}\) based on \(X_{t}\). The estimated value can be calculated by:  
\[x_{t+r}^{\wedge}=f(x_{t},xSince the supply voltage to the sensor tag is fixed at 1.8 V, the whole power consumption of the RFID sensor tag is determined by the consumed current. The proposed sensor is powered by a DC power supply PMX-35A (Kikusui, Yokohama, Japan), and the consumed current is measured by a digital multimeter Keithley 2010 (Tektronix, Shanghai, China). The developed sensor tag is activated every 30 ms by an RFID reader. Figure 8 illustrates the current waves of the RFID sensor, employing these two different sensor data storage methods. The measured currents of the proposed method and the traditional method are 207 uA and 478 uA, respectively. The proposed sensor tag still has a current consumption of 4.2 uA in sleep mode.  
The intensity of the received signal strength indication (RSSI) is one aspect with which to evaluate the performance of the proposed wireless sensor. The RSSI can be calculated by:  
\[Y_{R}=10\log X \tag{11}\]  
where \(Y_{R}\) is the RSSI (dBm) and \(X\) is the received signal power (mW). As shown in Figure 9a, the RSSI performance of the proposed wireless sensor was performed in the underground mine. The experiment results are illustrated in Figure 9b. It can be seen that within the distance of 10.3 m, the RSSI is higher than \(-\)60 dBm. We know from Reference [41] that this result is acceptable. The proposed RFID communication protocol requires a bit error rate (BER) less than 0.001 and signal to noise ratio (SNR) higher than 25 dB [36]. The BER performance is determined by the communication environment and SNR, therefore the SNR over distance and the BER under different SNRs should be measured.