public class Rule
extends java.lang.Object
implements java.lang.Comparable
Constructor and Description |
---|
Rule()
Copy Constructor
|
Rule(DataBase dataBase)
Parameters Constructor
|
Rule(myDataset train,
DataBase dataBase,
int clas)
Parameters Constructor
|
Modifier and Type | Method and Description |
---|---|
void |
calculateLaplace(myDataset train)
Function to calculate the Laplace accuracy to our rule from a train dataset
|
Rule |
clone()
Clone function.
|
int |
compareTo(java.lang.Object a)
Function to compare objects of the Rule class.
|
int |
getClas()
It returns the output class of the rule
|
java.util.ArrayList<Literal> |
getGain(double min_gain,
PNArray A)
It returns an array of literals whose gain is higher than a minimum threshold
|
double |
getLaplace()
It returns the Laplace accuracy of the rule
|
int |
getnAnts()
It returns the number of antecedents of the rule
|
double |
matching(int[] example)
Function to check if a given example matchs with the rule (the rule correctly classifies it)
|
void |
setLabel(int pos,
int label)
It sets the label for a given position in the antecedent (for a given attribute)
|
public Rule()
Copy Constructor
public Rule(DataBase dataBase)
dataBase
- Set of training data which is necessary to generate a rulepublic Rule clone()
clone
in class java.lang.Object
public 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 double matching(int[] example)
Function to check if a given example matchs with the rule (the rule correctly classifies it)
example
- int[] Example to be classifiedpublic int getClas()
It returns the output class of the rule
public int getnAnts()
It returns the number of antecedents of the rule
public double getLaplace()
It returns the Laplace accuracy of the rule
public java.util.ArrayList<Literal> getGain(double min_gain, PNArray A)
It returns an array of literals whose gain is higher than a minimum threshold
min_gain
- double Minimum gain thresholdA
- PNArray Training dataset splitted in Possitive and Negative examplespublic void calculateLaplace(myDataset train)
Function to calculate the Laplace accuracy to our rule from a train dataset
train
- myDataset Dataset used to calculate Laplacepublic int compareTo(java.lang.Object a)
compareTo
in interface java.lang.Comparable
a
- Rule object to compare with.