Package weka.classifiers.functions
Class SimpleLogistic
java.lang.Object
weka.classifiers.AbstractClassifier
weka.classifiers.functions.SimpleLogistic
- All Implemented Interfaces:
Serializable,Cloneable,Classifier,AdditionalMeasureProducer,BatchPredictor,CapabilitiesHandler,CapabilitiesIgnorer,CommandlineRunnable,OptionHandler,RevisionHandler,TechnicalInformationHandler,WeightedInstancesHandler
public class SimpleLogistic
extends AbstractClassifier
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:
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: 15520 $
- Author:
- Niels Landwehr, Marc Sumner
- See Also:
-
Field Summary
Fields inherited from class weka.classifiers.AbstractClassifier
BATCH_SIZE_DEFAULT, NUM_DECIMAL_PLACES_DEFAULT -
Constructor Summary
ConstructorsConstructorDescriptionConstructor for creating SimpleLogistic object with standard options.SimpleLogistic(int numBoostingIterations, boolean useCrossValidation, boolean errorOnProbabilities) Constructor for creating SimpleLogistic object. -
Method Summary
Modifier and TypeMethodDescriptionvoidbuildClassifier(Instances data) Builds the logistic regression using LogitBoost.double[]Returns class probabilities for an instance.Returns an enumeration of the additional measure namesReturns the tip text for this propertyReturns default capabilities of the classifier.booleanGet the value of errorOnProbabilities.intGet the value of heuristicStop.intGet the value of maxBoostingIterations.doublegetMeasure(String additionalMeasureName) Returns the value of the named measureintGet the value of numBoostingIterations.intGet the number of LogitBoost iterations performed (= the number of regression functions fit by LogitBoost).String[]Gets the current settings of the Classifier.Returns the revision string.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.booleanGet the value of useAIC.booleanGet the value of useCrossValidation.doubleGet the value of weightTrimBeta.Returns a string describing classifierReturns the tip text for this propertyReturns an enumeration describing the available options.static voidMain method for testing this classReturns the tip text for this propertydoubleReturns the fraction of all attributes in the data that are used in the logistic model (in percent).Returns the tip text for this propertyReturns the tip text for this propertyvoidsetErrorOnProbabilities(boolean l) Set the value of errorOnProbabilities.voidsetHeuristicStop(int n) Set the value of heuristicStop.voidsetMaxBoostingIterations(int n) Set the value of maxBoostingIterations.voidsetNumBoostingIterations(int n) Set the value of numBoostingIterations.voidsetOptions(String[] options) Parses a given list of options.voidsetUseAIC(boolean c) Set the value of useAIC.voidsetUseCrossValidation(boolean l) Set the value of useCrossValidation.voidsetWeightTrimBeta(double n) Set the value of weightTrimBeta.toString()Returns a description of the logistic model (attributes/coefficients).Returns the tip text for this propertyReturns the tip text for this propertyReturns the tip text for this propertyMethods inherited from class weka.classifiers.AbstractClassifier
batchSizeTipText, classifyInstance, debugTipText, distributionsForInstances, doNotCheckCapabilitiesTipText, forName, getBatchSize, getDebug, getDoNotCheckCapabilities, getNumDecimalPlaces, implementsMoreEfficientBatchPrediction, makeCopies, makeCopy, postExecution, preExecution, run, runClassifier, setBatchSize, setDebug, setDoNotCheckCapabilities, setNumDecimalPlaces
-
Constructor Details
-
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 LogitBoostuseCrossValidation- cross-validate number of LogitBoost iterations.errorOnProbabilities- minimize error on probabilities instead of misclassification error
-
-
Method Details
-
main
Main method for testing this class- Parameters:
argv- commandline options
-
getCapabilities
Returns default capabilities of the classifier.- Specified by:
getCapabilitiesin interfaceCapabilitiesHandler- Specified by:
getCapabilitiesin interfaceClassifier- Overrides:
getCapabilitiesin classAbstractClassifier- Returns:
- the capabilities of this classifier
- See Also:
-
buildClassifier
Builds the logistic regression using LogitBoost.- Specified by:
buildClassifierin interfaceClassifier- Parameters:
data- the training data- Throws:
Exception- if something goes wrong
-
distributionForInstance
Returns class probabilities for an instance.- Specified by:
distributionForInstancein interfaceClassifier- Overrides:
distributionForInstancein classAbstractClassifier- Parameters:
inst- the instance to compute the probabilities for- Returns:
- the probabilities
- Throws:
Exception- if distribution can't be computed successfully
-
listOptions
Returns an enumeration describing the available options.- Specified by:
listOptionsin interfaceOptionHandler- Overrides:
listOptionsin classAbstractClassifier- Returns:
- an enumeration of all the available options.
-
getOptions
Gets the current settings of the Classifier.- Specified by:
getOptionsin interfaceOptionHandler- Overrides:
getOptionsin classAbstractClassifier- Returns:
- an array of strings suitable for passing to setOptions
-
setOptions
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:
setOptionsin interfaceOptionHandler- Overrides:
setOptionsin classAbstractClassifier- Parameters:
options- the list of options as an array of strings- Throws:
Exception- if an option is not supported
-
getNumBoostingIterations
public int getNumBoostingIterations()Get the value of numBoostingIterations.- Returns:
- the number of boosting iterations
-
setNumBoostingIterations
public void setNumBoostingIterations(int n) Set the value of numBoostingIterations.- Parameters:
n- the number of boosting iterations
-
getUseCrossValidation
public boolean getUseCrossValidation()Get the value of useCrossValidation.- Returns:
- true if cross-validation is used
-
setUseCrossValidation
public void setUseCrossValidation(boolean l) Set the value of useCrossValidation.- Parameters:
l- whether to use cross-validation
-
getErrorOnProbabilities
public boolean getErrorOnProbabilities()Get the value of errorOnProbabilities.- Returns:
- If true, use minimize error on probabilities instead of misclassification error
-
setErrorOnProbabilities
public void setErrorOnProbabilities(boolean l) Set the value of errorOnProbabilities.- Parameters:
l- 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
-
setMaxBoostingIterations
public void setMaxBoostingIterations(int n) Set the value of maxBoostingIterations.- Parameters:
n- the maximum number of boosting iterations
-
getHeuristicStop
public int getHeuristicStop()Get the value of heuristicStop.- Returns:
- the value of heuristicStop
-
setHeuristicStop
public void setHeuristicStop(int n) Set the value of heuristicStop.- Parameters:
n- the value of heuristicStop
-
getWeightTrimBeta
public double getWeightTrimBeta()Get the value of weightTrimBeta. -
setWeightTrimBeta
public void setWeightTrimBeta(double n) Set the value of weightTrimBeta. -
getUseAIC
public boolean getUseAIC()Get the value of useAIC.- Returns:
- Value of useAIC.
-
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
Returns a description of the logistic model (attributes/coefficients). -
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
Returns an enumeration of the additional measure names- Specified by:
enumerateMeasuresin interfaceAdditionalMeasureProducer- Returns:
- an enumeration of the measure names
-
getMeasure
Returns the value of the named measure- Specified by:
getMeasurein interfaceAdditionalMeasureProducer- Parameters:
additionalMeasureName- the name of the measure to query for its value- Returns:
- the value of the named measure
- Throws:
IllegalArgumentException- if the named measure is not supported
-
globalInfo
Returns a string describing classifier- Returns:
- a description suitable for displaying in the explorer/experimenter gui
-
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:
getTechnicalInformationin interfaceTechnicalInformationHandler- Returns:
- the technical information about this class
-
numBoostingIterationsTipText
Returns the tip text for this property- Returns:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
useCrossValidationTipText
Returns the tip text for this property- Returns:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
errorOnProbabilitiesTipText
Returns the tip text for this property- Returns:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
maxBoostingIterationsTipText
Returns the tip text for this property- Returns:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
heuristicStopTipText
Returns the tip text for this property- Returns:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
weightTrimBetaTipText
Returns the tip text for this property- Returns:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
useAICTipText
Returns the tip text for this property- Returns:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
numDecimalPlacesTipText
Returns the tip text for this property- Overrides:
numDecimalPlacesTipTextin classAbstractClassifier- Returns:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
getRevision
Returns the revision string.- Specified by:
getRevisionin interfaceRevisionHandler- Overrides:
getRevisionin classAbstractClassifier- Returns:
- the revision
-