RandomForestModel

class pyspark.mllib.tree.RandomForestModel(java_model: py4j.java_gateway.JavaObject)

Represents a random forest model.

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: str, *a: Any) → Any

Call method of java_model

classmethod load(sc: pyspark.context.SparkContext, path: str) → JL

Load a model from the given path.

numTrees() → int

Get number of trees in ensemble.

predict(x: Union[VectorLike, pyspark.rdd.RDD[VectorLike]]) → Union[float, pyspark.rdd.RDD[float]]

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

Notes

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

save(sc: pyspark.context.SparkContext, path: str) → None

Save this model to the given path.

toDebugString() → str

Full model

totalNumNodes() → int

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