public class RuleBase
extends java.lang.Object
Constructor and Description |
---|
RuleBase()
Default Constructor
|
RuleBase(DataBase dataBase,
myDataset train,
int K)
Parameters Constructor
|
Modifier and Type | Method and Description |
---|---|
void |
add(Rule rule)
It adds a rule to the rule base
|
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
|
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
|
int |
size()
It returns the number of rules in the rule base
|
void |
sort()
Function to sort the rule base
|
public RuleBase()
Default Constructor
public RuleBase(DataBase dataBase, myDataset train, int K)
Parameters Constructor
dataBase
- DataBase Set of training data which is necessary to generate a ruletrain
- myDataset Training data set with information to construct the rule base (mainly, the training examples)K
- int Number of best rules to use in predictionpublic void add(Rule rule)
It adds a rule to the rule base
rule
- Rule Rule to be addedpublic Rule get(int pos)
Function to get a rule from the rule base
pos
- int Position in the rule base where the desired rule is storedpublic 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
- int 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
- int[] Example to be classifiedpublic 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