Class BasicParticle<PosType,VelType>
java.lang.Object
unifeat.featureSelection.wrapper.PSOBasedMethods.BasicParticle<PosType,VelType>
- Type Parameters:
PosType
- the type of position vector of each particleVelType
- the type of velocity vector of each particle
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 Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptiondouble
This method returns the fitness value of the particle.double
This method returns the fitness value of best position of the particle (personal best)abstract int
This method returns the number of selected features by the particle based on position vector.abstract int[]
This method returns the indices of selected features by the particle based on position vector.void
setFitness
(double fitness) This method sets the fitness value of the particle.void
setPBestFitness
(double pBestFitness) This method sets the fitness value of best position of the particle (personal best)
-
Field Details
-
position
-
velocity
-
fitness
private double fitness -
pBest
-
pBestFitness
private double pBestFitness
-
-
Constructor Details
-
BasicParticle
Initializes the parameters- Parameters:
pos
- the type of position vector of each particlevel
- the type of velocity vector of each particledimension
- 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
-