Package weka.classifiers.trees
Class FT
java.lang.Object
weka.classifiers.Classifier
weka.classifiers.trees.FT
- All Implemented Interfaces:
Serializable
,Cloneable
,AdditionalMeasureProducer
,CapabilitiesHandler
,Drawable
,OptionHandler
,RevisionHandler
,TechnicalInformationHandler
public class FT
extends Classifier
implements OptionHandler, AdditionalMeasureProducer, Drawable, TechnicalInformationHandler
Classifier for building 'Functional trees', which are classification trees that could have logistic regression functions at the inner nodes and/or leaves. The algorithm can deal with binary and multi-class target variables, numeric and nominal attributes and missing values.
For more information see:
Joao Gama (2004). Functional Trees.
Niels Landwehr, Mark Hall, Eibe Frank (2005). Logistic Model Trees. BibTeX:
For more information see:
Joao Gama (2004). Functional Trees.
Niels Landwehr, Mark Hall, Eibe Frank (2005). Logistic Model Trees. BibTeX:
@article{Gama2004, author = {Joao Gama}, booktitle = {Machine Learning}, number = {3}, pages = {219-250}, title = {Functional Trees}, volume = {55}, year = {2004} } @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} }Valid options are:
-B Binary splits (convert nominal attributes to binary ones)
-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)
-F <modelType> Set Funtional Tree type to be generate: 0 for FT, 1 for FTLeaves and 2 for FTInner
-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.
- Version:
- $Revision: 5535 $
- Author:
- Jo\~{a}o Gama, Carlos Ferreira
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
model typesstatic final int
static final int
static final Tag[]
possible model types.Fields inherited from interface weka.core.Drawable
BayesNet, Newick, NOT_DRAWABLE, TREE
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns the tip text for this propertyvoid
buildClassifier
(Instances data) Builds the classifier.double
classifyInstance
(Instance instance) Classifies an instance.double[]
distributionForInstance
(Instance instance) Returns class probabilities for an instance.Returns an enumeration of the additional measure namesReturns the tip text for this propertyboolean
Get the value of binarySplits.Returns default capabilities of the classifier.boolean
Get the value of errorOnProbabilities.double
getMeasure
(String additionalMeasureName) Returns the value of the named measureint
Get the value of minNumInstances.Get the type of functional tree model being used.int
Get the value of numBoostingIterations.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.boolean
Get the value of useAIC.double
Get the value of weightTrimBeta.Returns a string describing classifiergraph()
Returns graph describing the tree.int
Returns the type of graph this classifier represents.Returns an enumeration describing the available options.static void
Main method for testing this classint
Returns the number of leaves in the treeint
Returns the size of the treeReturns the tip text for this propertyReturns the tip text for this propertyReturns the tip text for this propertyvoid
setBinSplit
(boolean c) Set the value of binarySplits.void
setErrorOnProbabilities
(boolean c) Set the value of errorOnProbabilities.void
setMinNumInstances
(int c) Set the value of minNumInstances.void
setModelType
(SelectedTag newMethod) Set the Functional Tree type.void
setNumBoostingIterations
(int c) Set the value of numBoostingIterations.void
setOptions
(String[] options) Parses a given list of options.void
setUseAIC
(boolean c) Set the value of useAIC.void
setWeightTrimBeta
(double n) Set the value of weightTrimBeta.toString()
Returns a description of the classifier.Returns the tip text for this propertyReturns the tip text for this propertyMethods inherited from class weka.classifiers.Classifier
debugTipText, forName, getDebug, makeCopies, makeCopy, setDebug
-
Field Details
-
MODEL_FT
public static final int MODEL_FTmodel types- See Also:
-
MODEL_FTLeaves
public static final int MODEL_FTLeaves- See Also:
-
MODEL_FTInner
public static final int MODEL_FTInner- See Also:
-
TAGS_MODEL
possible model types.
-
-
Constructor Details
-
FT
public FT()Creates an instance of FT with standard options
-
-
Method Details
-
getCapabilities
Returns default capabilities of the classifier.- Specified by:
getCapabilities
in interfaceCapabilitiesHandler
- Overrides:
getCapabilities
in classClassifier
- Returns:
- the capabilities of this classifier
- See Also:
-
buildClassifier
Builds the classifier.- Specified by:
buildClassifier
in classClassifier
- Parameters:
data
- the data to train with- Throws:
Exception
- if classifier can't be built successfully
-
distributionForInstance
Returns class probabilities for an instance.- Overrides:
distributionForInstance
in classClassifier
- Parameters:
instance
- the instance to compute the distribution for- Returns:
- the class probabilities
- Throws:
Exception
- if distribution can't be computed successfully
-
classifyInstance
Classifies an instance.- Overrides:
classifyInstance
in classClassifier
- Parameters:
instance
- the instance to classify- Returns:
- the classification
- Throws:
Exception
- if instance can't be classified successfully
-
toString
Returns a description of the classifier. -
listOptions
Returns an enumeration describing the available options.- Specified by:
listOptions
in interfaceOptionHandler
- Overrides:
listOptions
in classClassifier
- Returns:
- an enumeration of all the available options.
-
setOptions
Parses a given list of options. Valid options are:-B Binary splits (convert nominal attributes to binary ones)
-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)
-F <modelType> Set Funtional Tree type to be generate: 0 for FT, 1 for FTLeaves and 2 for FTInner
-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.
- Specified by:
setOptions
in interfaceOptionHandler
- Overrides:
setOptions
in classClassifier
- Parameters:
options
- the list of options as an array of strings- Throws:
Exception
- if an option is not supported
-
getOptions
Gets the current settings of the Classifier.- Specified by:
getOptions
in interfaceOptionHandler
- Overrides:
getOptions
in classClassifier
- 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.
-
getBinSplit
public boolean getBinSplit()Get the value of binarySplits.- Returns:
- Value of binarySplits.
-
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.
-
getModelType
Get the type of functional tree model being used.- Returns:
- the type of functional tree model.
-
setModelType
Set the Functional Tree type.- Parameters:
c
- Value corresponding to tree type.
-
getMinNumInstances
public int getMinNumInstances()Get the value of minNumInstances.- Returns:
- Value of minNumInstances.
-
setBinSplit
public void setBinSplit(boolean c) Set the value of binarySplits.- Parameters:
c
- Value to assign to binarySplits.
-
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. -
graph
Returns graph describing the tree. -
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
Returns an enumeration of the additional measure names- Specified by:
enumerateMeasures
in interfaceAdditionalMeasureProducer
- Returns:
- an enumeration of the measure names
-
getMeasure
Returns the value of the named measure- Specified by:
getMeasure
in 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:
getTechnicalInformation
in interfaceTechnicalInformationHandler
- Returns:
- the technical information about this class
-
modelTypeTipText
Returns the tip text for this property- Returns:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
binSplitTipText
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
-
numBoostingIterationsTipText
Returns the tip text for this property- Returns:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
minNumInstancesTipText
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
-
getRevision
Returns the revision string.- Specified by:
getRevision
in interfaceRevisionHandler
- Overrides:
getRevision
in classClassifier
- Returns:
- the revision
-
main
Main method for testing this class- Parameters:
argv
- the commandline options
-