# Heatwave Damage Prediction Using Random Forest Model in Korea
## 2 Methodology
### Random Forest Regression  
RF is an ensemble machine learning method that combines several separately trained models to create a strong learner that can be applied for classification and regression [35]. Such a combination of individual models can reduce overfitting and improve generalization. Therefore, RF has the advantages of high prediction accuracy and algorithm robustness. When training ensemble classifiers, techniques involving the use of different datasets or properties are applied to create different training models. As shown in Figure 1, RF is based on the bootstrap method which is resampling technique that involves random sampling of a dataset with replacement. Then repeats the process k times to obtain several independent and identically distributed training subsets \(\{S_{train,1},\ S_{train,2},\ \ldots,\ S_{train,k}\}\), which have n samples. Then, m features from the n samples are selected without accepting duplicate samples. Prediction results from different decision trees build each training subset. The most commonly obtained forecast results are selected and determined by the final forecast [35; 36]. In conclusion, although some trees created in RF may be exposed to overfitting, overfitting of the RF can be prevented by generating a large number of trees. RF algorithms have been applied to various disaster fields to predict [37; 38], forecast, and evaluate risks [39; 40]. A loss function measures the similarity between the values predicted by a model and the correct values. To increase the accuracy of a model, the loss should be reduced as the model is trained. Different loss functions are used depending on the characteristics of the model (classification or regression) and dataset. The representative loss functions for measuring errors in regression models are mean absolute error (MAE) and mean squared error (MSE):  
\[MAE=\frac{\sum_{i=1}^{N}\left|y_{i}-\hat{y}\right|}{N} \tag{1}\]  
\[MSE=\frac{\sum_{i=1}^{N}(y_{i}-\hat{y})^{2}}{N} \tag{2}\]  
where \(N\) is the total number of data points, \(y\) is the real (observed) output value, and \(\hat{y}\) is the predicted output value. When determining the MAE, the difference between the observed and predicted values of each data point is summed, and when determining the MSE, the square of the difference between observed and predicted values is summed. Therefore, the MSE is more sensitive to outlier values than the MAE. When the temperature exceeds a certain range, the heatstroke patients with thermal damage is characterized by a rapid increase in the incidence of patients. Consequently, MAE was considered as a loss function in this study to apply the characteristic of the target data. To evaluate regression models, the proximity of predicted values to the observed data is quantified on the basis of the MAE, root mean squared error (RMSE), root mean squared logarithmic error (RMSLE), and coefficient of determination (\(R^{2}\)), which are mainly used to evaluate accuracy [41, 42]. However, the mean deviations of MAE, RMSE, and RMSLE (the lower the value, the higher the accuracy) have different values depending on the scale; therefore, it is difficult to make inferences using the absolute values alone. In contrast, \(R^{2}\) is a relative value because it is the variance ratio of dependent variables predicted from independent variables; thus, the performance can be intuitively determined. \(R^{2}\) generally ranges from 0 to 1. Note that if the \(R^{2}\) value of a model is 0.7 or more, the model is usually considered reasonable [43]. The RF model was established to predict the number of patients with heat-related diseases caused by heatwaves. Socioeconomic, demographic, meteorological, and demographic data were collected  
Figure 1: Architecture of a random forest. and used as input variables for the model. The Boruta algorithm was used to filter the variables in the RF model [38]; this algorithm uses a Z score calculated by dividing the average loss by its standard deviation.