|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectweka.classifiers.rules.Ridor.RidorRule
This class implements a single rule that predicts the 2-class distribution. A rule consists of antecedents "AND"ed together and the consequent (class value) for the classification. In this case, the consequent is the distribution of the available classes (always 2 classes) in the dataset. In this class, the Information Gain (p*[log(p/t) - log(P/T)]) is used to select an antecedent and Reduced Error Prunning (REP) is used to prune the rule.
Field Summary | |
private double |
m_AccuG
The accurate and covered data of this rule in the growing data |
protected FastVector |
m_Antds
The vector of antecedents of this rule |
private double |
m_Class
The internal representation of the class label to be predicted |
private Attribute |
m_ClassAttribute
The class attribute of the data |
private double |
m_CoverG
The accurate and covered data of this rule in the growing data |
private double |
m_CoverP
The sum of weights of the data covered by this rule in the pruning data |
private double |
m_Worth
The worth value of this rule, in this case, accurate # in pruning data |
private double |
m_WorthRate
The worth rate of this rule, in this case, accuracy rate in the pruning data |
Constructor Summary | |
private |
Ridor.RidorRule()
|
Method Summary | |
void |
buildClassifier(Instances instances)
Builds a single rule learner with REP dealing with 2 classes. |
private double |
computeDefAccu(Instances data)
Private function to compute default number of accurate instances in the specified data for m_Class |
private Instances |
computeInfoGain(Instances instances,
double defAcRt,
Ridor.Antd antd)
Compute the best information gain for the specified antecedent |
Instances[] |
coveredByRule(Instances insts)
Find all the instances in the dataset covered by this rule. |
double |
getAccuG()
|
double |
getCoverG()
|
double |
getCoverP()
|
double |
getPredictedClass()
|
double |
getWorth()
|
double |
getWorthRate()
The following are get functions after prune() has set the value of worthRate and worth |
private void |
grow(Instances data)
Build one rule using the growing data |
boolean |
hasAntds()
Whether this rule has antecedents, i.e. whether it is a default rule |
boolean |
isCover(Instance datum)
Whether the instance covered by this rule |
private void |
prune(Instances pruneData)
Prune the rule using the pruning data and update the worth parameters for this rule The accuracy rate is used to prune the rule. |
void |
setPredictedClass(double cl)
The access functions for parameters |
java.lang.String |
toString()
Prints this rule |
java.lang.String |
toString(java.lang.String att,
java.lang.String cl)
Prints this rule with the specified class label |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
private double m_Class
private Attribute m_ClassAttribute
protected FastVector m_Antds
private double m_WorthRate
private double m_Worth
private double m_CoverP
private double m_CoverG
private double m_AccuG
Constructor Detail |
private Ridor.RidorRule()
Method Detail |
public void setPredictedClass(double cl)
public double getPredictedClass()
public void buildClassifier(Instances instances) throws java.lang.Exception
instances
- the training data
java.lang.Exception
- if classifier can't be built successfullypublic Instances[] coveredByRule(Instances insts)
insts
- the dataset to be covered by this rule.
public boolean isCover(Instance datum)
public boolean hasAntds()
private void grow(Instances data)
data
- the growing data used to build the ruleprivate Instances computeInfoGain(Instances instances, double defAcRt, Ridor.Antd antd)
defAcRt
- the default accuracy rate of dataantd
- the specific antecedent
private void prune(Instances pruneData)
pruneData
- the pruning data used to prune the ruleprivate double computeDefAccu(Instances data)
data
- the data in question
public double getWorthRate()
public double getWorth()
public double getCoverP()
public double getCoverG()
public double getAccuG()
public java.lang.String toString(java.lang.String att, java.lang.String cl)
att
- the string standing for attribute in the consequent of this rulecl
- the string standing for value in the consequent of this rule
public java.lang.String toString()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |