public class RuleSet
extends java.lang.Object
implements java.lang.Comparable
This class represents a set of rules in the OIGA algorithm
Constructor and Description |
---|
RuleSet()
Default constructor.
|
RuleSet(int numberRules,
int numAtt)
Constructor for a fixed number of rules and attributes
|
RuleSet(RuleSet orig)
Deep-copy constructor
|
Modifier and Type | Method and Description |
---|---|
int |
classify(Instance inst)
Classifies an instance using the set of rules
|
double |
classify(InstanceSet ISet)
Classifies the instances of a data sets, and updates the fitness function as
the number of well classified instances
|
int |
compareTo(java.lang.Object o) |
void |
copyFromBegintoPoint(RuleSet rs,
int cutpoint_rule,
int cutpoint_variable)
Copies the rules from the beginning of the rule set to the selected cutpoint
|
void |
copyFromPointtoEnd(RuleSet rs,
int cutpoint_rule,
int cutpoint_variable)
Copies the rules from cutpoint to the end of the rule set
|
void |
createRules(int numberRules,
int numAtt)
Reset the current rules, and creates a new -clean- set
|
boolean |
equals(RuleSet rs)
Test if the fitness of the rule sets are equal
|
double |
getFitness()
Gets the fitness of this rule set
|
void |
IS3(int whichAtt)
Incremental Genetic Algorithm, which increases the size of the actual rule set
appending all the attributes from rs to the rules of the actual rule set.
|
void |
IS4(RuleSet rs)
Incremental Genetic Algorithm, which increases the size of the actual rule set
appending all the attributes from rs to the rules of the actual rule set.
|
boolean |
isEvaluated()
Test if the rule set is currently evaluated
|
void |
mutate(int gene)
Mutate a variable of the rule set (i.e. the activation, limits or class of a rule
from the rule set)
|
void |
randomizeRules(InstanceSet IS)
Initialize the set of rules
|
void |
setEvaluated(boolean eval)
Returns the evaluation state
|
public RuleSet()
Default constructor. No memory allocation
public RuleSet(int numberRules, int numAtt)
numberRules
- number of rules of the setnumAtt
- number of attributes of each rulepublic RuleSet(RuleSet orig)
orig
- the set of rules which will be copied over this setpublic void createRules(int numberRules, int numAtt)
numberRules
- number of rules of the setnumAtt
- number of attributes of each rulepublic void randomizeRules(InstanceSet IS)
IS
- train data set used for initializationpublic double classify(InstanceSet ISet)
ISet
- the data set that will be classifiedpublic int classify(Instance inst)
inst
- the instance that will be classifiedpublic void copyFromPointtoEnd(RuleSet rs, int cutpoint_rule, int cutpoint_variable)
rs
- rule set from which the rules will be copiedcutpoint_rule
- the rule in which there is the cutpointcutpoint_variable
- the variable (activation, limits or class) in which the cutpoint ispublic void copyFromBegintoPoint(RuleSet rs, int cutpoint_rule, int cutpoint_variable)
rs
- rule set from which the rules will be copiedcutpoint_rule
- the rule in which there is the cutpointcutpoint_variable
- the variable (activation, limits or class) in which the cutpoint ispublic void mutate(int gene)
gene
- the gene (variable) that will be mutatedpublic void IS3(int whichAtt)
whichAtt
- the rule set from which we will append the attributespublic void IS4(RuleSet rs)
rs
- the rule set from which we will append the attributespublic boolean isEvaluated()
public void setEvaluated(boolean eval)
eval
- the evaluation state (true or false) of this rule setpublic double getFitness()
public int compareTo(java.lang.Object o)
compareTo
in interface java.lang.Comparable
public boolean equals(RuleSet rs)
rs
- the rule set which will be compared to ours