# Online Track Vertex Reconstruction Method Based on an Artificial Neural Network for MPGD
## 2 Materials and Methods
### ANN Reconstruction Algorithm
#### 2.4.2 Feedforward Neural Network (FNN)  
Universal approximation theorem shows that feedforward neural networks (FNN) can fit functions of arbitrary complexity with arbitrary accuracy by having only a single hidden layer and a certain number of neurons [18]. Since there is a non-linear functional relationship between the signal generated by an incident particle on the readout plate and its incident position under a particular operating condition, we can use FNN to complete the reconstruction of the incident position. A multi-hidden layer deep neural network has higher training efficiency, better fitting effect, and stronger generalization ability compared to a single hidden layer network while consuming the same network nodes. We used data from 27,000 events to train the network. The sample set was divided into training, validation, and test sets, with a sample size of 18,900 for the training set and a sample size of 4050 for the validation set and test set and the data used lasts 10-20 periods. Instead of using the raw data directly during training, the raw data is passed through the sparse autoencoder shown above and then the output of the hidden layer of the sparse autoencoder is used as input to the FNN. When an event lasts for less than 20 periods, 0 is used instead of the result of the empty period dimensionality reduction. The output of the FNN is the incident position of the particle in the simulation and the loss function is the mean squared function. Bayesian regularization is used as a training algorithm to improve the speed and precision of the training [19]. The structure of the FNN is 800-30-20-3-1, and the number of layers and nodes of the hidden layer is constantly adjusted according to the training results. The activation functions used by FNN are tanh, tanh, and purlin, and its structure is shown in Figure 7.  
The expression for the activation function is as follows:  
\[\tan\mathrm{h(x)}=\frac{2}{1+e^{-2x}}-1 \tag{8}\]  
\[\mathrm{purlin(x)}=\mathrm{x} \tag{9}\]  
The network stops iterating after 869 iterations, which is a special case. The total number of iterations varies depending on the value of the initial parameter. The loss function converges. The convergence criterion is used for the loss function (as shown in Figure 8). The change in the mean squared error of the training set, validation set, and test set during the training process is shown in Figure 8. The mean squared error of the test set ensured that the training did not fall into overfitting. The training results of the network in the training, validation and test sets are shown in Table 1.  
Figure 6: Changes in the loss function.  
Figure 8: The process of training.  
\begin{table}
\begin{tabular}{c c c c} \hline \hline
**Data Set** & **Samples** & **MSE** & **R** \\ \hline Training & 18,900 & 0.093 & 0.998 \\ Validation & 4050 & 0.16 & 0.997 \\ Testing & 4050 & 0.12 & 0.998 \\ \hline \hline \end{tabular} MSE (mean squared error): The average squared difference between outputs and targets. R (Regression): Measure the correlation between outputs and target. Note: the performance of the network can continue to be improved by adjusting the network structure and improving training methods.  
\end{table}
Table 1: FNN’s training results.  
Figure 7: Structure of the feedforward neural network (FNN).