Skip to main content
. 2020 Oct 23;22(11):1198. doi: 10.3390/e22111198
Algorithm 2 Randomized crossover with information gain weighting
Require:
  • First item item1

  • Second item item2

  • Scaling function for number of genes onGeneScaling

  • Individual feature entropy informationEntropy

  • 1:

    function crossooverPair

  • 2:

        if |item1| < |item2| then

  • 3:

            swap(item1, item2)

  • 4:

        end if

  • 5:

        intermediate ← item & item2             ▹ Intersection of genes

  • 6:

        rest ← item1 ⊕ item2       ▹ Bitwise XOR, features present in exactly one item

  • 7:

        addNum ← onGeneScaling(abs(|item1| - |item2|))

  • 8:

                ▹ Scale the number of new features according to provided function

  • 9:

        additional ← rSelect(addNum, informationEntropy, rest)

  • 10:

             ▹ Randomly select addNum features, weighted by precalculated entropy

  • 11:

        mated ← intermediate | additional            ▹ Add selected features

  • 12:

        return mated

  • 13:

    end function