# An Effective Tangent Stiffness of Train-Track-Bridge Systems Based on Artificial Neural Network
## 2 The WRI Element and the BP Neural Network
### The BP-Based Tangent Stiffness (BPTS)  
A backpropagation (BP) neural network is used for obtaining an alternative tangent stiffness. The BP neural network consists of an input layer, a hidden layer, and an output layer, as can be seen in Figure 4. Each layer is made up of a few neurons. The number of neurons in the input and output layers is usually determined by the number of input parameters and output parameters, while the number of neurons in the hidden layer is uncertain. Too few neurons may affect the accuracy of the predicted results, but too many may lead to overfitting. Therefore, multiple tests are often needed to select the best number of hidden layer neurons. Figure 3: The transform of F and the resisting force R.  
In the hidden layer, each neuron receives parameters from the input layer and then calculates as follows:  
\[h_{i}=f\left(\sum_{j=1}^{m}w_{ij}X_{j}+b_{i}\right),\ i=1,\ldots,n \tag{6}\]  
where \(n\) indexes the neurons in the hidden layer, and \(m\) denotes the number of inputs. \(h_{i}\) denotes the \(i\)th neuron of the hidden layer, where \(i\) ranges from 1 to \(n\). \(X_{j}\) is the \(j\)th input, where \(j\) ranges from 1 to \(m\). \(w_{\bar{\eta}}\) is a weighting coefficient for \(X_{j}\)'s contribution to \(h_{i}\), while \(b_{i}\) is a bias for the \(i\)th neuron in the hidden layer. \(w_{\bar{\eta}}\) can be assembled into an \(n\)\(m\) matrix. The \(f\) represents a nonlinear activation function, which is the crucial part of a neural network that builds the nonlinear mappings. There are many forms for \(f\), but in this study, the \(\tanh\) function was used. It can be expressed as  
\[f(x)=\frac{e^{x}-e^{-x}}{e^{x}+e^{-x}} \tag{7}\]  
where \(e\) denotes the basis of the natural logarithms. After each neuron in the hidden layer has been calculated, the neurons in the output layer can be expressed as  
\[Y_{j}=\sum_{k=1}^{N}v_{jk}h_{k}+d_{j},j=1,\ldots,M \tag{8}\]  
where M denotes the number of outputs, and N is the number of neurons in the hidden layer. \(Y_{j}\) represents the \(j\)th output, where \(j\) ranges from 1 to M. \(h_{k}\) is the \(k\)th neuron of the hidden layer, where \(k\) ranges from 1 to N. \(v_{jk}\) is a weighting coefficient for the contribution of \(h_{k}\) to \(Y_{j}\), while \(d_{j}\) denotes the bias for the \(j\)th output. \(V_{jk}\) can be assembled into an M \(\times\) N matrix. The weighting coefficients and biases (\(w_{\bar{\eta}}\), \(b_{\bar{\eta}}\), \(v_{jk}\), and \(d_{j}\)) in Equations (6) and (8) must be obtained by training with a large number of samples. The BP neural network's performance is evaluated by comparing its predicted results, and the training samples are performed by using the mean squared error (MSE) of the discrepancies for quantification. The MSE is  
\[\text{MSE}=\sum_{j=1}^{R}\left(Y_{j}-\overline{Y}_{j}\right)^{2}/R \tag{9}\]  
where \(Y_{j}\) denotes the output calculated by Equation (8), \(\overline{Y}_{j}\) denotes the sample value, and \(R\) is the number of the output sample. The MSE is usually guaranteed within a narrow  
Figure 4: A representation of the feedforward BP neural network. range (0.001 in this study) to get weighting coefficients and biases that ensure the network's performance. In the ANN model for the tangent stiffness of WRI, the inputs X are nodal displacement \(\mathbf{u}\) and velocity \(\mathbf{v}\), while the outputs Y are \(\frac{\partial\mathbf{R}_{\mathrm{w}}}{\partial\mathbf{u}}\) and \(\frac{\partial\mathbf{R}_{\mathrm{r}}}{\partial\mathbf{u}}\) in Equation (4). The BPTS of the WRI element can be obtained by the following steps: (1) Selecting an appropriate example, running enough time steps, recording input X and output Y at each iteration of each time step. (2) Selecting an appropriate activation function in Equation (7) and the learning algorithm, determining the number of hidden layers and number of neurons in each layer.