Overview | Package | Class | Tree | Deprecated | Index | Help | Weka's home

PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## weka.classifiers.functions
Class SimpleLogistic

    java.lang.Object
      weka.classifiers.Classifier
          weka.classifiers.functions.SimpleLogistic

All Implemented Interfaces:
  java.io.Serializable, java.lang.Cloneable, AdditionalMeasureProducer, CapabilitiesHandler, OptionHandler, RevisionHandler, TechnicalInformationHandler, WeightedInstancesHandler

    public class SimpleLogistic

extends Classifier
implements OptionHandler, AdditionalMeasureProducer, WeightedInstancesHandler, TechnicalInformationHandler

Classifier for building linear logistic regression models. LogitBoost with simple regression functions as base learners is used for fitting the logistic models. The optimal number of LogitBoost iterations to perform is cross-validated, which leads to automatic attribute selection. For more information see:
Niels Landwehr, Mark Hall, Eibe Frank (2005). Logistic Model Trees.
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},
        booktitle = {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:

     -I <iterations>
      Set fixed number of iterations for LogitBoost

     -S
      Use stopping criterion on training set (instead of
      cross-validation)

     -P
      Use error on probabilities (rmse) instead of
      misclassification error for stopping criterion

     -M <iterations>
      Set maximum number of boosting iterations

     -H <iterations>
      Set parameter for heuristic for early stopping of
      LogitBoost.
      If enabled, the minimum is selected greedily, stopping
      if the current minimum has not changed for iter iterations.
      By default, heuristic is enabled with value 50. Set to
      zero to disable heuristic.

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

     -A
      The AIC is used to choose the best iteration (instead of CV or training error).

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

Constructor Summary
`SimpleLogistic()` Constructor for creating SimpleLogistic object with standard options.
`SimpleLogistic(int numBoostingIterations, boolean useCrossValidation, boolean errorOnProbabilities)` Constructor for creating SimpleLogistic object.

Method Summary
`void` | `buildClassifier(Instances data)` Builds the logistic regression using LogitBoost.
`double[]` | `distributionForInstance(Instance inst)` 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
`Capabilities` | `getCapabilities()` Returns default capabilities of the classifier.
`boolean` | `getErrorOnProbabilities()` Get the value of errorOnProbabilities.
`int` | `getHeuristicStop()` Get the value of heuristicStop.
`int` | `getMaxBoostingIterations()` Get the value of maxBoostingIterations.
`double` | `getMeasure(java.lang.String additionalMeasureName)` Returns the value of the named measure
`int` | `getNumBoostingIterations()` Get the value of numBoostingIterations.
`int` | `getNumRegressions()` Get the number of LogitBoost iterations performed (= the number of regression functions fit by LogitBoost).
`java.lang.String[]` | `getOptions()` Gets the current settings of the Classifier.
`java.lang.String` | `getRevision()` Returns the revision string.
`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.
`boolean` | `getUseCrossValidation()` Get the value of useCrossValidation.
`double` | `getWeightTrimBeta()` Get the value of weightTrimBeta.
`java.lang.String` | `globalInfo()` Returns a string describing classifier
`java.lang.String` | `heuristicStopTipText()` Returns the tip text for this property
`java.util.Enumeration` | `listOptions()` Returns an enumeration describing the available options.
`static void` | `main(java.lang.String[] argv)` Main method for testing this class
`java.lang.String` | `maxBoostingIterationsTipText()` Returns the tip text for this property
`double` | `measureAttributesUsed()` Returns the fraction of all attributes in the data that are used in the logistic model (in percent).
`java.lang.String` | `numBoostingIterationsTipText()` Returns the tip text for this property
`void` | `setErrorOnProbabilities(boolean l)` Set the value of errorOnProbabilities.
`void` | `setHeuristicStop(int n)` Set the value of heuristicStop.
`void` | `setMaxBoostingIterations(int n)` Set the value of maxBoostingIterations.
`void` | `setNumBoostingIterations(int n)` Set the value of numBoostingIterations.
`void` | `setOptions(java.lang.String[] options)` Parses a given list of options.
`void` | `setUseAIC(boolean c)` Set the value of useAIC.
`void` | `setUseCrossValidation(boolean l)` Set the value of useCrossValidation.
`void` | `setWeightTrimBeta(double n)` Set the value of weightTrimBeta.
`java.lang.String` | `toString()` Returns a description of the logistic model (attributes/coefficients).
`java.lang.String` | `useAICTipText()` Returns the tip text for this property
`java.lang.String` | `useCrossValidationTipText()` Returns the tip text for this property
`java.lang.String` | `weightTrimBetaTipText()` Returns the tip text for this property

Methods inherited from class weka.classifiers.Classifier
`classifyInstance, debugTipText, forName, getDebug, makeCopies, makeCopy, setDebug`

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Constructor Detail

### SimpleLogistic

    public SimpleLogistic()

  Constructor for creating SimpleLogistic object with standard options.

### SimpleLogistic

    public SimpleLogistic(int numBoostingIterations,
                          boolean useCrossValidation,
                          boolean errorOnProbabilities)

  Constructor for creating SimpleLogistic object.

  Parameters:
    `numBoostingIterations` - if non-negative, use this as fixed number of iterations for LogitBoost
    `useCrossValidation` - cross-validate number of LogitBoost iterations.
    `errorOnProbabilities` - minimize error on probabilities instead of misclassification error

Method Detail

### getCapabilities

    public Capabilities getCapabilities()

  Returns default capabilities of the classifier.

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

### buildClassifier

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

  Builds the logistic regression using LogitBoost.

  Specified by:
    `buildClassifier` in class `Classifier`
  Parameters:
    `data` - the training data
  Throws:
    `java.lang.Exception` - if something goes wrong

### distributionForInstance

    public double[] distributionForInstance(Instance inst)
                                     throws java.lang.Exception

  Returns class probabilities for an instance.

  Overrides:
    `distributionForInstance` in class `Classifier`
  Parameters:
    `inst` - the instance to compute the probabilities for
  Returns:
    the probabilities
  Throws:
    `java.lang.Exception` - if distribution can't be computed successfully

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

  Valid options are:

       -I <iterations>
        Set fixed number of iterations for LogitBoost

       -S
        Use stopping criterion on training set (instead of
        cross-validation)

       -P
        Use error on probabilities (rmse) instead of
        misclassification error for stopping criterion

       -M <iterations>
        Set maximum number of boosting iterations

       -H <iterations>
        Set parameter for heuristic for early stopping of
        LogitBoost.
        If enabled, the minimum is selected greedily, stopping
        if the current minimum has not changed for iter iterations.
        By default, heuristic is enabled with value 50. Set to
        zero to disable heuristic.

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

       -A
        The AIC is used to choose the best iteration (instead of CV or training error).

  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

### getNumBoostingIterations

    public int getNumBoostingIterations()

  Get the value of numBoostingIterations.

  Returns:
    the number of boosting iterations

### getUseCrossValidation

    public boolean getUseCrossValidation()

  Get the value of useCrossValidation.

  Returns:
    true if cross-validation is used

### getErrorOnProbabilities

    public boolean getErrorOnProbabilities()

  Get the value of errorOnProbabilities.

  Returns:
    If true, use minimize error on probabilities instead of misclassification error

### getMaxBoostingIterations

    public int getMaxBoostingIterations()

  Get the value of maxBoostingIterations.

  Returns:
    the maximum number of boosting iterations

### getHeuristicStop

    public int getHeuristicStop()

  Get the value of heuristicStop.

  Returns:
    the value of heuristicStop

### getWeightTrimBeta

    public double getWeightTrimBeta()

  Get the value of weightTrimBeta.

### getUseAIC

    public boolean getUseAIC()

  Get the value of useAIC.

  Returns:
    Value of useAIC.

### setNumBoostingIterations

    public void setNumBoostingIterations(int n)

  Set the value of numBoostingIterations.

  Parameters:
    `n` - the number of boosting iterations

### setUseCrossValidation

    public void setUseCrossValidation(boolean l)

  Set the value of useCrossValidation.

  Parameters:
    `l` - whether to use cross-validation

### setErrorOnProbabilities

    public void setErrorOnProbabilities(boolean l)

  Set the value of errorOnProbabilities.

  Parameters:
    `l` - If true, use minimize error on probabilities instead of misclassification error

### setMaxBoostingIterations

    public void setMaxBoostingIterations(int n)

  Set the value of maxBoostingIterations.

  Parameters:
    `n` - the maximum number of boosting iterations

### setHeuristicStop

    public void setHeuristicStop(int n)

  Set the value of heuristicStop.

  Parameters:
    `n` - the value of heuristicStop

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

### getNumRegressions

    public int getNumRegressions()

  Get the number of LogitBoost iterations performed (= the number of regression functions fit by LogitBoost).

  Returns:
    the number of LogitBoost iterations performed

### toString

    public java.lang.String toString()

  Returns a description of the logistic model (attributes/coefficients).

  Overrides:
    `toString` in class `java.lang.Object`
  Returns:
    the model as string

### measureAttributesUsed

    public double measureAttributesUsed()

  Returns the fraction of all attributes in the data that are used in the logistic model (in percent). An attribute is used in the model if it is used in any of the models for the different classes.

  Returns:
    percentage of attributes used in the model

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

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

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

### useCrossValidationTipText

    public java.lang.String useCrossValidationTipText()

  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

### maxBoostingIterationsTipText

    public java.lang.String maxBoostingIterationsTipText()

  Returns the tip text for this property

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

### heuristicStopTipText

    public java.lang.String heuristicStopTipText()

  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

### getRevision

    public java.lang.String getRevision()

  Returns the revision string.

  Specified by:
    `getRevision` in interface `RevisionHandler`
  Overrides:
    `getRevision` in class `Classifier`
  Returns:
    the revision

### main

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

  Main method for testing this class

  Parameters:
    `argv` - commandline options

Overview | Package | Class | Tree | Deprecated | Index | Help | Weka's home

PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD