## 2 Methodology
### Coding and Software Libraries
#### 2.2.1 Data Selection and Pre-Processing  
Data pre-processing is essential for ensuring that the data are suitable for analysis, and it can help to improve the accuracy and effectiveness of machine learning models. Data pre-processing is essential for several reasons. First, it improves data quality. Pre-processing helps identify and correct errors, missing values, and inconsistent data, which can improve the data quality. Second, it facilitates better feature selection. Data pre-processing can also be used to ensure the most relevant features are selected during the feature selection process, which is detailed in the following subsections. Lastly, it enhances model performance. By pre-processing the data, the performance of the models can be enhanced by ensuring that the data are consistent, complete, and relevant to the problem at hand [24]. Table 2 presents the pipeline damage data and their respective descriptions based on the merged report formats to create pipeline incident trends, which PHMSA publishes in their pipeline incident 20 year trend dataset.  
After screening 96 data points to remove incomplete and missing instances, the resulting dataset consisted of 81 data points. Table 2 also contains a set of features with varying magnitudes, units, and ranges; for example, the age of the pipeline is measured in years, whereas the pipe diameter is measured in meters. These various features create a magnitude discrepancy and may significantly impact the accuracy and interpretability of machine learning models. If the features are not properly scaled or normalized, those with larger values or a wider range of values can dominate the prediction outcome. Thus, it is necessary to standardize the features to a consistent level of magnitude with methods such as \(z\)-score normalization, min-max scaling, and logarithmic [25].  
This paper employed the \(z\)-score approach to scale the numerical features in the dataset, as shown in Equation (1). The benefit of using the \(z\)-scores approach is that it allows for the standardized comparison of data points across different datasets with different means and standard deviations [26]. By converting the data points into a standard scale, it becomes easier to compare the relative position of a data point within its dataset and between different datasets.  
\[z=\frac{x-\mu}{\sigma} \tag{1}\]  
where \(z\) represents the scaled value of \(x\), which is an unscaled variable with a mean of \(\mu\) and a standard deviation of \(\sigma\).  
Table 2 contains some categorical variables, such as pipe material, crossing, and incident area type. Most artificial intelligence or machine learning algorithms cannot process categorical variables as these data types are non-numerical data representing a group or category. Thus, these numerical data must be transformed into numerical values. PHMSA does not provide an ordinal or numerical scale for these categorical variables; therefore, they were converted into an ordinal scale to be interpreted by the  
\begin{table}
\begin{tabular}{c c} \hline \hline
**Damage Classification** & **Descriptions** \\ \hline
1 & Trees or vegetation \\
2 & Snow or ice impact accumulation \\
3 & High winds \\
4 & Temperature \\
5 & Heavy rains or floods \\
6 & Other types of natural force \\
7 & Lightning \\
8 & Earth movement not due to heavy rains or floods \\ \hline \hline \end{tabular}
\end{table}
Table 1: Natural force damage type for pipelines.  
machine learning algorithms. For example, in Table 2, the categorical variable \"crossing\" was converted to 0, 1, 2, and 3, representing bridge, railroad, road, and water crossings, respectively. Similarly, the rest of the categorical variables in Table 2 were also transformed into an ordinal scale of 0, 1, 2,..., \(n\) in which \(n\) is the number of categories available for a variable.