weka.associations.classification
Class PrecedencePruning

java.lang.Object
  extended by weka.associations.classification.PruneCAR
      extended by weka.associations.classification.CrTree
          extended by weka.associations.classification.JCBAPruning
              extended by weka.associations.classification.PrecedencePruning
All Implemented Interfaces:
java.io.Serializable, OptionHandler

public class PrecedencePruning
extends JCBAPruning
implements OptionHandler, java.io.Serializable

Class that allows a simple pessimistic-error-rate based pruning or omits pruning at all and just builds a CrTree with all mined rules. In addition to the CrTree a list containing information about the rule sorting is maintained (precedence list). This list allows investigating the sort oder of rules induced by the mining algorithm even when no pruning is performed. 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 optional pessimistic-error-rate-based pruning step 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.

Version:
$Revision: 8108 $
Author:
Stefan Mutter
See Also:
Serialized Form

Constructor Summary
PrecedencePruning()
          Constructor
 
Method Summary
 int getDefaultClass()
          Gets the default class
 java.lang.String[] getOptions()
          Gets options
 void insertContent(CrNode node, FastVector input)
          Insert consequence to a node and updates the precedence list
 java.util.Enumeration listOptions()
          Lists options
 int numClassRules()
          Gets the number of classification rules
 int numMinedRules()
          Gets the number of mined rules
 int numPrunedRules()
          Gets the number of rules after the optional pessimistic-error.rate-based pruning
 void preprocess(FastVector premises, FastVector consequences, FastVector confidences)
          Preprocesses a rule before it gets inserted into the tree.
 void prune()
          No pruning is perfomed (except of the optional pruning step in the preprocessing method).
 void setDefaultClass()
          Sets the default class as the majority class label of all instances
 void setNoPessPruning(boolean flag)
          Sets pessimistic-error-rate-based pruning
 void setOptions(java.lang.String[] options)
          Sets options
 java.lang.String toString(java.lang.String metricString, int numMinedRules)
          Outputs the CrTree
 
Methods inherited from class weka.associations.classification.JCBAPruning
addErrs, calculateDefaultClass, calculateError, getClassValue, getPrecedenceList, getStopIndex, optPruning, pruneBeforeInsertion, resetOptions, setDefaultClass, setInstances, toString
 
Methods inherited from class weka.associations.classification.CrTree
deleteContent, deleteNode, getAssociateList, getRoot, insertNode, isEmpty, makeEmpty, pathToString, prunedRules, pruningCriterions, removeAtChild, removeAtList, removeAtSibling, reportSubtreeCount, rulePremise, search, 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

PrecedencePruning

public PrecedencePruning()
Constructor

Method Detail

insertContent

public void insertContent(CrNode node,
                          FastVector input)
Insert consequence to a node and updates the precedence list

Overrides:
insertContent in class JCBAPruning
Parameters:
node - the node
input - the consequence and additional measures

preprocess

public void preprocess(FastVector premises,
                       FastVector consequences,
                       FastVector confidences)
                throws java.lang.Exception
Preprocesses a rule before it gets inserted into the tree. If set, pessimistic-error-rate based pruning is performed.

Overrides:
preprocess in class JCBAPruning
Parameters:
premises - the premises
consequences - the consequences
confidences - the metrices
Throws:
java.lang.Exception - throws exception is preprocessing is not possible.

prune

public void prune()
No pruning is perfomed (except of the optional pruning step in the preprocessing method).

Overrides:
prune in class JCBAPruning

setDefaultClass

public void setDefaultClass()
Sets the default class as the majority class label of all instances

Overrides:
setDefaultClass in class CrTree

getDefaultClass

public int getDefaultClass()
Gets the default class

Overrides:
getDefaultClass in class CrTree
Returns:
the default class

getOptions

public java.lang.String[] getOptions()
Gets options

Specified by:
getOptions in interface OptionHandler
Overrides:
getOptions in class JCBAPruning
Returns:
the options

listOptions

public java.util.Enumeration listOptions()
Lists options

Specified by:
listOptions in interface OptionHandler
Overrides:
listOptions in class JCBAPruning
Returns:
list of all available options

setNoPessPruning

public void setNoPessPruning(boolean flag)
Sets pessimistic-error-rate-based pruning

Parameters:
flag - true, if no pessimistic-error-rate-based pruning should be done, false otherwise

setOptions

public void setOptions(java.lang.String[] options)
                throws java.lang.Exception
Sets options

Specified by:
setOptions in interface OptionHandler
Overrides:
setOptions in class JCBAPruning
Parameters:
options - the options
Throws:
java.lang.Exception - exception if options cannot be set.

toString

public java.lang.String toString(java.lang.String metricString,
                                 int numMinedRules)
Outputs the CrTree

Parameters:
metricString - the metric used to mine class association rules
Returns:
the CrTree as a a string

numMinedRules

public int numMinedRules()
Gets the number of mined rules

Overrides:
numMinedRules in class JCBAPruning
Returns:
the number of mined rules

numPrunedRules

public int numPrunedRules()
Gets the number of rules after the optional pessimistic-error.rate-based pruning

Overrides:
numPrunedRules in class JCBAPruning
Returns:
the number of rules after the optional pessimistic-error.rate-based pruning

numClassRules

public int numClassRules()
Gets the number of classification rules

Overrides:
numClassRules in class JCBAPruning
Returns:
the number of classification rules