|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectweka.classifiers.trees.REPTree.Tree
An inner class for building and storing the tree structure
Field Summary | |
protected int |
m_Attribute
The attribute to split on. |
protected double[] |
m_ClassProbs
Class probabilities from the training data in the nominal case. |
protected double[] |
m_Distribution
The (unnormalized) class distribution in the nominal case. |
protected double[] |
m_HoldOutDist
Class distribution of hold-out set at node in the nominal case. |
protected double |
m_HoldOutError
The hold-out error of the node. |
protected Instances |
m_Info
The header information (for printing the tree). |
protected double[] |
m_Prop
The proportions of training instances going down each branch. |
protected double |
m_SplitPoint
The split point. |
protected REPTree.Tree[] |
m_Successors
The subtrees of this tree. |
Constructor Summary | |
protected |
REPTree.Tree()
|
Method Summary | |
protected void |
backfitHoldOutInstance(Instance inst,
double weight,
REPTree.Tree parent)
Inserts an instance from the hold-out set into the tree. |
protected void |
backfitHoldOutSet(Instances data)
Inserts hold-out set into tree. |
protected void |
buildTree(int[][] sortedIndices,
double[][] weights,
Instances data,
double totalWeight,
double[] classProbs,
Instances header,
double minNum,
double minVariance,
int depth,
int maxDepth)
Recursively generates a tree. |
protected double |
distribution(double[][] props,
double[][][] dists,
int att,
int[] sortedIndices,
double[] weights,
double[][] subsetWeights,
Instances data)
Computes class distribution for an attribute. |
protected double[] |
distributionForInstance(Instance instance)
Computes class distribution of an instance using the tree. |
protected double |
gain(double[][] dist,
double priorVal)
Computes value of splitting criterion after split. |
protected void |
insertHoldOutInstance(Instance inst,
double weight,
REPTree.Tree parent)
Inserts an instance from the hold-out set into the tree. |
protected void |
insertHoldOutSet(Instances data)
Inserts hold-out set into tree. |
protected java.lang.String |
leafString(REPTree.Tree parent)
Outputs description of a leaf node. |
protected double |
numericDistribution(double[][] props,
double[][][] dists,
int att,
int[] sortedIndices,
double[] weights,
double[][] subsetWeights,
Instances data,
double[] vals)
Computes class distribution for an attribute. |
protected int |
numNodes()
Computes size of the tree. |
protected double |
priorVal(double[][] dist)
Computes value of splitting criterion before split. |
protected double |
reducedErrorPrune()
Prunes the tree using the hold-out data (bottom-up). |
protected double |
singleVariance(double s,
double sS,
double weight)
Computes the variance for a single set |
java.lang.String |
sourceExpression(int index)
Returns a string containing java source code equivalent to the test made at this node. |
protected void |
splitData(int[][][] subsetIndices,
double[][][] subsetWeights,
int att,
double splitPoint,
int[][] sortedIndices,
double[][] weights,
Instances data)
Splits instances into subsets. |
protected int |
toGraph(java.lang.StringBuffer text,
int num,
REPTree.Tree parent)
Outputs one node for graph. |
java.lang.StringBuffer[] |
toSource(java.lang.String className,
REPTree.Tree parent)
Returns source code for the tree as if-then statements. |
protected java.lang.String |
toString(int level,
REPTree.Tree parent)
Recursively outputs the tree. |
protected double |
variance(double[] s,
double[] sS,
double[] sumOfWeights)
Computes variance for subsets. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected Instances m_Info
protected REPTree.Tree[] m_Successors
protected int m_Attribute
protected double m_SplitPoint
protected double[] m_Prop
protected double[] m_ClassProbs
protected double[] m_Distribution
protected double[] m_HoldOutDist
protected double m_HoldOutError
Constructor Detail |
protected REPTree.Tree()
Method Detail |
protected double[] distributionForInstance(Instance instance) throws java.lang.Exception
java.lang.Exception
public final java.lang.String sourceExpression(int index)
index
- index of the value tested
public java.lang.StringBuffer[] toSource(java.lang.String className, REPTree.Tree parent) throws java.lang.Exception
className
- the classname that this static classifier hasparent
- parent node of the current node
java.lang.Exception
- if something goes wrongprotected int toGraph(java.lang.StringBuffer text, int num, REPTree.Tree parent) throws java.lang.Exception
java.lang.Exception
protected java.lang.String leafString(REPTree.Tree parent) throws java.lang.Exception
java.lang.Exception
protected java.lang.String toString(int level, REPTree.Tree parent)
protected void buildTree(int[][] sortedIndices, double[][] weights, Instances data, double totalWeight, double[] classProbs, Instances header, double minNum, double minVariance, int depth, int maxDepth) throws java.lang.Exception
java.lang.Exception
protected int numNodes()
protected void splitData(int[][][] subsetIndices, double[][][] subsetWeights, int att, double splitPoint, int[][] sortedIndices, double[][] weights, Instances data) throws java.lang.Exception
java.lang.Exception
protected double distribution(double[][] props, double[][][] dists, int att, int[] sortedIndices, double[] weights, double[][] subsetWeights, Instances data) throws java.lang.Exception
java.lang.Exception
protected double numericDistribution(double[][] props, double[][][] dists, int att, int[] sortedIndices, double[] weights, double[][] subsetWeights, Instances data, double[] vals) throws java.lang.Exception
java.lang.Exception
protected double variance(double[] s, double[] sS, double[] sumOfWeights)
protected double singleVariance(double s, double sS, double weight)
protected double priorVal(double[][] dist)
protected double gain(double[][] dist, double priorVal)
protected double reducedErrorPrune() throws java.lang.Exception
java.lang.Exception
protected void insertHoldOutSet(Instances data) throws java.lang.Exception
java.lang.Exception
protected void insertHoldOutInstance(Instance inst, double weight, REPTree.Tree parent) throws java.lang.Exception
java.lang.Exception
protected void backfitHoldOutSet(Instances data) throws java.lang.Exception
java.lang.Exception
protected void backfitHoldOutInstance(Instance inst, double weight, REPTree.Tree parent) throws java.lang.Exception
java.lang.Exception
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |