edu.uci.jforests.learning.trees
Class Tree
- java.lang.Object
-
- edu.uci.jforests.learning.trees.Tree
-
- All Implemented Interfaces:
- java.lang.Cloneable
- Direct Known Subclasses:
- DecisionTree, RegressionTree
public abstract class Tree extends java.lang.Object implements java.lang.Cloneable
-
-
Field Summary
Fields Modifier and Type Field and Description intnumLeaves
-
Constructor Summary
Constructors Constructor and Description Tree()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method and Description abstract voidbackfit(Sample sample)intgetLeaf(Dataset dataset, int instanceIndex)intgetLeafFromOriginalThreshold(Dataset dataset, int instanceIndex)intgetLeafFromOriginalThreshold(double[] featureVector)intgetLeftChild(int node)int[]getNodeParents(int node)Returns list of node parentsdoublegetOriginalThreshold(int node)intgetParent(int node)intgetRightChild(int node)intgetSplitFeature(int node)intgetThreshold(int node)voidinit(int maxLeaves)abstract voidloadCustomData(java.lang.String str)voidloadFromString(int numLeaves, java.lang.String splitFeaturesLine, java.lang.String leftChildrenLine, java.lang.String rightChildrenLine, java.lang.String thresholdsLine, java.lang.String originalThresholdsLine)voidloadLeavesInSubtree(int node, java.util.List<java.lang.Integer> leaves)Extracts the list of leaves that belong to the subtree which which has 'node' as its root.voidsetLeftChild(int node, int newChild)voidsetRightChild(int node, int newChild)intsplit(int leaf, TreeSplit split)turns a leaf of the tree into an internal node with two leaf-childrenjava.lang.StringtoString(double weight, int indentationLevel)
-
-
-
Method Detail
-
init
public void init(int maxLeaves)
-
getLeftChild
public int getLeftChild(int node)
-
setLeftChild
public void setLeftChild(int node, int newChild)
-
getRightChild
public int getRightChild(int node)
-
setRightChild
public void setRightChild(int node, int newChild)
-
getSplitFeature
public int getSplitFeature(int node)
-
getThreshold
public int getThreshold(int node)
-
getOriginalThreshold
public double getOriginalThreshold(int node)
-
getLeaf
public int getLeaf(Dataset dataset, int instanceIndex)
-
getLeafFromOriginalThreshold
public int getLeafFromOriginalThreshold(Dataset dataset, int instanceIndex)
-
getLeafFromOriginalThreshold
public int getLeafFromOriginalThreshold(double[] featureVector)
-
getParent
public int getParent(int node)
-
getNodeParents
public int[] getNodeParents(int node)
Returns list of node parents
-
loadLeavesInSubtree
public void loadLeavesInSubtree(int node, java.util.List<java.lang.Integer> leaves)Extracts the list of leaves that belong to the subtree which which has 'node' as its root. The result is added to 'leaves' input list.
-
split
public int split(int leaf, TreeSplit split)turns a leaf of the tree into an internal node with two leaf-children
-
loadCustomData
public abstract void loadCustomData(java.lang.String str) throws java.lang.Exception- Throws:
java.lang.Exception
-
toString
public java.lang.String toString(double weight, int indentationLevel)
-
loadFromString
public void loadFromString(int numLeaves, java.lang.String splitFeaturesLine, java.lang.String leftChildrenLine, java.lang.String rightChildrenLine, java.lang.String thresholdsLine, java.lang.String originalThresholdsLine) throws java.lang.Exception- Throws:
java.lang.Exception
-
backfit
public abstract void backfit(Sample sample)
-
-
DMelt 3.0 © DataMelt by jWork.ORG