## 3 Methodology
### The ReMAHA Algorithm
#### 3.2.4 ReMAHA
Output: Oversampling dataset \(D_{M}\)
1: Split \(D\) into a minority class \(D^{+}\) and the largest majority class \(D^{-}\)
2:\(b\) = Relief-F\({}_{Feature\_Selection}\) (\(D\))
3:\(B\) = diag(\(b\))
4: Initialize dataset \(D_{M}\)
5: Calculate each cluster \(D^{+}_{i}\) through Mini\({}_{Batch\_Kmeans}\) (\(D^{+}\))
6: FOR \(i\) in 1, 2, \(\ldots\), \(K\) do:
7: T = len (\(D^{+}_{i}\))/len (\(D^{+}\))
8: iter = 0
9: WHILE \(T\) > 0 and iter < 5:
10:\(D^{+}_{i}\).append (\(D^{+}_{k}\), \(B\))
11: Initialize \(D^{+}_{i}\).append (\(D^{+}_{i}\), \(B\))
12: iter++
13: FOR \(x_{1}\), \(x_{2}\) in \(D^{+}_{sortal}\):
14:\(x_{new}\) = Generate\({}_{by\_GA}\) (\(x_{1}\), \(x_{2}\))
15: IF \(T\) > 0:
16:\(D^{+}_{i}\).append (\(D^{+}_{i}\), \(B\))
17:\(D^{+}_{i}\).append (\(D^{+}_{i}\), \(B\))
18:\(D^{+}_{i}\).append (\(D^{+}_{i}\), \(B\))
19:\(D^{+}_{i}\).append (\(D^{+}_{i}\), \(B\))
20:\(D^{+}_{i}\).append (\(D^{+}_{i}\), \(B\))
21:\(D^{+}_{i}\).append (\(D^{+}_{i}\), \(B\))
22:\(D

### CatBoost

On the algorithm level, we have chosen to employ CatBoost, a variant of gradient-boosting algorithms [38; 39]. Similar to other gradient-boosting algorithms, CatBoost aims to iteratively learn from errors by combining multiple weak learners. In gradient-boost models, a commonly used node-splitting method is greedy target-based statics, which utilizes the average label value as the node-splitting criterion. However, when extreme values exist in the dataset or when there is a discrepancy between the data distribution of the training and test sets, using the mean value to split nodes can lead to conditional shift, resulting in decreased prediction accuracy. CatBoost mitigates conditional shift by introducing a prior distribution term, represented by \(p\) and a weight coefficient, represented by \(a\). The formula is as follows:

\[\hat{x}_{k}^{i}=\frac{\sum\limits_{j=1}^{p-1}\left[x_{\sigma_{jk}}=x_{\sigma_{ pk}}\right]Y_{\sigma_{j}}+a\times p}{\sum\limits_{j=1}^{p-1}\left[x_{\sigma_{ jk}}=x_{\sigma_{pk}}\right]+a} \tag{12}\]

Furthermore, since gradient-boost models use the same dataset for training in each iteration, it may lead to prediction shift concerning the gradient and the true distribution [40]. CatBoost addresses this issue by employing a ranking boost approach, training a separate model M for each sample. Consequently, the current model M is not trained using the current sample. CatBoost's handling of conditional and prediction shifts makes it more suitable for situations involving imbalanced data. ## 4 Experiments

When evaluating the performance of the proposed models, we addressed the following research questions:

(1) Does varying the number of clusters affect the generation of new data? (2) How does the quality of the newly generated data using our proposed method compare with other sampling techniques? (3) How does this method perform on traffic accident datasets compared to other baseline methods? ### Experimental Setup

The experimental platform utilized in this study includes a system with 64 GB of RAM, an 11 th Gen Intel (R) Core (TM) i7-11700K CPU clocked at 3.60 GHz, an NVIDIA GeForce RTX 3070 Ti GPU, all running on CentOS 7.9. Figure 3: ReMAHA schematic diagram. ### Evaluation Metrics

The confusion matrix is the most commonly used method for evaluating the performance of classification problems. The definition of a confusion matrix is shown in Table 8.

Based on the definition of the confusion matrix, various other data classification evaluation metrics have been derived. Precision represents the proportion of correctly predicted samples for a specific class to the total number of samples predicted as that class:

\[\text{Precision}=\frac{TP}{TP+FP} \tag{13}\]

_Recall_ represents the proportion of correctly predicted samples for a specific class to the total number of samples for that class:

\[Recall=\frac{TP}{TP+FN} \tag{14}\]

Typically, precision and recall are trade-offs, and in many cases, it is necessary to consider both precision and recall simultaneously.