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 |
addReplace(Replace r)
Function to add a replace entry in the "Replace" list.
|
void |
asignaAntecedente(int[] antecedent)
It sets the rule's antecedent.
|
Rule |
clone()
Clone function.
|
int |
compareTo(java.lang.Object a)
Function to compare objects of the Rule class.
|
void |
decrCovered(int clas)
Function to decrease in 1 the number of examples whose output class is the given class "clas" and are covered by this rule.
|
int |
getClas()
It returns the output class of the rule.
|
int |
getclassCasesCovered(int clas)
It returns the number of examples covered by the rule for the class "class".
|
double |
getConfidence()
It returns the confidence of the rule.
|
int |
getMark()
It returns the mark of the rule.
|
int |
getnReplace()
It returns the size of the Replace list in the rule.
|
Replace |
getReplace(int pos)
It returns the Replace element of the rule in the position "pos".
|
double |
getSupport()
It returns the Support of the rule.
|
long |
getTime()
It returns the time of the rule.
|
void |
incrCovered(int clas)
Function to increase in 1 the number of examples whose output class is the given class "clas" and are covered by this rule.
|
boolean |
isEqual(Rule rule)
Function to check if a rule is equal to another given.
|
boolean |
isMark()
It returns if the rule is marked.
|
boolean |
isPrecedence(Rule r)
Function to know whether our rule has more precedence than another given or not.
|
boolean |
isSubset(Rule a)
Function to check whether our rule is subset of a given rule "a".
|
double |
matching(int[] example)
Function to check if a given example matchs with the rule (the rule correctly classifies it).
|
void |
offMark()
Function to unmark the rule.
|
void |
onMark()
Function to mark the rule.
|
void |
setConfidence(double conf)
It sets the rule's confidence.
|
void |
setConsequent(int clas)
It returns the rule's consequent.
|
void |
setLabel(int pos,
int label)
It sets the label for a given position in the antecedent (for a given attribute).
|
void |
setMark(int mark)
It sets the rule's mark.
|
void |
setSupport(double supp)
It sets the rule's support.
|
void |
setTime(long time)
It sets the time the rule was added to the rule set.
|
public Rule(Rule r)
r - Rule to be copiedpublic Rule(DataBase dataBase)
dataBase - Set of training data which is necessary to generate a rulepublic Rule clone()
clone in class java.lang.Objectpublic void asignaAntecedente(int[] antecedent)
antecedent - Array of values. Each position in the array represents an attribute.public void setConsequent(int clas)
clas - Consequent of the rulepublic double matching(int[] example)
example - Example to be classifiedpublic void addReplace(Replace r)
r - Element to be insertedpublic boolean isEqual(Rule rule)
rule - Rule to compare with ourspublic void setConfidence(double conf)
conf - double Confidence to be setpublic void setSupport(double supp)
supp - Support to be setpublic void setMark(int mark)
mark - Whether the rule is marked (1) or not (0)public double getConfidence()
public double getSupport()
public int getClas()
public long getTime()
public void setTime(long time)
time - long Time to be setpublic int getMark()
public void onMark()
public void offMark()
public int getnReplace()
public Replace getReplace(int pos)
pos - Position of the "replace element" we are looking forpublic boolean isMark()
public boolean isPrecedence(Rule r)
r - Given rule to comparepublic void incrCovered(int clas)
clas - Output class of the covered examplepublic void decrCovered(int clas)
clas - Output class of the covered examplepublic int getclassCasesCovered(int clas)
clas - Class to know how many examples with this class are covered by our rulepublic boolean isSubset(Rule a)
a - Given rule to comparepublic void setLabel(int pos,
int label)
pos - Location of the attribute which we want to set the labellabel - New label value to setpublic int compareTo(java.lang.Object a)
compareTo in interface java.lang.Comparablea - Rule object to compare with.