public class JCBAPruning extends CrTree implements weka.core.OptionHandler, java.io.Serializable
-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 and Description |
---|
JCBAPruning()
Constructor
|
Modifier and Type | Method and Description |
---|---|
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(weka.core.Instances RemainingClassInstances)
Calculates the default class as the majority class in the instances
|
double |
calculateError(weka.core.FastVector premise,
weka.core.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.
|
weka.core.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,
weka.core.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(java.util.ArrayList<java.lang.Object> premises,
java.util.ArrayList<java.lang.Object> consequences,
java.util.ArrayList<java.lang.Object> confidences)
The preprocessing step before a rule is inserted into a CrTree.
|
void |
prune()
Method that implements the obligatory pruning step
|
void |
pruneBeforeInsertion(weka.core.FastVector premise,
weka.core.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(weka.core.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
|
deleteContent, deleteNode, getAssociateList, getDefaultClass, getRoot, insertNode, isEmpty, makeEmpty, pathToString, prunedRules, pruningCriterions, removeAtChild, removeAtList, removeAtSibling, reportSubtreeCount, rulePremise, search, setDefaultClass, setInstancesNoClass, setInstancesOnlyClass, sortItemSet, updateHeight
public void resetOptions()
public void pruneBeforeInsertion(weka.core.FastVector premise, weka.core.FastVector consequence)
pruneBeforeInsertion
in class CrTree
premise
- the rule premiseconsequence
- the consequence and interestingness measurespublic void insertContent(CrNode node, weka.core.FastVector input)
insertContent
in class CrTree
node
- the node in the tree where the consequence should be insertedinput
- the consequencepublic double calculateError(weka.core.FastVector premise, weka.core.FastVector consequence)
premise
- the premiseconsequence
- the consequencepublic static double addErrs(double N, double e, float CF)
N
- number of instancese
- observed errorCF
- confidence valuepublic void preprocess(java.util.ArrayList<java.lang.Object> premises, java.util.ArrayList<java.lang.Object> consequences, java.util.ArrayList<java.lang.Object> confidences) throws java.lang.Exception
preprocess
in class CrTree
premises
- the premisesconsequences
- the consequencesconfidences
- the interestingness measuresjava.lang.Exception
- throws exception if preprocessing is not possiblepublic void prune()
public int getStopIndex()
public weka.core.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(weka.core.Instances instances)
instances
- the instances for which class association rules are mined.public int calculateDefaultClass(weka.core.Instances RemainingClassInstances)
RemainingClassInstances
- the set of instancespublic 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 weka.core.OptionHandler
getOptions
in class CrTree
public java.util.Enumeration listOptions()
listOptions
in interface weka.core.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 weka.core.OptionHandler
setOptions
in class CrTree
options
- the list of options as an array of stringsjava.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)
public int numMinedRules()
public int numPrunedRules()
public int numClassRules()