weka.classifiers.trees
Class LMT

java.lang.Object
  extended byweka.classifiers.Classifier
      extended byweka.classifiers.trees.LMT
All Implemented Interfaces:
AdditionalMeasureProducer, java.lang.Cloneable, Drawable, OptionHandler, java.io.Serializable

public class LMT
extends Classifier
implements OptionHandler, AdditionalMeasureProducer, Drawable

Class for "logistic model tree" classifier. For more information, see master thesis "Logistic Model Trees" (Niels Landwehr, 2003)

Valid options are:

-B
Binary splits (convert nominal attributes to binary ones).

-R
Split on residuals instead of class values

-C
Use cross-validation for boosting at all nodes (i.e., disable heuristic)

-P
Use error on probabilities instead of misclassification error for stopping criterion of LogitBoost.

-I iterations
Set fixed number of iterations for LogitBoost (instead of using cross-validation).

-M numInstances
Set minimum number of instances at which a node can be split (default 15)

Version:
$Revision: 1.1 $
Author:
Niels Landwehr
See Also:
Serialized Form

Field Summary
protected  boolean m_convertNominal
          convert nominal attributes to binary ?
protected  boolean m_errorOnProbabilities
          use error on probabilties instead of misclassification for stopping criterion of LogitBoost?
protected  boolean m_fastRegression
          use heuristic that determines the number of LogitBoost iterations only once in the beginning?
protected  int m_minNumInstances
          minimum number of instances at which a node is considered for splitting
protected  NominalToBinary m_nominalToBinary
          Filter to replace nominal attributes
protected  int m_numBoostingIterations
          if non-zero, use fixed number of iterations for LogitBoost
protected  ReplaceMissingValues m_replaceMissing
          Filter to replace missing values
protected  boolean m_splitOnResiduals
          split on residuals?
protected  LMTNode m_tree
          root of the logistic model tree
 
Fields inherited from class weka.classifiers.Classifier
m_Debug
 
Fields inherited from interface weka.core.Drawable
BayesNet, NOT_DRAWABLE, TREE
 
Constructor Summary
LMT()
          Creates an instance of LMT with standard options
 
Method Summary
 void buildClassifier(Instances data)
          Builds the classifier.
 double classifyInstance(Instance instance)
          Classifies an instance.
 java.lang.String convertNominalTipText()
          Returns the tip text for this property
 double[] distributionForInstance(Instance instance)
          Returns class probabilities for an instance.
 java.util.Enumeration enumerateMeasures()
          Returns an enumeration of the additional measure names
 java.lang.String errorOnProbabilitiesTipText()
          Returns the tip text for this property
 java.lang.String fastRegressionTipText()
          Returns the tip text for this property
 boolean getConvertNominal()
          Get the value of convertNominal.
 boolean getErrorOnProbabilities()
          Get the value of errorOnProbabilities.
 boolean getFastRegression()
          Get the value of fastRegression.
 double getMeasure(java.lang.String additionalMeasureName)
          Returns the value of the named measure
 int getMinNumInstances()
          Get the value of minNumInstances.
 int getNumBoostingIterations()
          Get the value of numBoostingIterations.
 java.lang.String[] getOptions()
          Gets the current settings of the Classifier.
 boolean getSplitOnResiduals()
          Get the value of splitOnResiduals.
 java.lang.String globalInfo()
          Returns a string describing classifier
 java.lang.String graph()
          Returns graph describing the tree.
 int graphType()
          Returns the type of graph this classifier represents.
 java.util.Enumeration listOptions()
          Returns an enumeration describing the available options.
