Class RandomForestModel

Object
org.apache.spark.mllib.tree.model.TreeEnsembleModel
org.apache.spark.mllib.tree.model.RandomForestModel
All Implemented Interfaces:
Serializable, Saveable

public class RandomForestModel extends org.apache.spark.mllib.tree.model.TreeEnsembleModel implements Saveable
Represents a random forest model.

param: algo algorithm for the ensemble model, either Classification or Regression param: trees tree ensembles

See Also:
  • Nested Class Summary

    Nested classes/interfaces inherited from class org.apache.spark.mllib.tree.model.TreeEnsembleModel

    org.apache.spark.mllib.tree.model.TreeEnsembleModel.SaveLoadV1_0$
  • Constructor Summary

    Constructors
    Constructor
    Description
    RandomForestModel(scala.Enumeration.Value algo, DecisionTreeModel[] trees)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    scala.Enumeration.Value
     
     
    void
    Save this model to the given path.
     

    Methods inherited from class org.apache.spark.mllib.tree.model.TreeEnsembleModel

    combiningStrategy, LogStringContext, numTrees, predict, predict, predict, toDebugString, toString, totalNumNodes, treeWeights

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • RandomForestModel

      public RandomForestModel(scala.Enumeration.Value algo, DecisionTreeModel[] trees)
  • Method Details

    • load

      public static RandomForestModel load(SparkContext sc, String path)
      Parameters:
      sc - Spark context used for loading model files.
      path - Path specifying the directory to which the model was saved.
      Returns:
      Model instance
    • algo

      public scala.Enumeration.Value algo()
      Overrides:
      algo in class org.apache.spark.mllib.tree.model.TreeEnsembleModel
    • trees

      public DecisionTreeModel[] trees()
      Overrides:
      trees in class org.apache.spark.mllib.tree.model.TreeEnsembleModel
    • save

      public void save(SparkContext sc, String path)
      Description copied from interface: Saveable
      Save this model to the given path.

      This saves: - human-readable (JSON) model metadata to path/metadata/ - Parquet formatted data to path/data/

      The model may be loaded using Loader.load.

      Specified by:
      save in interface Saveable
      Parameters:
      sc - Spark context used to save model data.
      path - Path specifying the directory in which to save this model. If the directory already exists, this method throws an exception.