## 3 Materials and Methods
### Improved Smote Algorithm  
In 2002, [PERSON] proposed the Smote algorithm, a technological approach designed to address the issue of data imbalance in classification tasks. The algorithm synthesises samples from underrepresented classes, thereby compensating for their numerical disadvantages. Consequently, the risk of model overfitting is reduced, thereby enhancing the overall performance and reliability of the model. While the Smote algorithm enhances the representativeness of the minority class, it may also produce redundant data and noise in the process, further increasing the imbalance of positive and negative samples. In response to the aforementioned issues, we have proposed an improved version of the Smote algorithm (ISmote), comprising three distinct stages: clustering, the determination of the sampling number, and oversampling. K-means++ [20] is an optimised version of the K-means algorithm. The algorithm employs a probabilistic strategy to select initial clustering centres, thereby ensuring that they can more effectively cover the entire data space, reducing the algorithm's sensitivity to initial conditions, and improving the quality of the resulting clustering. In this study, firstly, the K-means++ algorithm is employed to cluster the original minority class samples. Secondly, the synthesised number of samples for each cluster class is determined by calculating the sparsity of the respective cluster group. In this process, the number of samples to be synthesised for each cluster is typically calculated based on the cardinality of each cluster. However, this approach only considers the number of samples in each cluster, without accounting for the distribution of samples in space. As illustrated in Figure 2, two clusters with the same cardinality exhibit disparate sample distributions. Consequently, the synthesized number of samples for clustering is determined by calculating the sparsity of each cluster group. The higher the sparsity of the cluster group, the greater the sampling weight, and thus the greater the number of samples that must be synthesised. Conversely, clusters with a lower sparsity require a smaller number of synthetic samples. By considering the sparsity of cluster, it is possible to generate more samples in areas with sparse samples. This helps the model to better learn the characteristics of these areas, thereby improving its generalisation ability. Figure 1: Result of data encoding. Figure 2: Cluster distribution. Once the requisite number of samples for the synthesis of each cluster has been determined, the Smote algorithm is employed to oversample in accordance with the determined number of synthesized samples. Concurrently, the interpolation methodology inherent to the original Smote algorithm is improved, and instead, the new sample is synthesized between the centre of the cluster and neighbor points, as shown in Figure 3. The pseudo of the ISmote algorithm is given in Algorithm 1. ```
Input: original minority class sample \(N\), number of samples to be generated \(n\), nearest neighbor number \(kun\), number of clusters \(k//k\) value ranges from 5% to 10% of the number of minority class samples Output: the date set obtained after oversampling \(S\)//Step 1: cluster the original samples. 1. clusters \(\leftarrow\) K-means++ (\(N,k\), 2. selected clusters \(\leftarrow\{\)C\({}_{1}\)C\({}_{2}\),...,C\({}_{k}\)\(\}\)//Step 2: determine the number of samples to be synthesized 3. for f \(\in\) selected clusters do
4. density factor(f) \(\leftarrow\)\(mean(local\)\(density(f))//average of the local density 5. sparsity factor(f) \(\leftarrow\)\(1/Density\)\(factors\)//sparsity of each cluster 6. end for
7. sparsity sum \(\leftarrow\)\(\sum_{f\in selected\ clusters\ sparsity\ factor(f)}\)
8. sampling weight \(\leftarrow\)\(sparsity\ factor(f)/sparsity\ sum\)
9. generated samples \(\leftarrow\)\(\|n\times sampling\ weight(f)\|\)//Step 3: Smote oversampling 10. S \(\leftarrow\)\(generated\ samples\cup\{\)\(Smote(f,numberofsamples,kun)\)\(\}\)
11.