Class BasicIndividual<GeneType>
java.lang.Object
unifeat.featureSelection.wrapper.GABasedMethods.BasicIndividual<GeneType>
- Type Parameters:
GeneType- the type of genes of each individual
- Direct Known Subclasses:
Individual,Individual
The abstract class contains the main methods and fields that are used in all
GA-based feature selection methods. This class is used to represent a
individual in GA algorithm.
- Author:
- Sina Tabakhi
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionBasicIndividual(Class<GeneType> gene, Integer dimension) Initializes the parameters -
Method Summary
Modifier and TypeMethodDescriptiondoubleThis method returns the fitness value of the individual.abstract intThis method returns the number of selected features by the individual based on its gene vector.abstract int[]This method returns the indices of selected features by the individual based on its gene vector.voidsetFitness(double fitness) This method sets the fitness value of the individual.
-
Field Details
-
genes
-
-
Constructor Details
-
BasicIndividual
Initializes the parameters- Parameters:
gene- the type of genes of each individualdimension- 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 individual based on its gene vector.- Returns:
- number of selected features by the individual
-
selectedFeaturesSubset
public abstract int[] selectedFeaturesSubset()This method returns the indices of selected features by the individual based on its gene vector.- Returns:
- the array of indices of the selected features by the individual
-
getFitness
public double getFitness()This method returns the fitness value of the individual.- Returns:
- the fitness value of the individual
-
setFitness
public void setFitness(double fitness) This method sets the fitness value of the individual.- Parameters:
fitness- the fitness value of the individual
-