static void main(java.lang.String[] argv)
          Main method for testing this class
 int measureNumLeaves()
          Returns the number of leaves in the tree
 int measureTreeSize()
          Returns the size of the tree
 java.lang.String minNumInstancesTipText()
          Returns the tip text for this property
 java.lang.String numBoostingIterationsTipText()
          Returns the tip text for this property
 void setConvertNominal(boolean c)
          Set the value of convertNominal.
 void setErrorOnProbabilities(boolean c)
          Set the value of errorOnProbabilities.
 void setFastRegression(boolean c)
          Set the value of fastRegression.
 void setMinNumInstances(int c)
          Set the value of minNumInstances.
 void setNumBoostingIterations(int c)
          Set the value of numBoostingIterations.
 void setOptions(java.lang.String[] options)
          Parses a given list of options.
 void setSplitOnResiduals(boolean c)
          Set the value of splitOnResiduals.
 java.lang.String splitOnResidualsTipText()
          Returns the tip text for this property
 java.lang.String toString()
          Returns a description of the classifier.
 
Methods inherited from class weka.classifiers.Classifier
debugTipText, forName, getDebug, makeCopies, setDebug
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

m_replaceMissing

protected ReplaceMissingValues m_replaceMissing
Filter to replace missing values


m_nominalToBinary

protected NominalToBinary m_nominalToBinary
Filter to replace nominal attributes


m_tree

protected LMTNode m_tree
root of the logistic model tree


m_fastRegression

protected boolean m_fastRegression
use heuristic that determines the number of LogitBoost iterations only once in the beginning?


m_convertNominal

protected boolean m_convertNominal
convert nominal attributes to binary ?


m_splitOnResiduals

protected boolean m_splitOnResiduals
split on residuals?


m_errorOnProbabilities

protected boolean m_errorOnProbabilities
use error on probabilties instead of misclassification for stopping criterion of LogitBoost?


m_minNumInstances

protected int m_minNumInstances
minimum number of instances at which a node is considered for splitting


m_numBoostingIterations

protected int m_numBoostingIterations
if non-zero, use fixed number of iterations for LogitBoost

Constructor Detail

LMT

public LMT()
Creates an instance of LMT with standard options

Method Detail

buildClassifier

public void buildClassifier(Instances data)
                     throws java.lang.Exception
Builds the classifier.

Specified by:
buildClassifier in class Classifier
Parameters:
data - set of instances serving as training data
Throws:
java.lang.Exception - if classifier can't be built successfully

distributionForInstance

public double[] distributionForInstance(Instance instance)
                                 throws java.lang.Exception
Returns class probabilities for an instance.

Overrides:
distributionForInstance in class Classifier
Parameters:
instance - the instance to be classified
Returns:
an array containing the estimated membership probabilities of the test instance in each class or the numeric prediction
Throws:
java.lang.Exception - if distribution can't be computed successfully

classifyInstance

public double classifyInstance(Instance instance)
                        throws java.lang.Exception
Classifies an instance.

Overrides:
classifyInstance in class Classifier
Parameters:
instance - the instance to be classified
Returns:
the predicted most likely class for the instance or Instance.missingValue() if no prediction is made
Throws:
java.lang.Exception - if instance can't be classified successfully

toString

public java.lang.String toString()
Returns a description of the classifier.


listOptions

public java.util.Enumeration listOptions()
Returns an enumeration describing the available options.

Specified by:
listOptions in interface OptionHandler
Overrides:
listOptions in class Classifier
Returns:
an enumeration of all the available options.

setOptions

public void setOptions(java.lang.String[] options)
                throws java.lang.Exception
Parses a given list of options.

Specified by:
setOptions in interface OptionHandler
Overrides:
setOptions in class Classifier
Parameters:
options - the list of options as an array of strings
Throws:
java.lang.Exception - if an option is not supported

getOptions

public java.lang.String[] getOptions()
Gets the current settings of the Classifier.

Specified by:
getOptions in interface OptionHandler
Overrides:
getOptions in class Classifier
Returns:
an array of strings suitable for passing to setOptions

getConvertNominal

public boolean getConvertNominal()
Get the value of convertNominal.

Returns:
Value of convertNominal.

getSplitOnResiduals

public boolean getSplitOnResiduals()
Get the value of splitOnResiduals.

Returns:
Value of splitOnResiduals.

getFastRegression

public boolean getFastRegression()
Get the value of fastRegression.

