# Dynamic Railway Derailment Risk Analysis with Text-Data-Based Bayesian Network
## 3 Proposed Method: Text-Based Bayesian Network (TBN)
### Classify, Layer and Re-Sort  
The authors of [18] believed that failures could occur from a process such as the component-subsystem-system. A similar thought was also proposed in another work [4] (see Figure 2), considering the complexional train system, which obviously shows that a fault tree should be updated to close to the fault tree definition in the step. Therefore, we propose the next phrase progressively from FT1 to FT3, which is the final construction of the fault tree. Next, the steps from the text record to the fault tree are as follows: Required: \(CS=CI,CO,CH\), \(CS\) represents the categories that the causes could belong to. \(CI\) is the internal factors, \(CO\) is the external factors and CH represents the human factors. **Step 1 Perform the text preprocessing and obtain the cut words. **  
In this step, each record contains its own cut words with a sequence of numbers, where set \(R_{i}=\{cov_{1},cov_{2},...,cov_{j}\}\), \(R_{i}\) is the set of cut words of the i-th record, and \(cw_{j}\) is the j-th cut word in the i-th record. **Step 2 Perform text feature analysis and feature extraction. **  
Based on the cause type classification, we divide these causes into the following three parts: external factors (O), internal factors (I) and human factors (H). From the perspective of train operation, the external factors are environmental factors, weather conditions and certain instruction signals. The HFs include the train driver, train passengers, administration staff and other people outside the train. Hence, we set the following:  
\[ \begin{split} IF&=\{ITF,IHF\}\\ OF&=\{EF,OTF,OHF\}\\ HF&=\{IHF,OHF\}\\ \end{split}  \tag{7}\]  
where \(IF\) represents a set of internal factors, including train-factors (\(TF\)) and internal humans factors (\(IHF\)). \(OF\) represents a set of external factors, including environment factors, external track factors (\(OTF\)) and external humans factors (\(OHF\)). \(HF\) contains \(IHF\) and \(OHF\). **Step 3 Obtain fault tree \(FT(1)\). **  
First, we should determine the causes related to the \(HFs\). If any word among the \(HFs\) occurs in a given record containing a cut word, we assign the record to group \(GHF\) \begin{table}
\begin{tabular}{c c} \hline \hline
**Symbols** & **Meanings** \\ \hline B1 & Initial Failure Prevention Barrier \\ B2 & Regular Inspection Barrier \\ B3 & Regular Maintenance Barrier \\ B4 & Process Failure Prevention Barrier \\ B4a & Process Failure (Inner) Prevention Barrier \\ B4b & Process Failure (Outer) Prevention Barrier \\ B5 & Failure Notice Barrier \\ B6 & Failure Control Barrier \\ \hline \hline \end{tabular}
\end{table} 
Table 1: Definitions of barriers. Figure 2: The barriers proposed in [4]. Regarding to the records in group \(GHF\), if any records primarily originate from train passengers, we place these records in group \(GIF\), and they are defined as \(GOF(OHF)\), i.e., the status of the driver and the reaction of the driver. Next, for the rest of the records, if \(EF\) weather words and \(OTF\) object words occur, we assign these records to \(GOF(EF_{i})\) and \(GOF(OTF_{i})\), respectively. Finally, the remaining records are assigned to group \(GIF\). It is clear that the \(GIF\) group is not informative, so we must classify the contained records. Regarding the GIF group, if there is only one factor in \(IF\), we define it as \(GIF(IHF)\), but if both body factors and \(HFs\) occur, we define it as \(GIF(ITF)\). Therefore, we obtain the following:  
\[ \begin{split} FT(1)&=\{GOF(1),GIF(1)\}\\ GOF(1)&=\{GOF(OTF),GOF(OHF)\}\\ GIF(1)&=\{GIF(ET),GIF(ITF),GIF(IHF)\}\end{split}  \tag{8}\]  
**Step 4 Update and obtain \(\boldsymbol{FT(2)}\). **  
In this step, we must layer \(FT(1)\) using the relation between word \(i\) and the state. In each subgroup of \(GOF(1)\), we set word \(i\) as layer 1, and the following layer is a combination of all subgroups. For this combination, if word \(i\) and its previous or subsequent 2 words are the same, the subgroup is divided into several parts containing the same words.