## 4 Intelligent Algorithm Model for Determination of the Axle Temperature Alarm Level  
### Training the Axle Temperature Alarm-Level Discrimination Model  
This paper adopts a discriminative approach that determines the relationship weights between sequences through the collective action of multiple attention mechanism layers and finally integrates the results of each attention mechanism layer to obtain the final information [31]. In terms of training the alarm level discrimination network, the whole discrimination model consists of a transformer module and an output layer. To construct the transformer, the most crucial aspect of the whole model is the selection of the number of layers of the attention mechanism and the number of neurons in the hidden layer. Since the number of input features is small, only one transformer module is utilized to extract information from the input sequence samples. The components of a transformer are presented in Table 1.  
As shown in Table 2, is a component of a Transformer. For the basic axle temperature alarm-level determination model, since the total number of parameters in the model is very small, with only fifty thousand learnable parameters, the excessive number of neurons in the hidden layer could lead to overfitting of the discrimination model [31]. Therefore, the number of neurons in the hidden layer is herein set as 64. Additionally, to ensure the effectiveness of the multi-head attention mechanism layer, the dimensions of the Q, K, and V vectors for each attention mechanism cannot be too low. Simultaneously, the number of neurons in the hidden layer must be divisible by the number of attention layers in the multi-head attention mechanism layer. Therefore, the number of attention layers in the multi-head attention mechanism layer is set to 2, which means that the dimensions of the Q, K, and V vectors for each attention mechanism are 32. The alarm-level discrimination model benefits from two sets of inputs: the sequence features of the input sequence and the position vector of the detection station. The sequence features of the input sequence, denoted by **X** in the model training phase, have the form (Batch, Seq, Feature), where the first, second, and third dimensions represent the data batch processed simultaneously, the number of detection stations considered, and the selected number of features, respectively. In the model training stage, Batch in **X** can be selected based on the computer performance, while Seq and Feature sizes are fixed at 3. For instance, consider the \(i\)-th sample **X\({}_{\text{i}}\)** within a sequence of samples **X** as follows: **X\({}_{\text{i}}\)** = (x1, x2, x3), where **X\({}_{\text{i}}\)** represents a vector of axle temperature features detected by the detection station, with corresponding values (f1, f2, f3). Specifically, the arrangement of axle temperature \begin{table}
\begin{tabular}{c c c} \hline \hline
**The Fold Times k** & **Loss Value/\%** & **Precision/\%** \\ \hline
1 & 4.63 & 98.62 \\
2 & 9.52 & 97.88 \\
3 & 7.36 & 98.03 \\ Average & 7.17 & 98.17 \\ \hline \hline \end{tabular}
\end{table} 
Table 1: Test set accuracy and loss values. \begin{table}
\begin{tabular}{c c c} \hline \hline
**Layer Type** & **Output Type** & **Parameter Value** \\ \hline Embedding & (Batch, 3, 3) & 256 \\ Multi-head attention & (Batch, 3, 64) & 16,640 \\ Add & (Batch, 3, 64) & 0 \\ Layer norm & (Batch, 3, 64) & 0 \\ FFN & (Batch, 3, 64) & 33,088 \\ Add & (Batch, 3, 64) & 0 \\ Layer norm & (Batch, 3, 64) & 0 \\ Output & (Batch, 3, 4) & 260 \\ \hline \hline \end{tabular}
\end{table} 
Table 2: Structure of the transformer model. feature data obtained by the \(i\)-th detection station in order are temperature rise, column temperature rise difference, and vehicle temperature rise difference. For the sequence length in the alarm rule Seq less than 3 optimized timing sample data, the missing part of the corresponding vector is \([-2,-2,-2]\).