public class Rule
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static int |
EQUAL
number to indentify the operator =.
|
static int |
GREATER
number to indentify the operator >.
|
static int |
LOWER
number to indentify the operator <=.
|
Constructor and Description |
---|
Rule()
Constructs an empty rule.
|
Modifier and Type | Method and Description |
---|---|
int |
apply(MyDataset data)
It returns the number of the instances covered by the rule in a given dataset
|
int |
apply(MyDataset data,
Mask select)
Returns the number of the instances covered by the rule in a given dataset
|
int |
apply(MyDataset data,
Mask select,
int ignore)
Returns the number of the instances covered by the rule in a given dataset.
|
keel.Algorithms.Genetic_Rule_Learning.M5Rules.Stats |
apply(MyDataset data,
Mask positives,
Mask negatives)
It returns the number of true positives,true negatives,false positives and false negatives of the rule in a given dataset
|
Rule |
getCopy()
It returns a copy of this rule
|
Function |
getFunction()
It returns the right side (class) of the rule.
|
static double |
getMDL(MyDataset data,
int tp,
int tn,
int fp,
int fn)
Static version.
|
double |
getMDL(MyDataset data,
Mask positives,
Mask negatives)
Returns the Minimum Data Length of a dataset given a theory (this rule).
|
SimpleRule |
getSimpleRule(int i)
Returns the i-ieth simple rule of this rule.
|
void |
grow(int attribute,
double value,
int operator)
Adds a simple rule to this rule.
|
void |
grow(SimpleRule sr)
Adds a simple rule to this rule.
|
boolean |
isEqual(Rule r)
Return wether this rule is equal to another given rule
|
void |
prune(int pos)
Deletes a simple rule from this chain
|
void |
setFunction(Function new_function)
It sets the right side of the rule.
|
int |
size()
Returns the size (number of simple rules) of the rule
|
java.lang.String |
toString()
Returns a string representation of this Rule, containing the String representation of each SimpleRule.
|
public static int GREATER
public static int LOWER
public static int EQUAL
public int apply(MyDataset data, Mask select, int ignore)
data
- MyDataset the datasetselect
- Mask the mask with the active entries of the datasetignore
- int id of the single rule that it will be ignore in the applying of the rulepublic int apply(MyDataset data, Mask select)
data
- MyDataset the datasetselect
- Mask the mask with the active entries of the datasetpublic int apply(MyDataset data)
data
- MyDataset the datasetpublic keel.Algorithms.Genetic_Rule_Learning.M5Rules.Stats apply(MyDataset data, Mask positives, Mask negatives)
data
- MyDataset the datasetpositives
- active positive instances of datanegatives
- active negative instances of datapublic double getMDL(MyDataset data, Mask positives, Mask negatives)
data
- MyDataset the datasetspositives
- Mask active positive entries of datanegatives
- Mask active negative entries of datapublic static double getMDL(MyDataset data, int tp, int tn, int fp, int fn)
data
- MyDataset the datasetstp
- int true positivestn
- int true negativesfp
- int false positivesfn
- int false negativespublic SimpleRule getSimpleRule(int i)
i
- position of the simple rulepublic void grow(int attribute, double value, int operator)
attribute
- int attribute id (position of the attribute)value
- double attribute's valueoperator
- int rule operatorpublic void grow(SimpleRule sr)
sr
- SimpleRule the simple rulepublic void setFunction(Function new_function)
new_function
- double new class of the rulepublic Function getFunction()
public Rule getCopy()
public void prune(int pos)
pos
- int position of the simple rule of the rulepublic int size()
public boolean isEqual(Rule r)
r
- Rule the given rulepublic java.lang.String toString()
toString
in class java.lang.Object