public class Poblacion
extends java.lang.Object
Title: Poblacion (Population).
Description: This class implements the population of chromosomes used to perform the genetic algorithm
Constructor and Description |
---|
Poblacion()
Default Constructor.
|
Poblacion(boolean[] ejemplosTr,
int nGenerations,
int popSize,
double crossProb,
double mutProb,
myDataset train,
double[] norm_acc)
Paramenter constructor.
|
Poblacion(int codigoRegla,
Regla r,
int nGenerations,
int popSize,
double crossProb,
double mutProb,
myDataset train,
java.lang.String clase)
Paramenter constructor.
|
Modifier and Type | Method and Description |
---|---|
boolean |
BETTER(double a,
double b)
Checks if the double a is greater than b.
|
java.util.ArrayList<Regla> |
dameReglas()
Returns the rules generated by the GA and stored on the chromosomes of the population.
|
void |
escogerEjemplos(boolean[] ejemplos)
Chooses the examples to be used as training whoses boolean value is true.
|
void |
GA_Large()
Performs the large GA to generate the different rules for the decision tree.
|
void |
GA_Small()
Performs the small GA to generate the different rules for the decision tree.
|
int |
numEjemplos(int clase)
Obtains the number of examples for the i-th class.
|
java.lang.String |
printString()
Returns a String representation of the population.
|
public Poblacion()
public Poblacion(int codigoRegla, Regla r, int nGenerations, int popSize, double crossProb, double mutProb, myDataset train, java.lang.String clase)
codigoRegla
- rule's code.r
- rule used to initialize the different chromosomes.nGenerations
- maximum number for generations.popSize
- population size.crossProb
- crossover probability.mutProb
- mutation probability.clase
- class for the population.train
- training dataset.public Poblacion(boolean[] ejemplosTr, int nGenerations, int popSize, double crossProb, double mutProb, myDataset train, double[] norm_acc)
ejemplosTr
- examples considered to be used as training.nGenerations
- maximum number for generations.popSize
- population size.crossProb
- crossover probability.mutProb
- mutation probability.train
- training dataset.norm_acc
- initial accuracies.public boolean BETTER(double a, double b)
a
- first given number.b
- second given number.public java.lang.String printString()
public void GA_Small()
public int numEjemplos(int clase)
clase
- int class position.public void escogerEjemplos(boolean[] ejemplos)
ejemplos
- given boolean vector containing the information of the selected examples.public void GA_Large()
public java.util.ArrayList<Regla> dameReglas()