public class DecisionTable extends Classifier implements OptionHandler, WeightedInstancesHandler, AdditionalMeasureProducer, TechnicalInformationHandler
@inproceedings{Kohavi1995, author = {Ron Kohavi}, booktitle = {8th European Conference on Machine Learning}, pages = {174-189}, publisher = {Springer}, title = {The Power of Decision Tables}, year = {1995} }Valid options are:
-S <search method specification> Full class name of search method, followed by its options. eg: "weka.attributeSelection.BestFirst -D 1" (default weka.attributeSelection.BestFirst)
-X <number of folds> Use cross validation to evaluate features. Use number of folds = 1 for leave one out CV. (Default = leave one out CV)
-E <acc | rmse | mae | auc> Performance evaluation measure to use for selecting attributes. (Default = accuracy for discrete class and rmse for numeric class)
-I Use nearest neighbour instead of global table majority.
-R Display decision table rules.
Options specific to search method weka.attributeSelection.BestFirst:
-P <start set> Specify a starting set of attributes. Eg. 1,3,5-7.
-D <0 = backward | 1 = forward | 2 = bi-directional> Direction of search. (default = 1).
-N <num> Number of non-improving nodes to consider before terminating search.
-S <num> Size of lookup cache for evaluated subsets. Expressed as a multiple of the number of attributes in the data set. (default = 1)
Modifier and Type | Field and Description |
---|---|
static int |
EVAL_ACCURACY |
static int |
EVAL_AUC |
static int |
EVAL_DEFAULT
default is accuracy for discrete class and RMSE for numeric class
|
static int |
EVAL_MAE |
static int |
EVAL_RMSE |
protected boolean |
m_classIsNominal
Class is nominal
|
protected double[] |
m_classPriorCounts
The class priors to use when there is no match in the table
|
protected double[] |
m_classPriors |
protected int[] |
m_decisionFeatures
Holds the final feature set
|
protected Remove |
m_delTransform
Filter used to remove columns discarded by feature selection
|
protected boolean |
m_displayRules
Display Rules
|
protected Filter |
m_disTransform
Discretization filter
|
protected Instances |
m_dtInstances
Holds the final feature selected set of instances
|
protected Hashtable |
m_entries
The hashtable used to hold training instances
|
protected Evaluation |
m_evaluation
The evaluation object used to evaluate subsets
|
protected int |
m_evaluationMeasure |
protected ASEvaluation |
m_evaluator
Our own internal evaluator
|
protected IBk |
m_ibk
IB1 used to classify non matching instances rather than majority class
|
protected double |
m_majority
Holds the majority class
|
protected int |
m_numAttributes
The number of attributes in the dataset
|
protected boolean |
m_saveMemory |
protected ASSearch |
m_search
The search method to use
|
protected Instances |
m_theInstances
Holds the original training instances
|
protected boolean |
m_useIBk
Use the IBk classifier rather than majority class
|
static Tag[] |
TAGS_EVALUATION |
m_Debug
Constructor and Description |
---|
DecisionTable()
Constructor for a DecisionTable
|
Modifier and Type | Method and Description |
---|---|
void |
buildClassifier(Instances data)
Generates the classifier.
|
String |
crossValTipText()
Returns the tip text for this property
|
String |
displayRulesTipText()
Returns the tip text for this property
|
double[] |
distributionForInstance(Instance instance)
Calculates the class membership probabilities for the given
test instance.
|
Enumeration |
enumerateMeasures()
Returns an enumeration of the additional measure names
|
protected double |
estimatePerformance(BitSet feature_set,
int num_atts)
Evaluates a feature subset by cross validation
|
String |
evaluationMeasureTipText()
Returns the tip text for this property
|
Capabilities |
getCapabilities()
Returns default capabilities of the classifier.
|
int |
getCrossVal()
Gets the number of folds for cross validation
|
boolean |
getDisplayRules()
Gets whether rules are being printed
|
SelectedTag |
getEvaluationMeasure()
Gets the currently set performance evaluation measure used for selecting
attributes for the decision table
|
double |
getMeasure(String additionalMeasureName)
Returns the value of the named measure
|
String[] |
getOptions()
Gets the current settings of the classifier.
|
String |
getRevision()
Returns the revision string.
|
ASSearch |
getSearch()
Gets the current search method
|
protected String |
getSearchSpec()
Gets the search specification string, which contains the class name of
the search method and any options to it
|
TechnicalInformation |
getTechnicalInformation()
Returns an instance of a TechnicalInformation object, containing
detailed information about the technical background of this class,
e.g., paper reference or book this class is based on.
|
boolean |
getUseIBk()
Gets whether IBk is being used instead of the majority class
|
String |
globalInfo()
Returns a string describing classifier
|
Enumeration |
listOptions()
Returns an enumeration describing the available options.
|
static void |
main(String[] argv)
Main method for testing this class.
|
double |
measureNumRules()
Returns the number of rules
|
String |
printFeatures()
Returns a string description of the features selected
|
protected void |
resetOptions()
Resets the options.
|
String |
searchTipText()
Returns the tip text for this property
|
void |
setCrossVal(int folds)
Sets the number of folds for cross validation (1 = leave one out)
|
void |
setDisplayRules(boolean rules)
Sets whether rules are to be printed
|
void |
setEvaluationMeasure(SelectedTag newMethod)
Sets the performance evaluation measure to use for selecting attributes
for the decision table
|
void |
setOptions(String[] options)
Parses the options for this object.
|
void |
setSearch(ASSearch search)
Sets the search method to use
|
protected void |
setUpEvaluator()
Sets up a dummy subset evaluator that basically just delegates
evaluation to the estimatePerformance method in DecisionTable
|
void |
setUseIBk(boolean ibk)
Sets whether IBk should be used instead of the majority class
|
String |
toString()
Returns a description of the classifier.
|
String |
useIBkTipText()
Returns the tip text for this property
|
classifyInstance, debugTipText, forName, getDebug, makeCopies, makeCopy, runClassifier, setDebug
protected Hashtable m_entries
protected double[] m_classPriorCounts
protected double[] m_classPriors
protected int[] m_decisionFeatures
protected Filter m_disTransform
protected Remove m_delTransform
protected IBk m_ibk
protected Instances m_theInstances
protected Instances m_dtInstances
protected int m_numAttributes
protected boolean m_classIsNominal
protected boolean m_useIBk
protected boolean m_displayRules
protected double m_majority
protected ASSearch m_search
protected ASEvaluation m_evaluator
protected Evaluation m_evaluation
public static final int EVAL_DEFAULT
public static final int EVAL_ACCURACY
public static final int EVAL_RMSE
public static final int EVAL_MAE
public static final int EVAL_AUC
public static final Tag[] TAGS_EVALUATION
protected int m_evaluationMeasure
protected boolean m_saveMemory
public String globalInfo()
public TechnicalInformation getTechnicalInformation()
getTechnicalInformation
in interface TechnicalInformationHandler
protected double estimatePerformance(BitSet feature_set, int num_atts) throws Exception
feature_set
- the subset to be evaluatednum_atts
- the number of attributes in the subsetException
- if subset can't be evaluatedprotected void resetOptions()
public Enumeration listOptions()
listOptions
in interface OptionHandler
listOptions
in class Classifier
public String crossValTipText()
public void setCrossVal(int folds)
folds
- the number of foldspublic int getCrossVal()
public String useIBkTipText()
public void setUseIBk(boolean ibk)
ibk
- true if IBk is to be usedpublic boolean getUseIBk()
public String displayRulesTipText()
public void setDisplayRules(boolean rules)
rules
- true if rules are to be printedpublic boolean getDisplayRules()
public String searchTipText()
public void setSearch(ASSearch search)
search
- public ASSearch getSearch()
public String evaluationMeasureTipText()
public SelectedTag getEvaluationMeasure()
public void setEvaluationMeasure(SelectedTag newMethod)
newMethod
- the new performance evaluation metric to usepublic void setOptions(String[] options) throws Exception
-S <search method specification> Full class name of search method, followed by its options. eg: "weka.attributeSelection.BestFirst -D 1" (default weka.attributeSelection.BestFirst)
-X <number of folds> Use cross validation to evaluate features. Use number of folds = 1 for leave one out CV. (Default = leave one out CV)
-E <acc | rmse | mae | auc> Performance evaluation measure to use for selecting attributes. (Default = accuracy for discrete class and rmse for numeric class)
-I Use nearest neighbour instead of global table majority.
-R Display decision table rules.
Options specific to search method weka.attributeSelection.BestFirst:
-P <start set> Specify a starting set of attributes. Eg. 1,3,5-7.
-D <0 = backward | 1 = forward | 2 = bi-directional> Direction of search. (default = 1).
-N <num> Number of non-improving nodes to consider before terminating search.
-S <num> Size of lookup cache for evaluated subsets. Expressed as a multiple of the number of attributes in the data set. (default = 1)
setOptions
in interface OptionHandler
setOptions
in class Classifier
options
- the list of options as an array of stringsException
- if an option is not supportedpublic String[] getOptions()
getOptions
in interface OptionHandler
getOptions
in class Classifier
protected String getSearchSpec()
public Capabilities getCapabilities()
getCapabilities
in interface CapabilitiesHandler
getCapabilities
in class Classifier
Capabilities
protected void setUpEvaluator() throws Exception
Exception
public void buildClassifier(Instances data) throws Exception
buildClassifier
in class Classifier
data
- set of instances serving as training dataException
- if the classifier has not been generated successfullypublic double[] distributionForInstance(Instance instance) throws Exception
distributionForInstance
in class Classifier
instance
- the instance to be classifiedException
- if distribution can't be computedpublic String printFeatures()
public double measureNumRules()
public Enumeration enumerateMeasures()
enumerateMeasures
in interface AdditionalMeasureProducer
public double getMeasure(String additionalMeasureName)
getMeasure
in interface AdditionalMeasureProducer
additionalMeasureName
- the name of the measure to query for its valueIllegalArgumentException
- if the named measure is not supportedpublic String toString()
public String getRevision()
getRevision
in interface RevisionHandler
getRevision
in class Classifier
public static void main(String[] argv)
argv
- the command-line optionsCopyright © 2015 University of Waikato, Hamilton, NZ. All rights reserved.