public class Regla
extends java.lang.Object
Title: Regla (Rule)
Description:Rule class. Represents a rule extracted by the ACO algorithm.
Constructor and Description |
---|
Regla()
Default constructor.
|
Regla(Regla regla)
Copy Constructor.
|
Regla(java.util.Vector conjuntoAtributos,
Atributo claseOriginal)
Parameter Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
asignarCalidad(float original)
Assigns the given quality to the rule.
|
void |
asignarMuestrasCubiertas(float numero)
Sets the number of examples covered by the rule.
|
void |
copia(Regla regla)
Copies the rule given as argument.
|
boolean |
cubreMuestra(Muestra ejemplo)
Checks if the given example is covered by the whole rule
(covered by the conditions and with the same class of the rule).
|
boolean |
cubreMuestra(Muestra ejemplo,
java.util.Vector cVacias)
Checks if the given example is covered by the whole rule
(covered by the conditions and with the same class of the rule).
|
boolean |
cubreMuestraCondiciones(Muestra ejemplo,
java.util.Vector cVacias)
Checks if the given example is covered by the conditions stored
in the rule.
|
void |
eliminaCondicion(Condicion condicion)
Removes the condition passed as parameter.
|
void |
eliminaCondicion(int indice,
Condicion nueva)
Removes the condition with the index given and adds a new one
in that position.
|
void |
eliminaUltimaCondicion()
Removes the last condition.
|
boolean |
esIgual(Regla regla)
Checks if the rule is equal to the given one.
|
boolean |
estaCondicion(Condicion original)
Checks if the given condition is already in the example.
|
boolean |
estanCondicionesEn(Muestra mt)
Checks if in the sample, all the rule conditions are found.
|
boolean |
estanCondicionesEn(Muestra mt,
java.util.Vector cVacias)
Checks if in the sample, all the rule conditions are found.
|
void |
imprime(java.util.Vector cVacias)
Prints on the standard output the rule.
|
void |
imprimeFichero(java.io.PrintStream salida,
java.util.Vector cVacias)
Prints on the given file (PrintStream) the rule.
|
void |
insertaAtributos(java.util.Vector atributos)
Adds all the conditions given.
|
void |
insertaNumCondicionesReales(int numero)
Sets the number of real conditions.
|
void |
insertarClase(Atributo original)
Adds a class that identifies the rule with all its attributes.
|
void |
insertarCondicion(Condicion original)
Adds a condition (an attribute with its value and an operator).
|
java.util.Vector |
listaCondiciones()
Returns the list of conditions of the rule.
|
float |
obtenerCalidad()
Returns the quality of the rule.
|
static ComparadorRegla |
obtenerComparador()
Returns the rules comparative method.
|
float |
obtenerMuestrasCubiertas()
Returns the number of covered samples.
|
int |
obtenerNumCondiciones()
Returns the number of conditions in the rule.
|
int |
obtenerNumCondicionesReales()
Returns the number of real conditions.
|
Atributo |
obtenerReglaPredicha()
Returns the predicted class for the rule.
|
void |
ordenaCondiciones()
Sorts the rules in increasing order.
|
Atributo |
prediccion(Muestra mt,
java.util.Vector cVacias)
Returns the predicted class of the given sample it they have compatible conditions,
null otherwise.
|
boolean |
tieneValorAtributo(int atributo,
int operador)
Checks if the given attribute is already in the rule with a value
and the given operator.
|
public Regla()
public Regla(Regla regla)
regla
- rule to be copied.public Regla(java.util.Vector conjuntoAtributos, Atributo claseOriginal)
conjuntoAtributos
- Atributes values VectorclaseOriginal
- String class to set.public void insertarCondicion(Condicion original)
original
- Condition
condition to add.public void insertarClase(Atributo original)
original
- Atributo
class added to the rule.public void ordenaCondiciones()
public void asignarCalidad(float original)
original
- double Quality to assign.public void asignarMuestrasCubiertas(float numero)
numero
- int number of covered examples to be set.public boolean estaCondicion(Condicion original)
original
- given attribute to be checked.public boolean tieneValorAtributo(int atributo, int operador)
atributo
- given attribute to be checked.operador
- given operator to be checked.public Atributo prediccion(Muestra mt, java.util.Vector cVacias)
mt
- Muestra
given sample.cVacias
- Empty/Null conditions vector.public boolean cubreMuestra(Muestra ejemplo)
ejemplo
- given example to check.public boolean cubreMuestra(Muestra ejemplo, java.util.Vector cVacias)
ejemplo
- given example to check.cVacias
- Empty/Null conditions vector.public boolean cubreMuestraCondiciones(Muestra ejemplo, java.util.Vector cVacias)
ejemplo
- given example to check.cVacias
- Empty/Null conditions vector.public boolean estanCondicionesEn(Muestra mt)
mt
- Sample to check.public boolean estanCondicionesEn(Muestra mt, java.util.Vector cVacias)
mt
- Sample to check.cVacias
- Empty/Null conditions vector.public Atributo obtenerReglaPredicha()
public java.util.Vector listaCondiciones()
public float obtenerCalidad()
public void imprime(java.util.Vector cVacias)
cVacias
- Empty/Null conditions vector.public void imprimeFichero(java.io.PrintStream salida, java.util.Vector cVacias)
salida
- given file (PrintStream).cVacias
- Empty/Null conditions vector.public int obtenerNumCondiciones()
public void insertaAtributos(java.util.Vector atributos)
atributos
- Vector of conditions to add.public void eliminaCondicion(Condicion condicion)
condicion
- condition to be removed.public boolean esIgual(Regla regla)
regla
- Rule to compare with.public static ComparadorRegla obtenerComparador()
public void copia(Regla regla)
regla
- rule to be copied.public float obtenerMuestrasCubiertas()
public void eliminaCondicion(int indice, Condicion nueva)
indice
- given index where to remove and add.nueva
- New condition to add.public void eliminaUltimaCondicion()
public void insertaNumCondicionesReales(int numero)
numero
- number to set.public int obtenerNumCondicionesReales()