| Algorithm SMOTE (S, M, A) |
| Input: |
|
A= Number of nearest neighbors |
|
M= Number of samples from minority classes |
|
S= Amount of SMOTE S % |
|
Output: () * M Samples of synthetic minority classes |
| (“Identify minority class samples in the data set. If S is less than 100%, randomize the |
| minority class samples since only a random percentage of them will be SMOTE”) |
|
ifS <100 |
|
Then determine the minority class sample M randomly |
| M = () ∗M
|
|
S= 100 |
| endif |
|
S= (int)() (“determine the number of SMOTE samples assuming that the number |
| is an integer with a multiple of 100”) |
|
A= Number of nearest neighbors |
|
numattrs= Number of attributes |
|
Sample [ ] [ ]: is a number of original samples in the form of Arrays from the minority |
| class |
|
newindex: the resulting number of samples is calculated by initializing to 0 |
|
Synthetic [ ] [ ]: Array for synthetic samples (“only calculates the number of nearest |
| neighbors of A for each sample”) |
| for i← 1 toM
|
| nearest neighbor i is calculated using A then store index into array n |
| Populate (S, i, n array) |
| endfor |
|
Populate (S, i, nnarray) (“this is a manufacturing function with synthetic samples”) |
|
whileS≠ 0 |
| select data one from “A” for nearest neighbor “i” by randomly selecting 1 and A |
| for attr← 1 tonumattrs
|
| Compute: dif=Sample [nnarray [nn ]] [attr ] −Sample [i ][attr ] |