|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectweka.associations.classification.PruneCAR
weka.associations.classification.CrTree
weka.associations.classification.JCBAPruning
public class JCBAPruning
Class implemting the pruning step of the CBA algorithm using a CrTree. The Tree Structure is described in: W. Li, J. Han, J.Pei: CMAR: Accurate and Efficient Classification Based on Multiple Class-Association Rules. In ICDM'01:369-376,2001. The CBA algorithm is described in: B. Liu, W. Hsu, Y. Ma: Integrating Classification and Association Rule Mining. In KDD'98:80-86,1998. Valid options are:
-C the confidence value
The confidence value for the optional pessimistic-error-rate-based pruning step (default: 0.25).
-N
If set no pessimistic-error-rate-based pruning is performed.
Constructor Summary | |
---|---|
JCBAPruning()
Constructor |
Method Summary | |
---|---|
static double |
addErrs(double N,
double e,
float CF)
Computes estimated pessimistic error rate for given total number of instances and error using normal approximation to binomial distribution (and continuity correction). |
int |
calculateDefaultClass(Instances RemainingClassInstances)
Calculates the default class as the majority class in the instances |
double |
calculateError(FastVector premise,
FastVector consequence)
Calculates the pessimistic error rate of a rule |
int |
getClassValue(int index)
Gets the consequence (the class label) of a rule as an integer value. |
java.lang.String[] |
getOptions()
Gets the current settings of the Apriori object. |
FastVector |
getPrecedenceList()
Gets the sorted list (according to the interestingness measure) of all rules. |
int |
getStopIndex()
Gets the number of rules that should be used for classification |
void |
insertContent(CrNode node,
FastVector input)
Insert the consequence and the interestingness measures of a rule and builds up the precedence information that allows a ranking according to the interestingness measures |
java.util.Enumeration |
listOptions()
Returns an enumeration describing the available options. |
int |
numClassRules()
The number of rules in the tree. |
int |
numMinedRules()
Gets the number of rules after the mining process that tried to get inserted into the CrTree |
int |
numPrunedRules()
Gets the number of rules left after the (optional) pessimistic-error-rate-based pruning step. |
void |
optPruning(boolean flag,
float value)
Sets optional pruning on or off and its confidence value |
void |
preprocess(FastVector premises,
FastVector consequences,
FastVector confidences)
The preprocessing step before a rule is inserted into a CrTree. |
void |
prune()
Method that implements the obligatory pruning step |
void |
pruneBeforeInsertion(FastVector premise,
FastVector consequence)
Performs the (optional) pessimistic-error.rate-based pruning step. |
void |
resetOptions()
Resets the options to the default values. |
void |
setDefaultClass(int i)
Sets the default class in each step during obligatory pruning. |
void |
setInstances(Instances instances)
Sets the instances (including the class attribute) |
void |
setOptions(java.lang.String[] options)
Parses a given list of options. |
java.lang.String |
toString(java.lang.String metricString)
Returns a string description of the rule set stored in the tree |
Methods inherited from class weka.associations.classification.CrTree |
---|
deleteContent, deleteNode, getAssociateList, getDefaultClass, getRoot, insertNode, isEmpty, makeEmpty, pathToString, prunedRules, pruningCriterions, removeAtChild, removeAtList, removeAtSibling, reportSubtreeCount, rulePremise, search, setDefaultClass, setInstancesNoClass, setInstancesOnlyClass, sortItemSet, updateHeight |
Methods inherited from class weka.associations.classification.PruneCAR |
---|
forName |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public JCBAPruning()
Method Detail |
---|
public void resetOptions()
public void pruneBeforeInsertion(FastVector premise, FastVector consequence)
pruneBeforeInsertion
in class CrTree
premise
- the rule premiseconsequence
- the consequence and interestingness measurespublic void insertContent(CrNode node, FastVector input)
insertContent
in class CrTree
node
- the node in the tree where the consequence should be insertedinput
- the consequencepublic double calculateError(FastVector premise, FastVector consequence)
premise
- the premiseconsequence
- the consequence
public static double addErrs(double N, double e, float CF)
N
- number of instancese
- observed errorCF
- confidence value
public void preprocess(FastVector premises, FastVector consequences, FastVector confidences) throws java.lang.Exception
preprocess
in class CrTree
premises
- the premisesconsequences
- the consequencesconfidences
- the interestingness measures
java.lang.Exception
- throws exception if preprocessing is not possiblepublic void prune()
prune
in class CrTree
public int getStopIndex()
public FastVector getPrecedenceList()
public int getClassValue(int index)
index
- the rank of the rule in the sort order induced by the interestingness measure.
public void setInstances(Instances instances)
instances
- the instances for which class association rules are mined.public int calculateDefaultClass(Instances RemainingClassInstances)
RemainingClassInstances
- the set of instances
public void setDefaultClass(int i)
i
- -1, if the default class is the majority class in the data
the index of the rule in the sort order induced by the interestingness measure, if the default class is set during obligatory pruning.public java.lang.String[] getOptions()
getOptions
in interface OptionHandler
getOptions
in class CrTree
public java.util.Enumeration listOptions()
listOptions
in interface OptionHandler
listOptions
in class CrTree
public void setOptions(java.lang.String[] options) throws java.lang.Exception
-C the confidence value
The confidence value for the optional pessimistic-error-rate-based pruning step (default: 0.25).
-N
If set no pessimistic-error-rate-based pruning is performed.
setOptions
in interface OptionHandler
setOptions
in class CrTree
options
- the list of options as an array of strings
java.lang.Exception
- if an option is not supportedpublic void optPruning(boolean flag, float value)
value
- the confidence valueflag
- flag indicating whether optional pruning should be on or offpublic java.lang.String toString(java.lang.String metricString)
toString
in class CrTree
metricString
- the metric used as interestingness measure
public int numMinedRules()
public int numPrunedRules()
public int numClassRules()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |