Class BasicParticle<PosType,VelType>

java.lang.Object
unifeat.featureSelection.wrapper.PSOBasedMethods.BasicParticle<PosType,VelType>
Type Parameters:
PosType - the type of position vector of each particle
VelType - the type of velocity vector of each particle
Direct Known Subclasses:
Particle, Particle, Particle, Particle

public abstract class BasicParticle<PosType,VelType> extends Object
The abstract class contains the main methods and fields that are used in all PSO-based feature selection methods. This class is used to represent a particle in PSO algorithm.
Author:
Sina Tabakhi
  • Field Details

    • position

      public PosType[] position
    • velocity

      public VelType[] velocity
    • fitness

      private double fitness
    • pBest

      public PosType[] pBest
    • pBestFitness

      private double pBestFitness
  • Constructor Details

    • BasicParticle

      public BasicParticle(Class<PosType> pos, Class<VelType> vel, Integer dimension)
      Initializes the parameters
      Parameters:
      pos - the type of position vector of each particle
      vel - the type of velocity vector of each particle
      dimension - the dimension of problem which equals to total number of features in the dataset
  • Method Details

    • numSelectedFeatures

      public abstract int numSelectedFeatures()
      This method returns the number of selected features by the particle based on position vector.
      Returns:
      number of selected features by the particle
    • selectedFeaturesSubset

      public abstract int[] selectedFeaturesSubset()
      This method returns the indices of selected features by the particle based on position vector.
      Returns:
      the array of indices of the selected features by the particle
    • getFitness

      public double getFitness()
      This method returns the fitness value of the particle.
      Returns:
      the fitness value of the particle
    • setFitness

      public void setFitness(double fitness)
      This method sets the fitness value of the particle.
      Parameters:
      fitness - the fitness value of the particle
    • getPBestFitness

      public double getPBestFitness()
      This method returns the fitness value of best position of the particle (personal best)
      Returns:
      the fitness value of best position of the particle
    • setPBestFitness

      public void setPBestFitness(double pBestFitness)
      This method sets the fitness value of best position of the particle (personal best)
      Parameters:
      pBestFitness - the fitness value of best position of the particle