public class DecisionTreeModel extends java.lang.Object implements scala.Serializable, Saveable
Constructor and Description |
---|
DecisionTreeModel(Node topNode,
scala.Enumeration.Value algo) |
Modifier and Type | Method and Description |
---|---|
scala.Enumeration.Value |
algo() |
int |
depth()
Get depth of tree.
|
protected java.lang.String |
formatVersion()
Current version of model save/load format.
|
static DecisionTreeModel |
load(SparkContext sc,
java.lang.String path) |
int |
numNodes()
Get number of nodes in tree, including leaf nodes.
|
JavaRDD<java.lang.Object> |
predict(JavaRDD<Vector> features)
Predict values for the given data set using the model trained.
|
RDD<java.lang.Object> |
predict(RDD<Vector> features)
Predict values for the given data set using the model trained.
|
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.
|
Node |
topNode() |
java.lang.String |
toString()
Print a summary of the model.
|
public DecisionTreeModel(Node topNode, scala.Enumeration.Value algo)
public static DecisionTreeModel load(SparkContext sc, java.lang.String path)
public Node topNode()
public scala.Enumeration.Value algo()
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.Object> predict(JavaRDD<Vector> features)
features
- JavaRDD representing data points to be predictedpublic int numNodes()
public int depth()
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String toDebugString()
public void save(SparkContext sc, java.lang.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
.
protected java.lang.String formatVersion()
Saveable
formatVersion
in interface Saveable