java.lang.Object
unifeat.featureSelection.wrapper.PSOBasedMethods.BasicSwarm<Boolean,Particle>
unifeat.featureSelection.wrapper.PSOBasedMethods.BPSO.Swarm

public class Swarm extends BasicSwarm<Boolean,Particle>
This java class is used to implement a swarm of particles in binary particle swarm optimization (BPSO) method in which the type of position vector is boolean and the type of particle is extended from Particle class.
Author:
Sina Tabakhi
See Also:
  • Field Details

    • seedValue

      private int seedValue
    • rand

      private Random rand
  • Constructor Details

    • Swarm

      public Swarm()
      Initializes the parameters
  • Method Details

    • initialization

      public void initialization()
      This method initializes the position and velocity vectors of each particle in the swarm. Each particle is randomly initialized in the predefined ranges of values.
      Specified by:
      initialization in class BasicSwarm<Boolean,Particle>
    • evaluateFitness

      public void evaluateFitness()
      This method evaluates the fitness of each particle in the swarm by predefined fitness function. K-fold cross validation on training set is used for evaluating the classification performance of selected feature subset by each particle.
      Specified by:
      evaluateFitness in class BasicSwarm<Boolean,Particle>
    • updatePersonalBest

      public void updatePersonalBest()
      This method updates the best position (personal best) of each particle in the swarm. Personal best position is updated when the classification performance of the particle's new position is better than personal best.
      Specified by:
      updatePersonalBest in class BasicSwarm<Boolean,Particle>
    • updateGlobalBest

      public void updateGlobalBest()
      This method updates the global best position (global best) of the swarm. Global best position is updated when the classification performance of any personal best position of the particles is better than global best.
      Specified by:
      updateGlobalBest in class BasicSwarm<Boolean,Particle>
    • updateParticleVelocity

      public void updateParticleVelocity()
      This method updates the velocity vector of each particle in the swarm.
      Specified by:
      updateParticleVelocity in class BasicSwarm<Boolean,Particle>
    • updateParticlePosition

      public void updateParticlePosition()
      This method updates the position vector of each particle in the swarm.
      Specified by:
      updateParticlePosition in class BasicSwarm<Boolean,Particle>
    • subtractBoolean

      private int subtractBoolean(boolean num1, boolean num2)
      This method subtracts two boolean values.

      If the input value equals to true, the result will be considered as 1, otherwise 0.

      Parameters:
      num1 - the first input value
      num2 - the second input value
      Returns:
      the result of subtraction
    • sigmoidFunc

      private double sigmoidFunc(double value)
      This method transforms a input value to the range of (0,1) using sigmoid function.
      Parameters:
      value - the input value that will be transformed
      Returns:
      the transformed value of the input value