Eclipse Attack Detection for Blockchain Network Layer Based on Deep Feature Extraction
Algorithm 1
ISOMTE-based up-sampling algorithm.
Input: Data set D to be up-sampled, and sampling coefficient β.
Output: up-sampled dataset D’.
Start:
1: For each sample xi∈D do.
2: Obtain the corresponding subclass through clustering with the DP algorithm.
3: if The sample size of the subclass is small:
4: //Local density based on exponential kernel.
5: else:
6: //Local density of each sample point.
7: //Calculate the neighbor between the sample point xi and the nearest clustering center.
8: //Separate the samples into majority-class samples DLG and minority-class samples DTN according to the clustering results.
9: //Count the number of samples with minority-class sampling flow G.
10: //Calculate the number of samples for each minority subclass; n is the number of minority subclass clusters; DTNi is the sample size of the ith subclass.
11: //Calculate the sampling weight of each sample in each minority subclass.
12: //Determine the up-sampling number of each sample for each minority class.
13: Each minority-class sample xi locates all neighbor samples in the subclass DTNi according to δi.
14: //Execute gi times of randomly selecting a neighbor sample xTNi for xi to synthesize a minority sample.