Skip to main content
. 2022 Sep 21;22(19):7162. doi: 10.3390/s22197162
Algorithm 1: Data balancing through SMOTE
  • 1:

    Initialization

  • 2:

    Inputs:  Minority data M (D)= mi∈ X, Where i = 1, 2, 3, …, D

  • 3:

    Outputs:  Synthetic Data S

  • 4:

    Number of minority samples (D)

  • 5:

    Percentage of SMOTE (P)

  • 6:

    Number of (k) nearest neighbors

  • 7:

    for n = 1 to D do

  • 8:

    Find the K nearest neighbors of Di

  • 9:

    Check P¯=P/100

  • 10:

    While P¯≠0do

  • 11:

       Select a random sample m in minority class

  • 12:

       Find neighbor of m

  • 13:

       Pick a random number α∈[0,1]

  • 14:

       m¯=mi+α(m¯−mi)

  • 15:

    While Append m¯ to S

  • 16:

    Check P¯=P−1

  • 17:

     end while

  • 18:

     end for

  • 19:

    End