# Seismic Reflection Analysis of AETA Electromagnetic Signals
## 3 Algorithm and Sample Extraction
### LAE and IQR Method  
The autoencoder (AE) is an unsupervised neural network that aims to learn the reconstruction close to its original input. In general, it consists of two parts, an encoder network and a decoder network. The encoder reduces the dimension of the input vector \(x\in\mathbb{R}^{m}\) and compresses it to the hidden vector \(h\in\mathbb{R}^{n}(n<m)\), and then the decoder raises the dimension of the obtained hidden vector \(h\) and maps it back to the original input space to obtain the reconstructed vector \(\hat{x}\in\mathbb{R}^{m}\). The difference between the original input vector \(x\) and the reconstructed vector \(\hat{x}\) is called the reconstruction error \(L(x,\hat{x})\)[16]. The autoencoder updates the weight of the network by minimizing the reconstruction error \(L\):  
\[L=\frac{1}{2}\sum_{x}\parallel x-\hat{x}\parallel^{2} \tag{1}\]  
The role of the autoencoder is not just to simply copy the input to the output. By constraining the latent space to have a smaller dimension than the input, i.e., \(n<m\), the autoencoder is forced to learn the most salient features of the training data [17]. In other words, the autoencoder has a significant function in that it can find the regular or general pattern of the input data by reconstructing it. Common autoencoders include the vanilla autoencoder [18], the convolutional autoencoder [19], the regularized autoencoder [20], and the LSTM autoencoder (LAE). As a form of sensor monitoring data, the AETA electromagnetic signal is a typical time series. The ability of LSTM to learn the patterns of long data makes it suitable for time series prediction or anomaly detection, and it is often used to capture the time dependence in multivariate data and determine whether data are out of distribution in a long time series. [21] In an LAE, both the encoder and decoder are LSTM networks. On the one hand, the fixed number of hidden units limit the model to learning the trivial mapping of the input; on the other hand, the same LSTM operation is performed recursively on the learned representation at any stage of decoding, which further hinders the model from learning the original mapping. This also explains why the LAE algorithm can achieve a reconstructed signal that presents almost all the input information but with a representation no better than the input [22]. The structure of the AE and LAE is shown as Figure 5.  
The LAE created for AETA electromagnetic anomaly monitoring had two units corresponding to the encoding and decoding parts. The encoder consists of an LSTM layer with a size of 100 and a repeating module that is used to increase the dimension of the vector output by the former. There is also an LSTM layer and a flatten layer, which are used to transform the hidden layer vector from the encoder into reconstruction sequences with the same dimension as the input. The activation function applied for the LAE model was ReLU, which is based on a trial and error validation. We chose the Adam optimization as the optimizer and the mean square error (MSE) shown in Formula (1) as the loss function. The training data were shuffled for every epoch, and each station was trained for a sufficient number of epochs, about 200. The learning rate was initialized to 0.001. The weight decay was set to 0.005 and the dropout at 0.5, for all layers. The model stopped training data when the loss of validation set did not decrease for 50 consecutive generations. Quartiles were always used to draw box plots in statistics; that is, all values were arranged from small to large and divided into four equal parts. The value at the position of the three division points is the quartile. Interquartile range (IQR) is a method in descriptive statistics that represents a set of data arranged in order, as well as the difference between the upper quartile Q\({}_{3}\) and the lower quartile Q\({}_{1}\)[23].