public class RuleBase
extends java.lang.Object
Constructor and Description |
---|
RuleBase()
Default Constructor
|
RuleBase(DataBase dataBase,
myDataset train)
Parameters Constructor
|
Modifier and Type | Method and Description |
---|---|
void |
add(Itemset itemset,
long time)
It adds a rule to the rule base from an itemset and a time
|
void |
add(Rule rule)
It adds a rule to the rule base
|
void |
CBACBM2()
Classifier Builder (Method 2)
|
double |
evaluate()
Function to evaluate the whole rule base by using the training dataset
|
int |
FRM(int[] example)
It returns the class which better fits to the given example
|
Rule |
get(int pos)
Function to get a rule from the rule base
|
double |
getAccuracy()
It returns the accuracy of the rule base
|
RuleBase |
getClassifier()
Function to get stored classifier
|
java.lang.String |
printString()
It prints the whole rulebase
|
Rule |
remove(int pos)
It removes the rule stored in the given position
|
void |
saveFile(java.lang.String filename)
It stores the rule base in a given file
|
void |
setDefaultClass(int defaultClass)
It sets the default class for the rule base
|
int |
size()
It returns the number of rules in the rule base
|
void |
sort()
Function to sort the rule base
|
public void add(Rule rule)
It adds a rule to the rule base
rule
- Rule to be addedpublic void add(Itemset itemset, long time)
It adds a rule to the rule base from an itemset and a time
itemset
- Itemset to be translated to an array to insert it in the rule basetime
- Position in time when the rule has been addedpublic Rule get(int pos)
Function to get a rule from the rule base
pos
- Position in the rule base where the desired rule is storedpublic void setDefaultClass(int defaultClass)
It sets the default class for the rule base
defaultClass
- int Default class to setpublic int size()
It returns the number of rules in the rule base
public void sort()
Function to sort the rule base
public Rule remove(int pos)
It removes the rule stored in the given position
pos
- Position where the rule we want to remove ispublic double evaluate()
Function to evaluate the whole rule base by using the training dataset
public int FRM(int[] example)
It returns the class which better fits to the given example
example
- Example to be classifiedpublic double getAccuracy()
It returns the accuracy of the rule base
public void CBACBM2()
public RuleBase getClassifier()
Function to get stored classifier
public java.lang.String printString()
It prints the whole rulebase
public void saveFile(java.lang.String filename)
It stores the rule base in a given file
filename
- String Name for the rulebase file