weka.classifiers.trees

## Class LMT

- java.lang.Object
- - weka.classifiers.AbstractClassifier
  - - weka.classifiers.trees.LMT

- All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable, Classifier, AdditionalMeasureProducer, BatchPredictor, CapabilitiesHandler, CapabilitiesIgnorer, CommandlineRunnable, Drawable, OptionHandler, RevisionHandler, TechnicalInformationHandler

      public class LMT
      extends AbstractClassifier
      implements OptionHandler, AdditionalMeasureProducer, Drawable, TechnicalInformationHandler

  Classifier for building 'logistic model trees', which are classification trees with logistic regression functions at the leaves. The algorithm can deal with binary and multi-class target variables, numeric and nominal attributes and missing values.
  For more information see:
  Niels Landwehr, Mark Hall, Eibe Frank (2005). Logistic Model Trees. Machine Learning. 95(1-2):161-205.
  Marc Sumner, Eibe Frank, Mark Hall: Speeding up Logistic Model Tree Induction. In: 9th European Conference on Principles and Practice of Knowledge Discovery in Databases, 675-683, 2005.

  BibTeX:

       @article{Landwehr2005,
          author = {Niels Landwehr and Mark Hall and Eibe Frank},
          journal = {Machine Learning},
          number = {1-2},
          pages = {161-205},
          title = {Logistic Model Trees},
          volume = {95},
          year = {2005}
       }

       @inproceedings{Sumner2005,
          author = {Marc Sumner and Eibe Frank and Mark Hall},
          booktitle = {9th European Conference on Principles and Practice of Knowledge Discovery in Databases},
          pages = {675-683},
          publisher = {Springer},
          title = {Speeding up Logistic Model Tree Induction},
          year = {2005}
       }

  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 <numIterations>
        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)

       -W <beta>
        Set beta for weight trimming for LogitBoost. Set to 0 (default) for no weight trimming.

       -A
        The AIC is used to choose the best iteration.

       -doNotMakeSplitPointActualValue
        Do not make split point actual value.

  Version:
    $Revision: 11568 $
  Author:
    Niels Landwehr, Marc Sumner
  See Also:
    Serialized Form

