Class Swarm
java.lang.Object
unifeat.featureSelection.wrapper.PSOBasedMethods.BasicSwarm<Double,Particle>
unifeat.featureSelection.wrapper.PSOBasedMethods.CPSO.Swarm
This java class is used to implement a swarm of particles in continuous
particle swarm optimization (CPSO) 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:
-
Field Summary
Fields inherited from class unifeat.featureSelection.wrapper.PSOBasedMethods.BasicSwarm
C1, C2, END_POS_INTERVAL, fitnessEvaluator, gBest, INERTIA_WEIGHT, MAX_VELOCITY, MIN_VELOCITY, population, POPULATION_SIZE, PROBLEM_DIMENSION, START_POS_INTERVAL
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
This method evaluates the fitness of each particle in the swarm by predefined fitness function.void
This method initializes the position and velocity vectors of each particle in the swarm.void
This method updates the global best position (global best) of the swarm.void
This method updates the position vector of each particle in the swarm.void
This method updates the velocity vector of each particle in the swarm.void
This method updates the best position (personal best) of each particle in the swarm.Methods inherited from class unifeat.featureSelection.wrapper.PSOBasedMethods.BasicSwarm
getGBest, getGBestFitness, setGBest, setGBestFitness
-
Field Details
-
seedValue
private int seedValue -
rand
-
-
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. Each particle is randomly initialized in the predefined ranges of values.- Specified by:
initialization
in classBasicSwarm<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 classBasicSwarm<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.- Specified by:
updatePersonalBest
in classBasicSwarm<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.- Specified by:
updateGlobalBest
in classBasicSwarm<Double,
Particle>
-
updateParticleVelocity
public void updateParticleVelocity()This method updates the velocity vector of each particle in the swarm.- Specified by:
updateParticleVelocity
in classBasicSwarm<Double,
Particle>
-
updateParticlePosition
public void updateParticlePosition()This method updates the position vector of each particle in the swarm.- Specified by:
updateParticlePosition
in classBasicSwarm<Double,
Particle>
-