Returns:
Value of fastRegression.

getErrorOnProbabilities

public boolean getErrorOnProbabilities()
Get the value of errorOnProbabilities.

Returns:
Value of errorOnProbabilities.

getNumBoostingIterations

public int getNumBoostingIterations()
Get the value of numBoostingIterations.

Returns:
Value of numBoostingIterations.

getMinNumInstances

public int getMinNumInstances()
Get the value of minNumInstances.

Returns:
Value of minNumInstances.

setConvertNominal

public void setConvertNominal(boolean c)
Set the value of convertNominal.

Parameters:
c - Value to assign to convertNominal.

setSplitOnResiduals

public void setSplitOnResiduals(boolean c)
Set the value of splitOnResiduals.

Parameters:
c - Value to assign to splitOnResiduals.

setFastRegression

public void setFastRegression(boolean c)
Set the value of fastRegression.

Parameters:
c - Value to assign to fastRegression.

setErrorOnProbabilities

public void setErrorOnProbabilities(boolean c)
Set the value of errorOnProbabilities.

Parameters:
c - Value to assign to errorOnProbabilities.

setNumBoostingIterations

public void setNumBoostingIterations(int c)
Set the value of numBoostingIterations.

Parameters:
c - Value to assign to numBoostingIterations.

setMinNumInstances

public void setMinNumInstances(int c)
Set the value of minNumInstances.

Parameters:
c - Value to assign to minNumInstances.

graphType

public int graphType()
Returns the type of graph this classifier represents.

Specified by:
graphType in interface Drawable
Returns:
Drawable.TREE

graph

public java.lang.String graph()
                       throws java.lang.Exception
Returns graph describing the tree.

Specified by:
graph in interface Drawable
Returns:
the graph described by a string
Throws:
java.lang.Exception - if graph can't be computed

measureTreeSize

public int measureTreeSize()
Returns the size of the tree

Returns:
the size of the tree

measureNumLeaves

public int measureNumLeaves()
Returns the number of leaves in the tree

Returns:
the number of leaves in the tree

enumerateMeasures

public java.util.Enumeration enumerateMeasures()
Returns an enumeration of the additional measure names

Specified by:
enumerateMeasures in interface AdditionalMeasureProducer
Returns:
an enumeration of the measure names

getMeasure

public double getMeasure(java.lang.String additionalMeasureName)
Returns the value of the named measure

Specified by:
getMeasure in interface AdditionalMeasureProducer
Parameters:
additionalMeasureName - the name of the measure to query for its value
Returns:
the value of the named measure
Throws:
java.lang.IllegalArgumentException - if the named measure is not supported

globalInfo

public java.lang.String globalInfo()
Returns a string describing classifier

Returns:
a description suitable for displaying in the explorer/experimenter gui

convertNominalTipText

public java.lang.String convertNominalTipText()
Returns the tip text for this property

Returns:
tip text for this property suitable for displaying in the explorer/experimenter gui

splitOnResidualsTipText

public java.lang.String splitOnResidualsTipText()
Returns the tip text for this property

Returns:
tip text for this property suitable for displaying in the explorer/experimenter gui

fastRegressionTipText

public java.lang.String fastRegressionTipText()
Returns the tip text for this property

Returns:
tip text for this property suitable for displaying in the explorer/experimenter gui

errorOnProbabilitiesTipText

public java.lang.String errorOnProbabilitiesTipText()
Returns the tip text for this property

Returns:
tip text for this property suitable for displaying in the explorer/experimenter gui

numBoostingIterationsTipText

public java.lang.String numBoostingIterationsTipText()
Returns the tip text for this property

Returns:
tip text for this property suitable for displaying in the explorer/experimenter gui

minNumInstancesTipText

public java.lang.String minNumInstancesTipText()
Returns the tip text for this property

Returns:
tip text for this property suitable for displaying in the explorer/experimenter gui

main

public static void main(java.lang.String[] argv)
                 throws java.lang.Exception
Main method for testing this class

Throws:
java.lang.Exception