public class Individual
extends java.lang.Object
implements java.lang.Comparable
Constructor and Description |
---|
Individual(Individual padre)
Constructor (create the individual as a copy of another individual)
|
Individual(myDataset dataset,
double min_support,
double w1,
double w2)
Constructor
|
Modifier and Type | Method and Description |
---|---|
boolean |
applicableDropping(int atributos)
It check it is possible to apply the dropping condition operator, which only can be applied if
the number of "ANY" condition is the tree is less than number of input variables minus one.
|
void |
assignConditionNoAny(int atributo,
myDataset dataset)
It assigns a condition to the atribute in position "atributo", but different to "ANY"
|
void |
assignNewClass(myDataset dataset)
It changes the class in the consequent of the individual by a new one
|
int |
compareTo(java.lang.Object a)
Compares the fitness value of two individuals
|
void |
evaluate(myDataset dataset)
Evaluates (calculate the fitness of) the individual
|
java.lang.String |
getClase()
Returns the class in the consequent of the individual
|
Condition |
getCondition(int atributo)
It returns the condition for the variable in position "atributo"
|
double |
getFitness()
It returns the fitness of the individual
|
int |
ideal()
It returns the number of examples that the individual matches
|
boolean |
isAny(int atributo)
It checks is the condition for the variable in position "atributo" is equal to ANY
|
boolean |
isCovered(int idEjemplo)
It checks is the example in position "idEjemplo" is covered by the individual
|
boolean |
matching(double[] ejemplo,
boolean[] perdidos)
Determines if an example is covered by the individual
|
boolean |
non_evaluated()
It returns if the individual has been evaluated o not
|
java.lang.String |
printIndividual_bk()
Prints the tree encoded in the individual as a string
|
java.lang.String |
printIndividual()
Prints the tree encoded in the individual as a string
|
void |
replace(double[] example,
myDataset train)
It generates a tree that matches the given example
|
void |
setAny(int atributo,
java.lang.String nombre)
It sets the condition for the variable in position "atributo" to ANY
|
void |
setCondition(int atributo,
Condition c)
It sets to "c" the condition for the variable in position "atributo"
|
void |
setFitness(double fitness)
It sets the fitness of the individual to "fitness"
|
public Individual(myDataset dataset, double min_support, double w1, double w2)
Constructor
dataset
- myDataset Set of examplesmin_support
- double Minimun support parameter for the fitness functionw1
- double Weight of the Confidence factor in the fitness functionw2
- double Weight of the Support factor in the fitness functionpublic Individual(Individual padre)
Constructor (create the individual as a copy of another individual)
padre
- Individual The individual used to assign the values to the new onepublic boolean matching(double[] ejemplo, boolean[] perdidos)
Determines if an example is covered by the individual
ejemplo
- double[] Example to compareperdidos
- boolean [] True in those values of the example which are missing-valuespublic void evaluate(myDataset dataset)
Evaluates (calculate the fitness of) the individual
dataset
- myDataset Set of examplespublic java.lang.String getClase()
Returns the class in the consequent of the individual
public java.lang.String printIndividual_bk()
Prints the tree encoded in the individual as a string
public java.lang.String printIndividual()
Prints the tree encoded in the individual as a string
public boolean applicableDropping(int atributos)
It check it is possible to apply the dropping condition operator, which only can be applied if the number of "ANY" condition is the tree is less than number of input variables minus one.
atributos
- int Number of input variablespublic void assignConditionNoAny(int atributo, myDataset dataset)
It assigns a condition to the atribute in position "atributo", but different to "ANY"
atributo
- int The position of the attributedataset
- myDataset The set of examplespublic void assignNewClass(myDataset dataset)
It changes the class in the consequent of the individual by a new one
dataset
- myDataset The set of examplespublic void setAny(int atributo, java.lang.String nombre)
It sets the condition for the variable in position "atributo" to ANY
atributo
- int The position of the variablenombre
- String The name of the variablepublic Condition getCondition(int atributo)
It returns the condition for the variable in position "atributo"
atributo
- int The position of the variablepublic void setCondition(int atributo, Condition c)
It sets to "c" the condition for the variable in position "atributo"
atributo
- int The position of the variablec
- Condition Condition for the variablepublic boolean non_evaluated()
It returns if the individual has been evaluated o not
public int ideal()
It returns the number of examples that the individual matches
public void setFitness(double fitness)
It sets the fitness of the individual to "fitness"
fitness
- double A fitness valuepublic double getFitness()
It returns the fitness of the individual
public boolean isCovered(int idEjemplo)
It checks is the example in position "idEjemplo" is covered by the individual
idEjemplo
- example id (position)public boolean isAny(int atributo)
It checks is the condition for the variable in position "atributo" is equal to ANY
atributo
- attribute id.public void replace(double[] example, myDataset train)
It generates a tree that matches the given example
example
- double[] The given exampletrain
- myDataset The set of examplespublic int compareTo(java.lang.Object a)
Compares the fitness value of two individuals
compareTo
in interface java.lang.Comparable
a
- object to compare with.