public class RandomForestModel extends Object implements Saveable
param: algo algorithm for the ensemble model, either Classification or Regression param: trees tree ensembles
Modifier and Type | Class and Description |
---|---|
static class |
org.apache.spark.mllib.tree.model.TreeEnsembleModel.SaveLoadV1_0$ |
Constructor and Description |
---|
RandomForestModel(scala.Enumeration.Value algo,
DecisionTreeModel[] trees) |
Modifier and Type | Method and Description |
---|---|
scala.Enumeration.Value |
algo() |
static RandomForestModel |
load(SparkContext sc,
String path) |
int |
numTrees()
Get number of trees in ensemble.
|
static void |
org$apache$spark$internal$Logging$$log__$eq(org.slf4j.Logger x$1) |
static org.slf4j.Logger |
org$apache$spark$internal$Logging$$log_() |
JavaRDD<Double> |
predict(JavaRDD<Vector> features)
Java-friendly version of
org.apache.spark.mllib.tree.model.TreeEnsembleModel.predict . |
RDD<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,
String path)
Save this model to the given path.
|
String |
toDebugString()
Print the full model to a string.
|
String |
toString()
Print a summary of the model.
|
int |
totalNumNodes()
Get total number of nodes, summed over all trees in the ensemble.
|
DecisionTreeModel[] |
trees() |
public RandomForestModel(scala.Enumeration.Value algo, DecisionTreeModel[] trees)
public static RandomForestModel load(SparkContext sc, 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, String path)
Saveable
This saves: - human-readable (JSON) model metadata to path/metadata/ - Parquet formatted data to path/data/
The model may be loaded using Loader.load
.
public static org.slf4j.Logger org$apache$spark$internal$Logging$$log_()
public static void org$apache$spark$internal$Logging$$log__$eq(org.slf4j.Logger x$1)
public double predict(Vector features)
features
- array representing a single data pointpublic RDD<Object> predict(RDD<Vector> features)
features
- RDD representing data points to be predictedpublic JavaRDD<Double> predict(JavaRDD<Vector> features)
org.apache.spark.mllib.tree.model.TreeEnsembleModel.predict
.features
- (undocumented)public String toString()
toString
in class Object
public String toDebugString()
public int numTrees()
public int totalNumNodes()