public abstract class FTtree extends LogisticBase
Modifier and Type | Field and Description |
---|---|
protected ClassifierSplitModel |
m_auxLocalModel
Auxiliary copy ClassifierSplitModel (for splitting)
|
protected float |
m_CF
Confidence level
|
protected double |
m_constError
Constructor error
|
protected boolean |
m_hasConstr
True if node has or splits on constructor
|
protected SimpleLinearRegression[][] |
m_higherRegressions
Simple regression functions fit by LogitBoost at higher levels in the tree
|
protected int |
m_id
Node id
|
protected boolean |
m_isLeaf
True if node is leaf
|
protected int |
m_leafclass
Stores leaf class value
|
protected int |
m_leafModelNum
ID of logistic model at leaf
|
protected ClassifierSplitModel |
m_localModel
The ClassifierSplitModel (for splitting)
|
protected int |
m_minNumInstances
minimum number of instances at which a node is considered for splitting
|
protected ModelSelection |
m_modelSelection
ModelSelection object (for splitting)
|
protected NominalToBinary |
m_nominalToBinary
Filter to convert nominal attributes to binary
|
protected int |
m_numHigherRegressions
Number of simple regression functions fit by LogitBoost at higher levels in the tree
|
protected int |
m_numInstances
Number of instances at the node
|
protected FTtree[] |
m_sons
Array of children of the node
|
protected double |
m_totalInstanceWeight
Total number of training instances.
|
m_errorOnProbabilities, m_fixedNumIterations, m_heuristicStop, m_maxIterations, m_numClasses, m_numericData, m_numericDataHeader, m_numFoldsBoosting, m_numParameters, m_numRegressions, m_regressions, m_train, m_useCrossValidation, m_weightTrimBeta, Z_MAX
m_Debug
Constructor and Description |
---|
FTtree() |
Modifier and Type | Method and Description |
---|---|
int |
assignIDs(int lastID)
Assigns unique IDs to all nodes in the tree
|
int |
assignLeafModelNumbers(int leafCounter)
Assigns numbers to the logistic regression models at the leaves of the tree
|
abstract void |
buildClassifier(Instances data)
Method for building a Functional Tree (only called for the root node).
|
abstract void |
buildTree(Instances data,
SimpleLinearRegression[][] higherRegressions,
double totalInstanceWeight,
double higherNumParameters)
Abstract method for building the tree structure.
|
void |
cleanup()
Cleanup in order to save memory.
|
abstract double[] |
distributionForInstance(Instance instance)
Returns the class probabilities for an instance given by the Functional tree.
|
protected void |
dumpTree(int depth,
StringBuffer text)
Help method for printing tree structure.
|
protected double[][] |
getCoefficients()
Returns an array containing the coefficients of the logistic regression function at this node.
|
int |
getConstError(double[] probsConst) |
protected double |
getEstimatedErrors()
Computes estimated errors for tree.
|
protected double |
getEstimatedErrorsForBranch(Instances data)
Computes estimated errors for one branch.
|
protected double |
getEstimatedErrorsForDistribution(Distribution theDistribution)
Computes estimated errors for leaf.
|
protected double |
getEtimateConstModel(Distribution theDistribution)
Computes estimated errors for Constructor Model.
|
protected double[] |
getFs(Instance instance)
Computes the F-values of LogitBoost for an instance from the current logistic model at the node
Note that this also takes into account the (partial) logistic model fit at higher levels in
the tree.
|
String |
getModelParameters()
Returns a string describing the number of LogitBoost iterations performed at this node, the total number
of LogitBoost iterations performed (including iterations at higher levels in the tree), and the number
of training examples at this node.
|
Vector |
getNodes()
Return a list of all inner nodes in the tree
|
void |
getNodes(Vector nodeList)
Fills a list with all inner nodes in the tree
|
protected Instances |
getNumericData(Instances train)
Returns a numeric version of a set of instances.
|
int |
getNumInnerNodes()
Method to count the number of inner nodes in the tree
|
int |
getNumLeaves()
Returns the number of leaves in the tree.
|
String |
getRevision()
Returns the revision string.
|
String |
graph()
Returns graph describing the tree.
|
protected void |
graphTree(StringBuffer text)
Helper function for graph description of tree
|
boolean |
hasModels()
Returns true if the logistic regression model at this node has changed compared to the
one at the parent node.
|
protected Instances |
insertNewAttr(Instances data)
Inserts new attributes in current dataset or instance
|
protected SimpleLinearRegression[][] |
mergeArrays(SimpleLinearRegression[][] a1,
SimpleLinearRegression[][] a2)
Merges two arrays of regression functions into one
|
double[] |
modelDistributionForInstance(Instance instance)
Returns the class probabilities for an instance according to the logistic model at the node.
|
String |
modelsToString()
Returns a string describing the logistic regression function at the node.
|
int |
numLeaves()
Returns the number of leaves (normal count).
|
int |
numNodes()
Returns the number of nodes.
|
abstract double |
prune()
Abstract Method that prunes a tree using C4.5 pruning procedure.
|
protected Instances |
removeExtAttributes(Instances data)
Removes extended attributes in current dataset or instance
|
String |
toString()
Returns a description of the Functional tree (tree structure and logistic models)
|
getBestIteration, getErrorRate, getFs, getMaxIterations, getMeanAbsoluteError, getNumRegressions, getProbs, getUseAIC, getUsedAttributes, getWeightTrimBeta, getWs, getYs, getZ, getZs, initRegressions, negativeLogLikelihood, percentAttributesUsed, performBoosting, performBoosting, performBoosting, performBoostingCV, performBoostingInfCriterion, performIteration, probs, selectRegressions, setHeuristicStop, setMaxIterations, setUseAIC, setWeightTrimBeta
classifyInstance, debugTipText, forName, getCapabilities, getDebug, getOptions, listOptions, makeCopies, makeCopy, runClassifier, setDebug, setOptions
protected double m_totalInstanceWeight
protected int m_id
protected int m_leafModelNum
protected int m_minNumInstances
protected ModelSelection m_modelSelection
protected NominalToBinary m_nominalToBinary
protected SimpleLinearRegression[][] m_higherRegressions
protected int m_numHigherRegressions
protected int m_numInstances
protected ClassifierSplitModel m_localModel
protected ClassifierSplitModel m_auxLocalModel
protected FTtree[] m_sons
protected int m_leafclass
protected boolean m_isLeaf
protected boolean m_hasConstr
protected double m_constError
protected float m_CF
public abstract void buildClassifier(Instances data) throws Exception
buildClassifier
in class LogisticBase
data
- the data to train withException
- if something goes wrongpublic abstract void buildTree(Instances data, SimpleLinearRegression[][] higherRegressions, double totalInstanceWeight, double higherNumParameters) throws Exception
data
- the training data passed on to this nodehigherRegressions
- An array of regression functions produced by LogitBoost at higher
levels in the tree. They represent a logistic regression model that is refined locally
at this node.totalInstanceWeight
- the total number of training exampleshigherNumParameters
- effective number of parameters in the logistic regression model built
in parent nodesException
- if something goes wrongpublic abstract double prune() throws Exception
Exception
- if something goes wrongprotected Instances insertNewAttr(Instances data) throws Exception
Exception
- if something goes wrongprotected Instances removeExtAttributes(Instances data) throws Exception
Exception
- if something goes wrongprotected double getEstimatedErrors()
protected double getEstimatedErrorsForBranch(Instances data) throws Exception
Exception
- if something goes wrongprotected double getEstimatedErrorsForDistribution(Distribution theDistribution)
protected double getEtimateConstModel(Distribution theDistribution)
public int getNumInnerNodes()
public int getNumLeaves()
protected SimpleLinearRegression[][] mergeArrays(SimpleLinearRegression[][] a1, SimpleLinearRegression[][] a2)
a1
- one arraya2
- the other arraypublic Vector getNodes()
public void getNodes(Vector nodeList)
nodeList
- the list to be filledprotected Instances getNumericData(Instances train) throws Exception
getNumericData
in class LogisticBase
train
- the data to convertException
- if something goes wrongprotected double[] getFs(Instance instance) throws Exception
getFs
in class LogisticBase
instance
- the instanceException
- if something goes wrongpublic int getConstError(double[] probsConst)
any
- probsConstpublic boolean hasModels()
public double[] modelDistributionForInstance(Instance instance) throws Exception
instance
- the instanceException
public abstract double[] distributionForInstance(Instance instance) throws Exception
distributionForInstance
in class LogisticBase
instance
- the instanceException
- if distribution can't be computed successfullypublic String toString()
toString
in class LogisticBase
public int numLeaves()
public int numNodes()
public String getModelParameters()
protected void dumpTree(int depth, StringBuffer text) throws Exception
Exception
- if something goes wrongpublic int assignIDs(int lastID)
public int assignLeafModelNumbers(int leafCounter)
protected double[][] getCoefficients()
getCoefficients
in class LogisticBase
public String modelsToString()
public String graph() throws Exception
Exception
- if something goes wrongprotected void graphTree(StringBuffer text) throws Exception
Exception
- if something goes wrongpublic void cleanup()
cleanup
in class LogisticBase
public String getRevision()
getRevision
in interface RevisionHandler
getRevision
in class LogisticBase
Copyright © 2015 University of Waikato, Hamilton, NZ. All rights reserved.