weka.associations.classification
Class PruneCAR

java.lang.Object
  extended by weka.associations.classification.PruneCAR
All Implemented Interfaces:
java.io.Serializable, OptionHandler
Direct Known Subclasses:
CrTree

public abstract class PruneCAR
extends java.lang.Object
implements OptionHandler, java.io.Serializable

Abstract scheme for storing and pruning class associations. All schemes for storing and pruning class associations implemement this class

Version:
$Revision: 8108 $
Author:
Stefan Mutter (mutter@cs.waikato.ac.nz)
See Also:
Serialized Form

Constructor Summary
PruneCAR()
           
 
Method Summary
abstract  void deleteContent(CrNode node, int index)
          Deletes a consequence from a node
static PruneCAR forName(java.lang.String pruningName, java.lang.String[] options)
          Creates a new instance of a PruneCAR given it's class name and (optional) arguments to pass to it's setOptions method.
abstract  void insertContent(CrNode node, FastVector input)
          Inserts a consequence and the according interestingness measures into a node
abstract  boolean isEmpty()
          Tests if there are rules
abstract  void preprocess(FastVector premises, FastVector consequences, FastVector confidences)
          Preprocesses rules before inserting them into the structure
abstract  void prune()
          Prunes rules out of tree
abstract  void pruneBeforeInsertion(FastVector prem, FastVector cons)
          Pruning step before a rule is inserted into the structure
abstract  int prunedRules()
          Gets the number of pruned rules.
abstract  FastVector pruningCriterions(FastVector input)
          FastVector defining additional pruning criteria
abstract  void setInstancesNoClass(Instances instances)
          Sets the instances without the class attribute
abstract  void setInstancesOnlyClass(Instances instances)
          Sets the instances where all attributes except for the class attribute are deleted
abstract  java.lang.String toString(java.lang.String metricType)
          Outputs the rules
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface weka.core.OptionHandler
getOptions, listOptions, setOptions
 

Constructor Detail

PruneCAR

public PruneCAR()
Method Detail

isEmpty

public abstract boolean isEmpty()
Tests if there are rules

Returns:
true if there is no rule, false otherwise

setInstancesNoClass

public abstract void setInstancesNoClass(Instances instances)
Sets the instances without the class attribute

Parameters:
instances - the instances

setInstancesOnlyClass

public abstract void setInstancesOnlyClass(Instances instances)
Sets the instances where all attributes except for the class attribute are deleted

Parameters:
instances - the instances

preprocess

public abstract void preprocess(FastVector premises,
                                FastVector consequences,
                                FastVector confidences)
                         throws java.lang.Exception
Preprocesses rules before inserting them into the structure

Parameters:
premises - the premises
consequences - the consequences
confidences - the interestingness measures
Throws:
java.lang.Exception - throws eception if preprocessing is not possible

insertContent

public abstract void insertContent(CrNode node,
                                   FastVector input)
Inserts a consequence and the according interestingness measures into a node

Parameters:
node - the node
input - the consequence and the interestingness measures

deleteContent

public abstract void deleteContent(CrNode node,
                                   int index)
Deletes a consequence from a node

Parameters:
node - the node
index - the index of the consequence

pruningCriterions

public abstract FastVector pruningCriterions(FastVector input)
FastVector defining additional pruning criteria

Parameters:
input - the criteria
Returns:
FastVector

pruneBeforeInsertion

public abstract void pruneBeforeInsertion(FastVector prem,
                                          FastVector cons)
Pruning step before a rule is inserted into the structure

Parameters:
prem - the premise
cons - the consequence

prune

public abstract void prune()
Prunes rules out of tree


prunedRules

public abstract int prunedRules()
Gets the number of pruned rules.

Returns:
the number of pruned rules

toString

public abstract java.lang.String toString(java.lang.String metricType)
Outputs the rules

Parameters:
metricType - the metrci type of the sort order
Returns:
a string

forName

public static PruneCAR forName(java.lang.String pruningName,
                               java.lang.String[] options)
                        throws java.lang.Exception
Creates a new instance of a PruneCAR given it's class name and (optional) arguments to pass to it's setOptions method. If the associator implements OptionHandler and the options parameter is non-null, the associator will have it's options set.

Parameters:
pruningName - the fully qualified class name of the PruneCAR
options - an array of options suitable for passing to setOptions. May be null.
Returns:
the newly created PruneCAR, ready for use.
Throws:
java.lang.Exception - if the PruneC>R name is invalid, or the options supplied are not acceptable to the PruneCAR