Package org.apache.spark.ml.tree
Interface DecisionTreeModel
- All Known Implementing Classes:
DecisionTreeClassificationModel
,DecisionTreeRegressionModel
public interface DecisionTreeModel
Abstraction for Decision Tree models.
-
Method Summary
Modifier and TypeMethodDescriptionint
depth()
Depth of the tree.getLeafField
(String leafCol) leafAttr()
scala.collection.Iterator<LeafNode>
leafIterator
(Node node) int
Trace down the tree, and return the largest feature index used in any split.int
numLeave()
int
numNodes()
Number of nodes in tree, including leaf nodes.double
predictLeaf
(Vector features) rootNode()
Root of the decision treeFull description of modeltoOld()
Convert to spark.mllib DecisionTreeModel (losing some information)toString()
Summary of the model
-
Method Details
-
depth
int depth()Depth of the tree. E.g.: Depth 0 means 1 leaf node. Depth 1 means 1 internal node and 2 leaf nodes.- Returns:
- (undocumented)
-
getLeafField
-
leafAttr
NominalAttribute leafAttr() -
leafIterator
- Parameters:
node
- (undocumented)- Returns:
- an iterator that traverses (DFS, left to right) the leaves in the subtree of this node.
-
maxSplitFeatureIndex
int maxSplitFeatureIndex()Trace down the tree, and return the largest feature index used in any split.- Returns:
- Max feature index used in a split, or -1 if there are no splits (single leaf node).
-
numLeave
int numLeave() -
numNodes
int numNodes()Number of nodes in tree, including leaf nodes. -
predictLeaf
- Parameters:
features
- (undocumented)- Returns:
- The index of the leaf corresponding to the feature vector. Leaves are indexed in pre-order from 0.
-
rootNode
Node rootNode()Root of the decision tree -
toDebugString
String toDebugString()Full description of model -
toOld
DecisionTreeModel toOld()Convert to spark.mllib DecisionTreeModel (losing some information) -
toString
String toString()Summary of the model
-