| Algorithm 1: SMOTE |
|
Input: M (number of samples in the minority class), N (% ratio of synthetic minority samples for class balancing), K (number of nearest neighbors), synthetic instance; Choose randomly a subset of the minority class data of size (synthetic samples in the minority class) such that the class labels are uniformly distributed; for alldo (1) Find the K nearest neighbors; (2) Randomly select one of KNNs, called ; (3) Calculate the distance between the randomly selected NN and the instance ; (4) The new synthetic instance is generated as (where is a random number between 0 and 1); end for Repeat steps number 2–4 until the desired proportion of minority class is met. |