Skip to main content
. 2025 Jul 4;12(7):733. doi: 10.3390/bioengineering12070733
Algorithm 1 Evolutionary algorithm for dimensionality reduction
  • 1:

    Input: Population size P, generations G, mutation rate μ, crossover rate ρ, fitness function S

  • 2:

    Output: Optimized transformation matrix W*

  • 3:

    Step 1: Initialization

  • 4:

    Generate an initial population of transformation matrices: {W1,W2,,WP}

  • 5:

    for g=1 to G do

  • 6:

       Step 2: Fitness Evaluation

  • 7:

       for each candidate Wi in the population do

  • 8:

              Compute fitness: S(Wi) (e.g., silhouette score)

  • 9:

       end for

  • 10:

    Step 3: Selection

  • 11:

     Retain the top-performing candidates based on fitness

  • 12:

        Step 4: Crossover

  • 13:

        for each pair of parents Wparent1,Wparent2 do

  • 14:

            if random() <ρ then

  • 15:
                Generate offspring:
    Wchild=Wparent1+Wparent22
  • 16:

            end if

  • 17:

        end for

  • 18:

        Step 5: Mutation

  • 19:

        for each offspring Wchild do

  • 20:

            if random() <μ then

  • 21:
               Introduce random perturbation:
    Wmutated=Wchild+ϵ,ϵN(0,σ2)
  • 22:

            end if

  • 23:

        end for

  • 24:

        Step 6: Replacement

  • 25:

        Replace the worst-performing candidates in the population with offspring

  • 26:

    end for

  • 27:

    Return: Best-performing transformation matrix W* based on fitness S