public class Individuo
extends java.lang.Object
implements java.lang.Comparable
Title: Individuo (Individual).
Description: This class implements an individual for the genetic algorithm, used to build the decision trees.
Constructor and Description |
---|
Individuo()
Default Constructor.
|
Individuo(boolean[] antecedentes,
java.lang.String clase,
myDataset train,
int codigo)
Paramenter constructor.
|
Individuo(Individuo padre,
Individuo madre,
int puntoCorte)
Create a new individual by crossing other two at the position given.
|
Individuo(myDataset train,
int pos_ejemplo)
Paramenter constructor.
|
Modifier and Type | Method and Description |
---|---|
double |
clasifica(int[] ejemplos,
int nEjemplos)
Computes and returns the fitness of the individual as the product of sensitivity and specificity of the given examples classification.
|
double |
clasificaLarge(int[] ejemplos,
int nEjemplos)
Computes and returns the fitness of the individual as the product of sensitivity and specificity of the given examples classification.
|
Individuo |
clone() |
int |
compareTo(java.lang.Object a) |
Regla |
convertir()
Converts the chromosome (individual) representation to a valid rule of the decision tree.
|
void |
mutar(double mutProb)
Mutates the individual with the given probability.
|
java.lang.String |
printString()
Returns a String representation of the Individual.
|
void |
pruning(double[] norm_acc)
Prune the individual using accuracy given as parameter.
|
void |
pruning(double infoG,
int nEjemplos,
int[] ejemplos)
Prune the individual using the information gain and the examples passed as argument.
|
int |
size()
Returns the size of the chromosome.
|
public Individuo()
public Individuo(boolean[] antecedentes, java.lang.String clase, myDataset train, int codigo)
antecedentes
- Selected antecedents (attributes).clase
- Class for the individual.train
- Training dataset.codigo
- Individual's code.public Individuo(myDataset train, int pos_ejemplo)
train
- Training dataset.pos_ejemplo
- Example used to build randomly the antecedents vector.public java.lang.String printString()
public Regla convertir()
public Individuo clone()
clone
in class java.lang.Object
public double clasifica(int[] ejemplos, int nEjemplos)
ejemplos
- examples indeces to be considered.nEjemplos
- number of examples.public double clasificaLarge(int[] ejemplos, int nEjemplos)
ejemplos
- examples indeces to be considered.nEjemplos
- number of examples.public int size()
public void mutar(double mutProb)
mutProb
- mutation probability.public void pruning(double infoG, int nEjemplos, int[] ejemplos)
infoG
- Information gain given.nEjemplos
- Number of examples considered.ejemplos
- Training examples considered.public void pruning(double[] norm_acc)
norm_acc
- Accuracies for each antedecent.public int compareTo(java.lang.Object a)
compareTo
in interface java.lang.Comparable