public class Regla
extends java.lang.Object
implements java.lang.Comparable
Title: Regla (Rule).
Description: This class implements a rule object for this subgroup dicovery algorithm. This class stores the antecedents and consequents.
Constructor and Description |
---|
Regla()
Default constructor.
|
Regla(int tam,
int nClases)
Parameter Constructor.
|
Regla(Item item,
int nClases)
Parameter Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
addAtributo(int i,
int a)
Adds a new antecedent (attribute + value).
|
void |
addPosicion(int i,
int pos)
Adds an attribute to the rule.
|
void |
adjuntaNombreAtributos(java.lang.String[] atributos)
Local copy of the name of variables
|
void |
ajusta(int[] cambio)
Local copy of the values of the attributes of the rule.
|
int |
compareTo(java.lang.Object o)
Compares the rule with the one given.
|
Regla |
copiaRegla()
Copy the rule
|
boolean |
cubre(Muestra m)
Checks if the rule covers the sample given.
|
int |
getAtributo(int i)
Returns the ith antecedent
|
int |
getClase()
Returns the rule class.
|
int[] |
getDistribucion()
Return the value of the distribution
|
int |
getDistribucionClase(int i)
Return the value of the distribution
|
double |
getHeuristica()
return the heuristic value of the rule
|
int |
getSupport()
Returns the support value of the rule.
|
void |
incremDistribClase(int i)
Add one to the n of the rule for the class
|
void |
print()
Prints the rule information on the standard output.
|
void |
printDistribucion()
Print the classes distribution for the rule
|
java.lang.String |
printDistribucionString()
Print the classes distribution for the rule
|
java.lang.String |
printString()
Returns a string with the rule information.
|
java.lang.String |
printSupport()
Returns the support of the rule as string.
|
void |
setClase(int i)
Sets the rule class with the value given.
|
void |
setDistrib(int[] distribucion)
Sets the given distribution.
|
void |
setHeuristicaWRAcc(double heu)
Assign a heuristic value (Wracc) to the rule
|
void |
setSupport(int s)
Sets the support value of the rule.
|
int |
size()
Returns the rule size (number of attributes/antecedents)
|
public Regla()
public Regla(int tam, int nClases)
tam
- int number of antecedentsnClases
- int number of classes of the problempublic Regla(Item item, int nClases)
item
- Item item used to build the rule.nClases
- int number of classes of the problempublic int compareTo(java.lang.Object o)
compareTo
in interface java.lang.Comparable
o
- Given rule to compare with.public Regla copiaRegla()
public void addAtributo(int i, int a)
i
- int given attribute index.a
- int given value of the attribute.public void addPosicion(int i, int pos)
i
- int index of the array.pos
- int attribute positionpublic int getAtributo(int i)
i
- int position in the rule.public int size()
public int getClase()
public void setClase(int i)
i
- given value to set the class.public void setSupport(int s)
s
- int given support value.public int getSupport()
public boolean cubre(Muestra m)
m
- given sample.public void print()
public java.lang.String printString()
public java.lang.String printSupport()
public void ajusta(int[] cambio)
Local copy of the values of the attributes of the rule.
cambio
- the new values (0 -> X, 1 -> Y...)public void adjuntaNombreAtributos(java.lang.String[] atributos)
Local copy of the name of variables
atributos
- String[] stores the name of the variablespublic void setHeuristicaWRAcc(double heu)
Assign a heuristic value (Wracc) to the rule
heu
- heuristic valuepublic double getHeuristica()
return the heuristic value of the rule
public void setDistrib(int[] distribucion)
distribucion
- int[] given distribution to set.public int[] getDistribucion()
Return the value of the distribution
public int getDistribucionClase(int i)
Return the value of the distribution
i
- int index of the classpublic void incremDistribClase(int i)
Add one to the n of the rule for the class
i
- int value of the classpublic void printDistribucion()
Print the classes distribution for the rule
public java.lang.String printDistribucionString()
Print the classes distribution for the rule