# Online Track Vertex Reconstruction Method Based on an Artificial Neural Network for MPGD
## 2 Materials and Methods
### ANN Reconstruction Algorithm
#### 2.4.1 Dimensionality Reduction  
The traditional method of data dimensionality reduction in machine learning is principal component analysis (PCA) [14], which uses linear transformation to expresses the data in a low-dimensional space. In 2006, [PERSON] proposed the use of autoencoder to achieve dimensionality reduction of high dimensional data [15]. He trained a neural network with the same output data as the input data, and the output of the hidden layer of the network enabled the dimensionality reduction of the original data. This method is more efficient and flexible than PCA in terms of dimensionality reduction. The sparse autoencoder adds a penalty factor to the autoencoder mean-variance loss function J(W,b), which suppresses a portion of the nodes in the hidden layer and makes the coding sparser, thus increasing the dimensionality reduction capability of the autoencoder.  
The sparse autoencoder is an unsupervised learning system, which is shown in Figure 5. Each neuron in the hidden layer has weight parameters for all neurons in the previous layer. The activation function is a sigmoid function with the following expression:  
\[\text{S(x)}=\frac{1}{1+e^{-x}} \tag{3}\]  
The loss function is:  
\[J_{sparse}(W,b)=J(W,b)+\sum_{j=1}^{s_{2}}KL(\rho\|\hat{\rho}_{j}) \tag{4}\]  
and  
layer to the \(i\)-th sample. J(W,b) is the loss function of the autoencoder, \(\hat{\rho}_{j}\) denotes the average activity of the hidden layer neurons, and \(\rho\) is the sparsity parameter. \(KL(\rho\big{\|}\hat{\rho}_{j})\) is the Kullback-Leibler (KL) divergence between a Bernoulli random variable with mean \(\rho\) and a Bernoulli random variable with mean \(\hat{\rho}_{j}\). KL-divergence is a standard function for measuring how different two distributions are. \(y_{j}\) denotes the true output value of the \(j\)-th sample. \(y^{\prime}_{j}\) denotes the output value of the \(j\)-th sample's network computations. Formulas (4)-(7) are explained in more detail in [16].  
We use 30,000 periods of data to train the sparse autoencoder. Before proceeding to train the sparse autoencoder, the network input dataset needs to be normalized to (0.1, 0.9). L-BLGS was used for training to optimize the loss function [17]. The learning rate of the training was 0.0001 and the maximum number of iterations was 1000. The structure of the network is 400-40-400 and it has a data compression ratio of 10:1. The parameters of the nodes were initialized randomly at the beginning of training. The value of the loss function was calculated at each iteration using all the data, changing the node parameters according to the optimization algorithm. After a number of iterations, the value of the loss function stops decreasing and converges, which indicates that the performance of our trained sparse autoencoder is excellent. After training, the output of the hidden layer is the dimensionality reduction data we obtained. The network was trained for 973 periods before stopping the iteration, and the value of the loss function changed during the training process as shown in Figure 6.  
The loss function was eventually reduced to near 0.699 and converges, which indicates that the network can achieve good dimensionality reduction. There is no zero suppression in our algorithm. Traditional zero suppression reduces the amount of data by subtracting readout poles with lower response, which can be seen as a dimensionality reduction tool. Our sparse autoencoder is a more powerful dimensionality reduction tool because it is able to take useful information directly from 400 dimensions of data to take the next step.  
Figure 5: Sparse autoencoder.