Skip to main content
. 2021 Jul 1;23(7):850. doi: 10.3390/e23070850
Algorithm 2 Pseudo-code of the algorithm to predict with a CRS model.
  • 1:

    INPUT:

  • 2:

    s: test row with C1 antecedent attributes

  • 3:

    CRS: Classification Rule Set

  • 4:

    USE: RSS: Rule subset

  • 5:

    START ALGORITHM

  • 6:

    forc=C1to 1 do

  • 7:

     RSS ← {Ri ∈ CRS / c attributes of s are equal to c attributes of Ri}

  • 8:

    if RSS  then

  • 9:

      R ← R1 {/* R1 is the first rule of RSS */}

  • 10:

      for  j=2 to  |RSS|  do

  • 11:

       if R.supp < Rj.supp then

  • 12:

        R ← Rj

  • 13:

       else if R.supp = Rj.supp and R.conf < Rj.conf then

  • 14:

        R ← Rj

  • 15:

       end if

  • 16:

       return R.consequent

  • 17:

      end for

  • 18:

    end if

  • 19:

    end for

  • 20:

    return The resulting predicted class for row s (the consequent of a rule of CRS) {/*OUTPUT*/}

  • 21:

    END ALGORITHM