RandomForestModel#

class pyspark.mllib.tree.RandomForestModel(java_model)[source]#

Represents a random forest model.

Added in version 1.2.0.

Methods

call(name, *a)

Call method of java_model

load(sc, path)

Load a model from the given path.

numTrees()

Get number of trees in ensemble.

predict(x)

Predict values for a single data point or an RDD of points using the model trained.

save(sc, path)

Save this model to the given path.

toDebugString()

Full model

totalNumNodes()

Get total number of nodes, summed over all trees in the ensemble.

Methods Documentation

call(name, *a)#

Call method of java_model

classmethod load(sc, path)#

Load a model from the given path.

Added in version 1.3.0.

numTrees()#

Get number of trees in ensemble.

Added in version 1.3.0.

predict(x)#

Predict values for a single data point or an RDD of points using the model trained.

Added in version 1.3.0.

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.

Added in version 1.3.0.

toDebugString()#

Full model

Added in version 1.3.0.

totalNumNodes()#

Get total number of nodes, summed over all trees in the ensemble.

Added in version 1.3.0.