public class SimpleLogistic extends AbstractClassifier implements OptionHandler, AdditionalMeasureProducer, WeightedInstancesHandler, TechnicalInformationHandler
@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).
BATCH_SIZE_DEFAULT, NUM_DECIMAL_PLACES_DEFAULT
Constructor and Description |
---|
SimpleLogistic()
Constructor for creating SimpleLogistic object with standard options.
|
SimpleLogistic(int numBoostingIterations,
boolean useCrossValidation,
boolean errorOnProbabilities)
Constructor for creating SimpleLogistic object.
|
Modifier and Type | Method and Description |
---|---|
void |
buildClassifier(Instances data)
Builds the logistic regression using LogitBoost.
|
double[] |
distributionForInstance(Instance inst)
Returns class probabilities for an instance.
|
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
|
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<Option> |
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
|
java.lang.String |
numDecimalPlacesTipText()
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
|
batchSizeTipText, classifyInstance, debugTipText, distributionsForInstances, doNotCheckCapabilitiesTipText, forName, getBatchSize, getDebug, getDoNotCheckCapabilities, getNumDecimalPlaces, implementsMoreEfficientBatchPrediction, makeCopies, makeCopy, postExecution, preExecution, run, runClassifier, setBatchSize, setDebug, setDoNotCheckCapabilities, setNumDecimalPlaces
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
makeCopy
public SimpleLogistic()
public SimpleLogistic(int numBoostingIterations, boolean useCrossValidation, boolean errorOnProbabilities)
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 errorpublic static void main(java.lang.String[] argv)
argv
- commandline optionspublic Capabilities getCapabilities()
getCapabilities
in interface Classifier
getCapabilities
in interface CapabilitiesHandler
getCapabilities
in class AbstractClassifier
Capabilities
public void buildClassifier(Instances data) throws java.lang.Exception
buildClassifier
in interface Classifier
data
- the training datajava.lang.Exception
- if something goes wrongpublic double[] distributionForInstance(Instance inst) throws java.lang.Exception
distributionForInstance
in interface Classifier
distributionForInstance
in class AbstractClassifier
inst
- the instance to compute the probabilities forjava.lang.Exception
- if distribution can't be computed successfullypublic java.util.Enumeration<Option> listOptions()
listOptions
in interface OptionHandler
listOptions
in class AbstractClassifier
public java.lang.String[] getOptions()
getOptions
in interface OptionHandler
getOptions
in class AbstractClassifier
public void setOptions(java.lang.String[] options) throws java.lang.Exception
-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).
setOptions
in interface OptionHandler
setOptions
in class AbstractClassifier
options
- the list of options as an array of stringsjava.lang.Exception
- if an option is not supportedpublic int getNumBoostingIterations()
public void setNumBoostingIterations(int n)
n
- the number of boosting iterationspublic boolean getUseCrossValidation()
public void setUseCrossValidation(boolean l)
l
- whether to use cross-validationpublic boolean getErrorOnProbabilities()
public void setErrorOnProbabilities(boolean l)
l
- If true, use minimize error on probabilities instead of
misclassification errorpublic int getMaxBoostingIterations()
public void setMaxBoostingIterations(int n)
n
- the maximum number of boosting iterationspublic int getHeuristicStop()
public void setHeuristicStop(int n)
n
- the value of heuristicStoppublic double getWeightTrimBeta()
public void setWeightTrimBeta(double n)
public boolean getUseAIC()
public void setUseAIC(boolean c)
c
- Value to assign to useAIC.public int getNumRegressions()
public java.lang.String toString()
toString
in class java.lang.Object
public double measureAttributesUsed()
public java.util.Enumeration<java.lang.String> enumerateMeasures()
enumerateMeasures
in interface AdditionalMeasureProducer
public double getMeasure(java.lang.String additionalMeasureName)
getMeasure
in interface AdditionalMeasureProducer
additionalMeasureName
- the name of the measure to query for its valuejava.lang.IllegalArgumentException
- if the named measure is not supportedpublic java.lang.String globalInfo()
public TechnicalInformation getTechnicalInformation()
getTechnicalInformation
in interface TechnicalInformationHandler
public java.lang.String numBoostingIterationsTipText()
public java.lang.String useCrossValidationTipText()
public java.lang.String errorOnProbabilitiesTipText()
public java.lang.String maxBoostingIterationsTipText()
public java.lang.String heuristicStopTipText()
public java.lang.String weightTrimBetaTipText()
public java.lang.String useAICTipText()
public java.lang.String numDecimalPlacesTipText()
numDecimalPlacesTipText
in class AbstractClassifier
public java.lang.String getRevision()
getRevision
in interface RevisionHandler
getRevision
in class AbstractClassifier