# An Improved Dictionary-Based Method for Gas Identification with Electronic Nose
## 2 Materials and Methods
### A Proposed Classification Model  
In this section, aiming at the problem that the K-SVD dictionary learning algorithm is not discriminative, a new classification algorithm was proposed. Figure 6 shows the basic principle of the new model. During the process of updating the dictionary, all of the training samples are split into \(i\) pieces by a simple linear projection. To make the dictionary disclose that the training samples of the \(i^{th}\) category differed from other categories, an assumption was made that the coefficients acquired by projection were concentrated in the sparse matrix of the same categories, and the internal distance of the coefficients was small. The value of coefficients belonging to the training samples of the other categories was extremely low. As a result, the new model may be represented as follows:  
\[\left\{ \begin{aligned} & W_{i}=G_{i}X_{i}\\ & G_{i}\overline{X}_{i}\approx 0\\ &\sum\limits_{j=1}^{n}\left\|G_{i}X_{ij}\right\|_{F}^{2}-\sum \limits_{j=1}^{n}\left\|G_{i}m_{i}\right\|_{F}^{2}\approx 0\\ & G_{i}=\underset{G_{i}}{\text{argmin}}\|W_{i}-G_{i}X_{i}\|_{F}^{2 }+\gamma\left\|G_{i}\overline{X}_{i}\right\|_{F}^{2}+\beta\left(\sum\limits_{ j=1}^{n}\left\|G_{i}X_{ij}\right\|_{F}^{2}-\sum\limits_{j=1}^{n}\left\|G_{i}m_{i} \right\|_{F}^{2}\right)\end{aligned} \right. \tag{11}\]  
where \(G_{i}\in R^{m\times m}\) is a full-rank matrix; \(G_{i}\) and \(S_{i}\) are incoherent; \(\overline{X}_{i}^{T}\) is the transpose of \(\overline{X}_{i}\); \(\overline{X}_{i}\) is the complementary data matrix of \(\mathbf{X}_{i}\) in the whole training sample; \(\gamma\) and \(\beta\) are regularization parameters in order to avoid a high risk of overfitting to training samples; \(m_{i}\) is the mean of the \(X_{i}\); \(X_{ij}\) is the \(j^{th}\) vector of \(X_{i}\); \(n\) is the number of \(X_{i}\). The formula \(W_{i}=G_{i}X_{i}\) denotes that the feature of a matrix may be disclosed by a simple linear projection. The formula \(G_{i}\overline{X}_{i}\)\(\approx\)\(0\) expresses that the coefficients belonging to the training samples of the other categories are extremely few. The formula \(\sum_{i=1}^{n}\left\|G_{i}X_{ij}\right\|_{F}^{2}-\sum_{j=1}^{n}\left\|G_{i}m_{ i}\right\|_{F}^{2}\approx 0\) expresses that the distance of the coefficients belonging to the same categories' training samples is small. This concept may be employed to increase the algorithm's overall discriminative capacity. By taking the partial derivative to Equation (11) and it can be expressed as:  
\[ \begin{array}{rl}0&=\frac{\partial}{\partial G_{i}}\Bigg{(}\|W_{i}-G_{i}X_{ i}\|_{F}^{2}+\gamma\|G_{i}\overline{X}_{i}\|_{F}^{2}+\beta\left(\sum\limits_{ j=1}^{n}\left\|G_{i}X_{ij}\right\|_{F}^{2}-\sum\limits_{j=1}^{n}\left\|G_{i}m_{i} \right\|_{F}^{2}\right)\Bigg{)}\\ &=2(G_{i}X_{i}-W_{i})X_{i}^{T}+2\gamma G_{i}\overline{X}_{i}\overline{X}_{i}^ {T}+\sum\limits_{j=1}^{n}\left(2\beta G_{i}X_{ij}X_{ij}^{T}-2\beta G_{i}m_{i} m_{i}{}^{T}\right)\\ &=2G_{i}\Bigg{(}X_{i}X_{i}^{T}+\gamma\overline{X}_{i}\overline{X}_{i}^{T}+ \sum\limits_{j=1}^{n}\left(\beta X_{ij}X_{ij}^{T}-\beta m_{i}m_{i}^{T}\right) \Bigg{)}-2W_{i}X_{i}^{T}\end{array}  \tag{12}\]  
Figure 6: A schematic diagram of the new model. As a result, the following formula can be obtained:  
\[G_{i}=\left(W_{i}X_{i}^{T}\right)\left(X_{i}X_{i}^{T}+\gamma\overline{X}_{i} \overline{X}_{i}^{T}+\sum_{j=1}^{n}\left(\beta X_{ij}X_{ij}^{T}-\beta m_{i}m_{i }^{T}\right)\right)^{-1} \tag{13}\]  
In this paper, the orthogonal matching pursuit (OMP) was adopted to calculate the sparse coefficients \(W_{i}\)[44].