public class Rule
extends java.lang.Object
implements java.lang.Comparable
Codifies a Fuzzy Rule
Constructor and Description |
---|
Rule(DataBase dataBase,
int typeEvaluation)
Constructor with parameters
|
Rule(Rule r)
Copy Constructor
|
Modifier and Type | Method and Description |
---|---|
void |
asignAntecedent(int[] antecedent)
It assings the ancedent of the Rule
|
Rule |
clone()
It carries out a copy of the current rule
|
int |
compareTo(java.lang.Object a)
Compares the fitness of two rules for the ordering procedure
|
double |
compatibility(double[] example)
It computes the compatibility degree of an example for this rule
|
void |
computeConsequent(myDataset train)
Procedure to compute the best consequent for a given rule
|
double |
evaluation(myDataset train)
Evaluates the rule for computing its fitness
|
int |
getActive()
It returns the activation of this rule
|
int |
getClas()
It returns the class of the rule
|
int |
getPosActive(int value)
It returns the number of valid labels for the rule until a given position
|
boolean |
isActive(int pos)
It returns if a given condition is active or not
|
boolean |
isNew()
It returns if the rule is new or not
|
int |
lengthRule()
It returns the length of the rule
|
void |
offNew()
Sets this rule as "non-new"
|
void |
onNew()
Sets this rule as new
|
void |
setClass(int clas)
Sets the class for the rule
|
void |
setConsequent(myDataset train)
It sets the class for this rule
|
void |
setLabel(int pos,
int label)
It sets a new label for the rule
|
public Rule(Rule r)
r
- Rule the rule to be copiedpublic Rule(DataBase dataBase, int typeEvaluation)
dataBase
- DataBase the DBtypeEvaluation
- int a code for the compatibility degre computationpublic void asignAntecedent(int[] antecedent)
antecedent
- int[] An array containing the fuzzy labelspublic Rule clone()
clone
in class java.lang.Object
public void computeConsequent(myDataset train)
train
- myDataset the tranning setpublic double evaluation(myDataset train)
train
- myDataset the trianing setpublic void setClass(int clas)
clas
- int the class idpublic void setConsequent(myDataset train)
train
- myDataset the training setpublic double compatibility(double[] example)
example
- double[] the examplepublic void onNew()
public void offNew()
public boolean isNew()
public int getClas()
public int getActive()
public int getPosActive(int value)
value
- int the position of the rulepublic int lengthRule()
public boolean isActive(int pos)
pos
- int the positionpublic void setLabel(int pos, int label)
pos
- int the position in the antecedentlabel
- int the label idpublic int compareTo(java.lang.Object a)
compareTo
in interface java.lang.Comparable
a
- Object a Rule