## 3 Results
### Recurrent Neural Networks  
RNNs differ from conventional neural networks primarily because cell feedback loops provide the RNN's memory. While the feedback loop communicates data throughout a layer [19], feed-forward neural networks only carry information between layers. Though they have limitations beyond the training horizon, recurrent neural networks (RNNs) are widely used in time-series forecasting. The basic problems are presented in [20; 21]. RNNs cannot capture long-term dependencies in time-series data because of vanishing or exploding gradients during training. This limitation might make RNNs unable to predict long-term occurrences. Standard RNN designs ignore previous time steps, particularly for long sequences. Short-term memory can produce inadequate forecasts at points beyond the training horizon. Figure 20 shows a standard RNN. The network computes \(h_{t}\) at step \(t\) by combining input \(x_{t}\) with the hidden internal state of the preceding step, \(h_{t-1}\). The hidden memory of the RNN is connected to \(Zig_{t}\), the output layer. Figure 20 shows this as if there were many copies of the input-output architecture, with linked hidden layers. The RNN cell can have one fundamental activation function. A basic RNN updates the concealed state at every step. \[h_{t}=\tanh(W_{hh}h_{t-1}+W_{xh}x_{t-1}+b_{h}), \tag{2}\]  
Figure 20: The structure of an RNN. Furthermore, the weight matrices \(W_{hh}\) and \(W_{ih}\) have dimensions m \(\times\) m and m \(\times\) n, respectively, assuming the input data \(x\) has size n, and hidden state \(h_{t}\) has dimension m. We can determine the output--more specifically, the PF at step \(t\)--using the hidden state \(h_{t}\). \[Zig_{t}=W_{h0}h_{t}, \tag{3}\]  
Figure 21 shows the structure of the hybrid deep neural network. We use this RNN to forecast the zigzag length. The first layer is an InputSequence layer that shows the sequence of the input data, which consists of the past positions of the contact wires (\(Zig_{-n}\), \(Zig_{-(n-1)}\),..., \(Zig_{-1}\)). The input is a time series that shows how the zigzag pattern changes over time. The Gated Recurrent Unit (GRU) GRU1 follows next from our DNN. Processing the data that enter this GRU layer extracts important temporal features from the zigzag values. After the GRU layer, the data are sent to the next layer, a Long Short-Term Memory (LSTM) layer, the LSTM1 layer. This layer identifies additional temporal patterns and stores important characteristics from the previous steps. The Dropout1 layer prevents overfitting with regularization. It randomly \"drops\" neurons during training to allow the network to learn more robust characteristics. Another GRU layer, GRU2, is introduced to improve the characteristics extracted from the first LSTM layer. This is utilized to capture complex patterns in zigzag behavior. LSTM2 is the second LSTM layer. It adds more memory, which allows the network to maintain and improve the sequential information it has learned until now. Dropout2 is a second dropout layer that makes sure the network performs well with new data. This reduced the risk of overfitting. LSTM3, the third LSTM layer, improves the temporal information even more, thus increasing the model's capacity to forecast the next state of the zigzag length value. Dropout 3 is the third dropout layer, once again used to increase model generalization. A fully connected layer obtains the results of the last LSTM layer. This layer provides a full combination of all learned features by connecting every neuron from the previous layers to every neuron in the output. The last output layer calculates the predicted zigzag length of the contact wire. Because it is necessary to predict a real value, this layer uses linear activation. The data acquired over a 5.3 km distance provided the most precise identification of the zigzag length. Figure 22 shows the information collected from Line 2, which was used to train the deep RNN. Figure 21: The architecture of the hybrid deep neural network.