public class RandomForestModel extends java.lang.Object implements Saveable
param: algo algorithm for the ensemble model, either Classification or Regression param: trees tree ensembles
| Constructor and Description |
|---|
RandomForestModel(scala.Enumeration.Value algo,
DecisionTreeModel[] trees) |
| Modifier and Type | Method and Description |
|---|---|
scala.Enumeration.Value |
algo() |
protected scala.Enumeration.Value |
combiningStrategy() |
protected java.lang.String |
formatVersion()
Current version of model save/load format.
|
static RandomForestModel |
load(SparkContext sc,
java.lang.String path) |
int |
numTrees()
Get number of trees in ensemble.
|
JavaRDD<java.lang.Double> |
predict(JavaRDD<Vector> features)
Java-friendly version of
TreeEnsembleModel.predict(org.apache.spark.mllib.linalg.Vector). |
RDD<java.lang.Object> |
predict(RDD<Vector> features)
Predict values for the given data set.
|
double |
predict(Vector features)
Predict values for a single data point using the model trained.
|
void |
save(SparkContext sc,
java.lang.String path)
Save this model to the given path.
|
java.lang.String |
toDebugString()
Print the full model to a string.
|
java.lang.String |
toString()
Print a summary of the model.
|
int |
totalNumNodes()
Get total number of nodes, summed over all trees in the ensemble.
|
DecisionTreeModel[] |
trees() |
protected double[] |
treeWeights() |
public RandomForestModel(scala.Enumeration.Value algo,
DecisionTreeModel[] trees)
public static RandomForestModel load(SparkContext sc, java.lang.String path)
sc - Spark context used for loading model files.path - Path specifying the directory to which the model was saved.public scala.Enumeration.Value algo()
public DecisionTreeModel[] trees()
public void save(SparkContext sc, java.lang.String path)
SaveableThis saves: - human-readable (JSON) model metadata to path/metadata/ - Parquet formatted data to path/data/
The model may be loaded using Loader.load.
protected java.lang.String formatVersion()
SaveableformatVersion in interface Saveableprotected double[] treeWeights()
protected scala.Enumeration.Value combiningStrategy()
public double predict(Vector features)
features - array representing a single data pointpublic RDD<java.lang.Object> predict(RDD<Vector> features)
features - RDD representing data points to be predictedpublic JavaRDD<java.lang.Double> predict(JavaRDD<Vector> features)
TreeEnsembleModel.predict(org.apache.spark.mllib.linalg.Vector).features - (undocumented)public java.lang.String toString()
toString in class java.lang.Objectpublic java.lang.String toDebugString()
public int numTrees()
public int totalNumNodes()