DecisionTreeModel¶
-
class
pyspark.mllib.tree.
DecisionTreeModel
(java_model)[source]¶ A decision tree model for classification or regression.
New in version 1.1.0.
Methods
call
(name, *a)Call method of java_model
depth
()Get depth of tree (e.g.
load
(sc, path)Load a model from the given path.
numNodes
()Get number of nodes in tree, including leaf nodes.
predict
(x)Predict the label of one or more examples.
save
(sc, path)Save this model to the given path.
full model.
Methods Documentation
-
call
(name, *a)¶ Call method of java_model
-
depth
()[source]¶ Get depth of tree (e.g. depth 0 means 1 leaf node, depth 1 means 1 internal node + 2 leaf nodes).
New in version 1.1.0.
-
classmethod
load
(sc, path)¶ Load a model from the given path.
New in version 1.3.0.
-
predict
(x)[source]¶ Predict the label of one or more examples.
New in version 1.1.0.
- Parameters
- x
pyspark.mllib.linalg.Vector
orpyspark.RDD
Data point (feature vector), or an RDD of data points (feature vectors).
- x
Notes
In Python, predict cannot currently be used within an RDD transformation or action. Call predict directly on the RDD instead.
-
save
(sc, path)¶ Save this model to the given path.
New in version 1.3.0.
-