All Packages  Class Hierarchy  This Package  Previous  Next  Index  WEKA's home

Class weka.classifiers.DecisionTable

java.lang.Object
   |
   +----weka.classifiers.Classifier
           |
           +----weka.classifiers.DistributionClassifier
                   |
                   +----weka.classifiers.DecisionTable

public class DecisionTable
extends DistributionClassifier
implements OptionHandler, WeightedInstancesHandler
Class for building and using a simple decision table majority classifier. For more information see:

Kohavi R. (1995). The Power of Decision Tables. In Proc European Conference on Machine Learning.

Valid options are:

-S num
Number of fully expanded non improving subsets to consider before terminating a best first search. (Default = 5)

-X num
Use cross validation to evaluate features. Use number of folds = 1 for leave one out CV. (Default = leave one out CV)

-I
Use nearest neighbour instead of global table majority.

-R
Prints the decision table.

Version:
$Revision: 1.11 $
Author:
Mark Hall (mhall@cs.waikato.ac.nz)

Constructor Index

 o DecisionTable()
Constructor for a DecisionTable

Method Index

 o buildClassifier(Instances)
Generates the classifier.
 o distributionForInstance(Instance)
Calculates the class membership probabilities for the given test instance.
 o getCrossVal()
Gets the number of folds for cross validation
 o getDisplayRules()
Gets whether rules are being printed
 o getMaxStale()
Gets the number of non improving decision tables
 o getOptions()
Gets the current settings of the classifier.
 o getUseIBk()
Gets whether IBk is being used instead of the majority class
 o listOptions()
Returns an enumeration describing the available options
 o main(String[])
Main method for testing this class.
 o printFeatures()
Returns a string description of the features selected
 o setCrossVal(int)
Sets the number of folds for cross validation (1 = leave one out)
 o setDisplayRules(boolean)
Sets whether rules are to be printed
 o setMaxStale(int)
Sets the number of non improving decision tables to consider before abandoning the search.
 o setOptions(String[])
Parses the options for this object.
 o setUseIBk(boolean)
Sets whether IBk should be used instead of the majority class
 o toString()
Returns a description of the classifier.

Constructors

 o DecisionTable
 public DecisionTable()
Constructor for a DecisionTable

Methods

 o listOptions
 public Enumeration listOptions()
Returns an enumeration describing the available options

Returns:
an enumeration of all the available options
 o setCrossVal
 public void setCrossVal(int folds)
Sets the number of folds for cross validation (1 = leave one out)

Parameters:
folds - the number of folds
 o getCrossVal
 public int getCrossVal()
Gets the number of folds for cross validation

Returns:
the number of cross validation folds
 o setMaxStale
 public void setMaxStale(int stale)
Sets the number of non improving decision tables to consider before abandoning the search.

Parameters:
stale - the number of nodes
 o getMaxStale
 public int getMaxStale()
Gets the number of non improving decision tables

Returns:
the number of non improving decision tables
 o setUseIBk
 public void setUseIBk(boolean ibk)
Sets whether IBk should be used instead of the majority class

Parameters:
ibk - true if IBk is to be used
 o getUseIBk
 public boolean getUseIBk()
Gets whether IBk is being used instead of the majority class

Returns:
true if IBk is being used
 o setDisplayRules
 public void setDisplayRules(boolean rules)
Sets whether rules are to be printed

Parameters:
rules - true if rules are to be printed
 o getDisplayRules
 public boolean getDisplayRules()
Gets whether rules are being printed

Returns:
true if rules are being printed
 o setOptions
 public void setOptions(String options[]) throws Exception
Parses the options for this object. Valid options are:

-S num
Number of fully expanded non improving subsets to consider before terminating a best first search. (Default = 5)

-X num
Use cross validation to evaluate features. Use number of folds = 1 for leave one out CV. (Default = leave one out CV)

-I
Use nearest neighbour instead of global table majority.

-R
Prints the decision table.

Parameters:
options - the list of options as an array of strings
Throws: Exception
if an option is not supported
 o getOptions
 public String[] getOptions()
Gets the current settings of the classifier.

Returns:
an array of strings suitable for passing to setOptions
 o buildClassifier
 public void buildClassifier(Instances data) throws Exception
Generates the classifier.

Parameters:
data - set of instances serving as training data
Throws: Exception
if the classifier has not been generated successfully
Overrides:
buildClassifier in class Classifier
 o distributionForInstance
 public double[] distributionForInstance(Instance instance) throws Exception
Calculates the class membership probabilities for the given test instance.

Parameters:
instance - the instance to be classified
Returns:
predicted class probability distribution
Throws: Exception
if distribution can't be computed
Overrides:
distributionForInstance in class DistributionClassifier
 o printFeatures
 public String printFeatures()
Returns a string description of the features selected

Returns:
a string of features
 o toString
 public String toString()
Returns a description of the classifier.

Returns:
a description of the classifier as a string.
Overrides:
toString in class Object
 o main
 public static void main(String argv[])
Main method for testing this class.

Parameters:
argv - the command-line options

All Packages  Class Hierarchy  This Package  Previous  Next  Index  WEKA's home