public class Rule
extends java.lang.Object
implements java.lang.Comparable
Constructor and Description |
---|
Rule(DataBase dataBase)
Parameters Constructor
|
Rule(Rule r)
Copy Constructor
|
Modifier and Type | Method and Description |
---|---|
void |
asignaAntecedente(int[] antecedent)
It sets the antecedent of the rule
|
Rule |
clone()
Clone Function
|
int |
compareTo(java.lang.Object a)
Function to compare objects of the Rule class
Necessary to be able to use "sort" function
It sorts in an decreasing order of laplace accuracy
|
int |
getClas()
It returns the output class of the rule
|
double |
getConfidence()
It returns the Confidence of the rule
|
double |
getSupport()
It returns the support of the rule
|
boolean |
isSubset(Rule a)
Function to check if a given rule is a subrule of this rule
|
double |
matching(double[] example)
Function to check if a given example matchs with the rule (the rule correctly classifies it)
|
void |
setConfidence(double conf)
It sets the confidence of the rule
|
void |
setConsequent(int clas)
It sets the consequent of the rule
|
void |
setLabel(int pos,
int label)
It sets the label for a given position in the antecedent (for a given attribute)
|
void |
setSupport(double supp)
It sets the support of the rule
|
public Rule(Rule r)
Copy Constructor
r
- Rule Rule to be copiedpublic Rule(DataBase dataBase)
Parameters Constructor
dataBase
- DataBase Set of training data which is necessary to generate a rulepublic Rule clone()
Clone Function
clone
in class java.lang.Object
public void asignaAntecedente(int[] antecedent)
It sets the antecedent of the rule
antecedent
- int[] Antecedent of the rulepublic void setConsequent(int clas)
It sets the consequent of the rule
clas
- int Class of the rulepublic double matching(double[] example)
Function to check if a given example matchs with the rule (the rule correctly classifies it)
example
- int[] Example to be classifiedpublic void setConfidence(double conf)
It sets the confidence of the rule
conf
- confidence of the rulepublic void setSupport(double supp)
It sets the support of the rule
supp
- support of the rulepublic double getConfidence()
It returns the Confidence of the rule
public double getSupport()
It returns the support of the rule
public int getClas()
It returns the output class of the rule
public boolean isSubset(Rule a)
Function to check if a given rule is a subrule of this rule
a
- Rule Rule to be examinatedpublic void setLabel(int pos, int label)
pos
- int Location of the attribute which we want to set the labellabel
- int New label value to setpublic int compareTo(java.lang.Object a)
compareTo
in interface java.lang.Comparable
a
- Rule to compare with.