DecisionTreeModel

class pyspark.mllib.tree.DecisionTreeModel(java_model)[source]

A decision tree model for classification or regression.

New in version 1.1.0.

Methods

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.

numNodes()[source]

Get number of nodes in tree, including leaf nodes.

New in version 1.1.0.

predict(x)[source]

Predict the label of one or more examples.

Note

In Python, predict cannot currently be used within an RDD transformation or action. Call predict directly on the RDD instead.

Parameters

x – Data point (feature vector), or an RDD of data points (feature vectors).

New in version 1.1.0.

save(sc, path)

Save this model to the given path.

New in version 1.3.0.

toDebugString()[source]

full model.

New in version 1.2.0.