java.lang.Object
unifeat.featureSelection.wrapper.PSOBasedMethods.BasicSwarm<Double,Particle>
unifeat.featureSelection.wrapper.PSOBasedMethods.PSO42.Swarm

public class Swarm extends BasicSwarm<Double,Particle>
This java class is used to implement a swarm of particles in particle swarm optimization version 4-2(PSO(4-2)) method in which the type of position vector is double and the type of particle is extended from Particle class.
Author:
Sina Tabakhi
See Also:
  • Constructor Details

    • Swarm

      public Swarm(double theta)
      Initializes the parameters
      Parameters:
      theta - the threshold is used to determine whether a feature is selected or not
  • Method Details

    • initialization

      public void initialization()
      This method initializes the position and velocity vectors of each particle in the swarm. Particles are initialized based on small initialization and large initialization strategies. Most of the particles are initialized using small feature subsets (2/3 of the population) and the other particles are initialized using relatively large feature subsets (1/3 of the population).
      Specified by:
      initialization in class BasicSwarm<Double,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<Double,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. Also, if the classification performance of the particle's new position is same as personal best and the number of selected features is smaller, the personal best will be updated and replaced by particle's new position.
      Specified by:
      updatePersonalBest in class BasicSwarm<Double,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. Also, if the classification performance of the any personal best position is same as global best and the number of selected features is smaller, the global best will be updated and replaced by personal best position.
      Specified by:
      updateGlobalBest in class BasicSwarm<Double,Particle>
    • updateParticleVelocity

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

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