# Leveraging Internet News-Based Data for Rockfall Hazard Susceptibility Assessment on Highways
## 2 Materials and Methods
### Machine Learning and Accuracy Indices  
The Random Forest technique is a robust and versatile machine learning method that operates by constructing multiple decision trees during training and combining their outcomes to enhance predictive accuracy and control overfitting. Each decision tree is built using a subset of the data, and the final prediction is obtained by averaging the results of these individual trees (regression) or by majority voting (classification). This ensemble approach not only improves the model's performance, but also provides insights into the importance of various predictive variables. In our rockfall hazard susceptibility study, the Random Forest technique [19] was employed due to its ability to handle complex, non-linear relationships and its effectiveness with large datasets. Recent studies have shown that among various machine learning algorithms, Random Forest consistently outperforms others in terms of precision and classification accuracy, achieving over 90% accuracy in predicting small rockfall locations [20]. This method has been successfully applied in studies of landslide susceptibility [21], soil erosion [22], forest growth [23], soil organic carbon [24], and potential groundwater zones [25]. Its capability to manage a wide range of input variables and its robustness against overfitting made it particularly suitable for our comprehensive analysis of rockfall susceptibility in Taiwan. The dataset for this research was divided into a training dataset (approximately 80%, consisting of 145 positive and 145 negative samples) for training the Random Forest model, and a test dataset (approximately 20%, consisting of 37 positive and 37 negative samples) for evaluating the model's performance. The Random Forest model was trained using the \"randomForest\" package in R, where we employed 5-fold cross-validation on the training dataset to determine the optimal hyperparameters. Figure 2: Predictive variables used for rockfall analysis: (**a**) elevation, (**b**) slope angle in degrees, (**c**) NDVI, (**d**) river system, (**e**) urban areas, (**f**) fault lines, (**g**) geologically sensitive areas, (**h**) potential debris flow areas, (**i**) average yearly rainfall, (**j**) average monthly temperature, (**k**) average monthly wind speed, (**l**) average monthly humidity, (**m**) average number of rainy days, (**n**) strata, (**o**) epoch, (**p**) population density. The two hyperparameters considered in this study were \"mtry,\" representing the number of variables randomly sampled as candidates at each split, and \"ntree,\" representing the number of trees to grow. The default values for these parameters are \(\text{mtry}=\sqrt{28}\approx 5\) and \(\text{ntree}=500\). We conducted the cross-validation over a grid of hyperparameter combinations, specifically \(\text{mtry}=(1,3,5,7,9,11)\) and \(\text{ntree}=(100,500,1000)\). Given the importance of highway types, as discussed previously in this section, each fold in the cross-validation was stratified based on highway type. Specifically, each fold contained 20 positive and 20 negative samples along the Provincial Highways, 3 positive and 3 negative samples along the City and County Highways, and 6 positive and 6 negative samples along the District and Rural Highways. When training the model, all 28 variables were considered, excluding the highway type. To assess the performance of the classification model, we used several statistical indices: Precision, Sensitivity (Recall), Specificity, F1 score, Overall Accuracy, and [PERSON]'s kappa (\(\kappa\)), as shown in Equations (1)-(6). These indices provide a comprehensive evaluation of the model's classification performance, offering unique insights into different aspects of the model's accuracy and reliability.