Class Population
java.lang.Object
unifeat.featureSelection.wrapper.GABasedMethods.BasicPopulation<Individual>
unifeat.featureSelection.wrapper.GABasedMethods.HGAFS.Population
This java class is used to implement a population of individuals in hybrid
genetic algorithm for feature selection using local search (HGAFS) in which
the type of individual is extended from Individual class.
- Author:
- Sina Tabakhi
- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionprivate int
static double
private double[]
private Individual[]
static double
private Random
private int
private double[][]
Fields inherited from class unifeat.featureSelection.wrapper.GABasedMethods.BasicPopulation
CROSS_OVER_RATE, CROSSOVER_TYPE, fitnessEvaluator, MUTATION_RATE, MUTATION_TYPE, population, POPULATION_SIZE, PROBLEM_DIMENSION, REPLACEMENT_TYPE, SELECTION_TYPE
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprivate double[]
This method computes the correlation of each feature to other features.private int
This method determines the size of feature subset.void
This method evaluates the fitness of each individual in the population by predefined fitness function.double[]
This method returns an array of fitness values of individuals in a populationThis method returns the fittest individual in the populationvoid
This method initializes each individual in the population.void
This method recombines (cross over) the parents to generate new offsprings.void
This method handles populations from one generation to the next generation.void
This method performs a local search strategy on each individual which is based on correlation of features.void
This method mutates new offsprings by changing the value of some genes in them.void
This method selects parents from the individuals of a population according to their fitness that will recombine for next generation.void
setDataInfo
(double[][] data) This method sets the information of the dataset.
-
Field Details
-
trainSet
private double[][] trainSet -
seedValue
private int seedValue -
rand
-
EPSILON
public static double EPSILON -
MU
public static double MU -
constantSubsetSize
private int constantSubsetSize -
featCorrelationValue
private double[] featCorrelationValue -
dissimilarSet
-
similarSet
-
matingPool
-
-
Constructor Details
-
Population
public Population(double epsilon, double mu) Initializes the parameters- Parameters:
epsilon
- the epsilon parameter used in the subset size determining schememu
- the mu parameter used in the local search operation (control similar/dissimilar)
-
-
Method Details
-
initialization
public void initialization()This method initializes each individual in the population.Each individual is randomly initialized in the predefined ranges of values. The number of selected features in each individual is constant and defined by a scheme.
- Specified by:
initialization
in classBasicPopulation<Individual>
-
evaluateFitness
public void evaluateFitness()This method evaluates the fitness of each individual in the population by predefined fitness function. K-fold cross validation on training set is used for evaluating the classification performance of selected feature subset by each individual. Also, inverse of summation of the correlation of selected features by individual is added to the accuracy of classifier.- Specified by:
evaluateFitness
in classBasicPopulation<Individual>
-
operateSelection
public void operateSelection()This method selects parents from the individuals of a population according to their fitness that will recombine for next generation.The selection type is selected based on selectionType by user.
- Specified by:
operateSelection
in classBasicPopulation<Individual>
-
operateCrossOver
public void operateCrossOver()This method recombines (cross over) the parents to generate new offsprings.The crossover type is selected based on crossoverType by user.
- Specified by:
operateCrossOver
in classBasicPopulation<Individual>
-
operateMutation
public void operateMutation()This method mutates new offsprings by changing the value of some genes in them.The mutation type is selected based on mutationType by user.
- Specified by:
operateMutation
in classBasicPopulation<Individual>
-
operateLocalSearch
public void operateLocalSearch()This method performs a local search strategy on each individual which is based on correlation of features. -
operateGenerationReplacement
public void operateGenerationReplacement()This method handles populations from one generation to the next generation.The replacement type is selected based on replacementType by user.
- Specified by:
operateGenerationReplacement
in classBasicPopulation<Individual>
-
getFittestIndividual
This method returns the fittest individual in the population- Specified by:
getFittestIndividual
in classBasicPopulation<Individual>
- Returns:
- the fittest individual in the population
-
getFitness
public double[] getFitness()This method returns an array of fitness values of individuals in a population- Specified by:
getFitness
in classBasicPopulation<Individual>
- Returns:
- an array of fitness values of individuals
-
determineSubsetSize
private int determineSubsetSize()This method determines the size of feature subset. The number of selected features in each individual is constant and defined by this value.- Returns:
- the determined value of the size of feature subset
-
computeCorrelation
private double[] computeCorrelation()This method computes the correlation of each feature to other features.- Returns:
- computed correlation of each feature to other features
-
setDataInfo
public void setDataInfo(double[][] data) This method sets the information of the dataset.- Parameters:
data
- the input dataset values
-