# Data Cleaning Model of Mine Wind Speed Sensor Based on LOF-GMM and SGAIN
## 2 LOF-GMM-SGAIN Model
### Anomaly Data Imputation  
SGAIN is an algorithm used for generative adversarial networks [23], with the main goal of improving the quality and training stability of the generative model. SGAIN trains using the input data itself, without requiring external label information. During the training process, the algorithm randomly sets part of the data as missing and attempts to predict these missing data values. The architecture of SGAIN primarily consists of two components: the generator and the discriminator. Its core idea is to introduce a self-generated inference process during training to enhance the adversarial relationship between the generator and the discriminator. Through adversarial learning, the generator and discriminator are continuously optimized, and the generated imputed values ultimately become highly similar to the real data. The overall framework of SGAIN is shown in Figure 1 (modified from [23]). Compared to the original GAIN algorithm, SGAIN does not include an auxiliary generator and therefore does not generate an auxiliary matrix. The architecture of SGAIN is even more streamlined, as both the generator and discriminator neural networks have only two layers, while in GAIN, each of them has three layers. Additionally, SGAIN uses the hyperbolic tangent activation function (tanh) in the output layers of both the generator and discriminator, which accelerates the convergence speed of the optimizer. The generator (G) takes \(Z\) and M as inputs and outputs \(\overline{X}\). \(Z\) is an n-dimensional variable, where each value in \(Z=(Z_{1},\cdot\cdot,Z_{\rm n})\) corresponds to a non-missing value in \(\{X_{\rm i}\}_{\rm n}^{\rm i=1}\), while the missing values in \(\{X_{\rm i}\}_{\rm n}^{\rm i=1}\) are replaced with random values. M is the mask vector. Let \(N=(N_{\rm I},\cdot\cdot,N_{\rm n})\) be the output of a function that draws random values from a continuous uniform distribution. The specific formula is as follows:  
\[Z=M\odot X\oplus(1\odot M)\odot N \tag{10}\]  
\[\overline{X}=G(Z,M) \tag{11}\]  
where \(\overline{X}\) represents the missing values generated by the generator. The discriminator (D) is another participant in the minimax game. In SGAIN, the discriminator receives either real data (\(X\)) or generated data (\(\overline{X}\)), with the generated data produced by the generator (G). The outputs of the discriminator (D) are used to calculate the loss for both the generator and the discriminator. SGAIN can be used to perform imputation on sample data. DAE (denoising autoencoder) is a self-supervised learning method particularly suitable for denoising and data recovery tasks [24]. The core idea is to add noise to the original data, and DAE overcomes this noise by performing encoding and decoding operations to reconstruct the original data, thus extracting more stable features. Its encoding and decoding formulas are as follows:  
\[Y=\sigma(W_{1}X+B_{1}) \tag{12}\]  
\[Z=\sigma(W_{2}Y+B_{2}) \tag{13}\]  
Figure 1: SGAIN overall frame structure diagram (Adapted from ref. [23]). In the equation: \(\sigma\) is the activation function, chosen as Sigmoid; \(W_{1}\) and \(W_{2}\) are the weight matrices; \(B_{1}\) and \(B_{2}\) are the bias vectors; \(X\) is the noisy input data; \(Y\) is the encoded data after DAE processing; and \(Z\) is the output layer data. The RF (random forest) algorithm is an ensemble learning method composed of multiple decision trees, widely used for classification, regression, and other tasks. The RF model combines the outputs of multiple decision trees to reduce the overfitting problem of individual decision trees, thereby improving the stability and accuracy of predictions [25]. When the RF (random forest) model is used for regression tasks, the generator randomly selects subsamples and features from the training dataset to construct multiple decision trees. Each decision tree is independently trained and generates a regression result. The final prediction is determined by averaging the prediction results from all the trees.