- - ### Field Summary

    - ### Fields inherited from class weka.classifiers.AbstractClassifier

      `BATCH_SIZE_DEFAULT, NUM_DECIMAL_PLACES_DEFAULT`

    - ### Fields inherited from interface weka.core.Drawable

      `BayesNet, Newick, NOT_DRAWABLE, TREE`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `LMT()` Creates an instance of LMT with standard options

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `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.lang.String` | `doNotMakeSplitPointActualValueTipText()` Returns the tip text for this property
    `java.util.Enumeration<java.lang.String>` | `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
    `Capabilities` | `getCapabilities()` Returns default capabilities of the classifier.
    `boolean` | `getConvertNominal()` Get the value of convertNominal.
    `boolean` | `getDoNotMakeSplitPointActualValue()` Gets the value of doNotMakeSplitPointActualValue.
    `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.
    `java.lang.String` | `getRevision()` Returns the revision string.
    `boolean` | `getSplitOnResiduals()` Get the value of splitOnResiduals.
    `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` | `getUseAIC()` Get the value of useAIC.
    `double` | `getWeightTrimBeta()` Get the value of weightTrimBeta.
    `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<Option>` | `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
    `java.lang.String` | `numDecimalPlacesTipText()` Returns the tip text for this property
    `void` | `setConvertNominal(boolean c)` Set the value of convertNominal.
    `void` | `setDoNotMakeSplitPointActualValue(boolean m_doNotMakeSplitPointActualValue)` Sets the value of doNotMakeSplitPointActualValue.
    `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.
    `void` | `setUseAIC(boolean c)` Set the value of useAIC.
    `void` | `setWeightTrimBeta(double n)` Set the value of weightTrimBeta.
    `java.lang.String` | `splitOnResidualsTipText()` Returns the tip text for this property
    `java.lang.String` | `toString()` Returns a description of the classifier.
    `java.lang.String` | `useAICTipText()` Returns the tip text for this property
    `java.lang.String` | `weightTrimBetaTipText()` Returns the tip text for this property

    - ### Methods inherited from class weka.classifiers.AbstractClassifier

      `batchSizeTipText, debugTipText, distributionsForInstances, doNotCheckCapabilitiesTipText, forName, getBatchSize, getDebug, getDoNotCheckCapabilities, getNumDecimalPlaces, implementsMoreEfficientBatchPrediction, makeCopies, makeCopy, postExecution, preExecution, run, runClassifier, setBatchSize, setDebug, setDoNotCheckCapabilities, setNumDecimalPlaces`

    - ### Methods inherited from class java.lang.Object

      `equals, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### LMT

          public LMT()

      Creates an instance of LMT with standard options

  - ### Method Detail

    - #### getCapabilities

          public Capabilities getCapabilities()

      Returns default capabilities of the classifier.
      Specified by:
        `getCapabilities` in interface `Classifier`
      Specified by:
        `getCapabilities` in interface `CapabilitiesHandler`
      Overrides:
        `getCapabilities` in class `AbstractClassifier`
      Returns:
        the capabilities of this classifier
      See Also:
        `Capabilities`

    - #### buildClassifier

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

      Builds the classifier.
      Specified by:
        `buildClassifier` in interface `Classifier`
      Parameters:
        `data` - the data to train with
      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.
      Specified by:
        `distributionForInstance` in interface `Classifier`
      Overrides:
        `distributionForInstance` in class `AbstractClassifier`
      Parameters:
        `instance` - the instance to compute the distribution for
      Returns:
        the class probabilities
      Throws:
        `java.lang.Exception` - if distribution can't be computed successfully

    - #### classifyInstance

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

      Classifies an instance.
      Specified by:
        `classifyInstance` in interface `Classifier`
      Overrides:
        `classifyInstance` in class `AbstractClassifier`
      Parameters:
        `instance` - the instance to classify
      Returns:
        the classification
      Throws:
        `java.lang.Exception` - if instance can't be classified successfully

    - #### toString

          public java.lang.String toString()

      Returns a description of the classifier.
      Overrides:
        `toString` in class `java.lang.Object`
      Returns:
        a string representation of the classifier

    - #### listOptions

          public java.util.Enumeration<Option> listOptions()

      Returns an enumeration describing the available options.
      Specified by:
        `listOptions` in interface `OptionHandler`
      Overrides:
        `listOptions` in class `AbstractClassifier`
      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.

      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 <numIterations>
            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)

           -W <beta>
            Set beta for weight trimming for LogitBoost. Set to 0 (default) for no weight trimming.

           -A
            The AIC is used to choose the best iteration.

           -doNotMakeSplitPointActualValue
            Do not make split point actual value.

      Specified by:
        `setOptions` in interface `OptionHandler`
      Overrides:
        `setOptions` in class `AbstractClassifier`
      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 `AbstractClassifier`
      Returns:
        an array of strings suitable for passing to setOptions

    - #### getWeightTrimBeta

          public double getWeightTrimBeta()

      Get the value of weightTrimBeta.

    - #### getUseAIC

          public boolean getUseAIC()

      Get the value of useAIC.
      Returns:
        Value of useAIC.

    - #### setWeightTrimBeta

          public void setWeightTrimBeta(double n)

      Set the value of weightTrimBeta.

    - #### setUseAIC

          public void setUseAIC(boolean c)

      Set the value of useAIC.
      Parameters:
        `c` - Value to assign to useAIC.

    - #### 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 describing the tree
      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<java.lang.String> 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

    - #### getTechnicalInformation

          public 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.
      Specified by:
        `getTechnicalInformation` in interface `TechnicalInformationHandler`
      Returns:
        the technical information about this class

    - #### 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

    - #### weightTrimBetaTipText

          public java.lang.String weightTrimBetaTipText()

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

    - #### useAICTipText

          public java.lang.String useAICTipText()

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

    - #### doNotMakeSplitPointActualValueTipText

          public java.lang.String doNotMakeSplitPointActualValueTipText()

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

    - #### numDecimalPlacesTipText

          public java.lang.String numDecimalPlacesTipText()

      Returns the tip text for this property
      Overrides:
        `numDecimalPlacesTipText` in class `AbstractClassifier`
      Returns:
        tip text for this property suitable for displaying in the explorer/experimenter gui

    - #### getDoNotMakeSplitPointActualValue

          public boolean getDoNotMakeSplitPointActualValue()

      Gets the value of doNotMakeSplitPointActualValue.
      Returns:
        the value

    - #### setDoNotMakeSplitPointActualValue

          public void setDoNotMakeSplitPointActualValue(boolean m_doNotMakeSplitPointActualValue)

      Sets the value of doNotMakeSplitPointActualValue.
      Parameters:
        `m_doNotMakeSplitPointActualValue` - the value to set

    - #### getRevision

          public java.lang.String getRevision()

      Returns the revision string.
      Specified by:
        `getRevision` in interface `RevisionHandler`
      Overrides:
        `getRevision` in class `AbstractClassifier`
      Returns:
        the revision

    - #### main

          public static void main(java.lang.String[] argv)

      Main method for testing this class
      Parameters:
        `argv` - the commandline options