Class DecisionTreeModel
Object
org.apache.spark.mllib.tree.model.DecisionTreeModel
- All Implemented Interfaces:
Serializable
,Saveable
Decision tree model for classification or regression.
This model stores the decision tree structure and parameters.
param: topNode root node
param: algo algorithm type -- classification or regression
- See Also:
-
Nested Class Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionscala.Enumeration.Value
algo()
int
depth()
Get depth of tree.static DecisionTreeModel
load
(SparkContext sc, String path) static org.apache.spark.internal.Logging.LogStringContext
LogStringContext
(scala.StringContext sc) int
numNodes()
Get number of nodes in tree, including leaf nodes.static org.slf4j.Logger
static void
org$apache$spark$internal$Logging$$log__$eq
(org.slf4j.Logger x$1) Predict values for the given data set using the model trained.double
Predict values for a single data point using the model trained.Predict values for the given data set using the model trained.void
save
(SparkContext sc, String path) Save this model to the given path.Print the full model to a string.topNode()
toString()
Print a summary of the model.
-
Constructor Details
-
DecisionTreeModel
-
-
Method Details
-
load
- Parameters:
sc
- Spark context used for loading model files.path
- Path specifying the directory to which the model was saved.- Returns:
- Model instance
-
org$apache$spark$internal$Logging$$log_
public static org.slf4j.Logger org$apache$spark$internal$Logging$$log_() -
org$apache$spark$internal$Logging$$log__$eq
public static void org$apache$spark$internal$Logging$$log__$eq(org.slf4j.Logger x$1) -
LogStringContext
public static org.apache.spark.internal.Logging.LogStringContext LogStringContext(scala.StringContext sc) -
topNode
-
algo
public scala.Enumeration.Value algo() -
predict
Predict values for a single data point using the model trained.- Parameters:
features
- array representing a single data point- Returns:
- Double prediction from the trained model
-
predict
Predict values for the given data set using the model trained.- Parameters:
features
- RDD representing data points to be predicted- Returns:
- RDD of predictions for each of the given data points
-
predict
Predict values for the given data set using the model trained.- Parameters:
features
- JavaRDD representing data points to be predicted- Returns:
- JavaRDD of predictions for each of the given data points
-
numNodes
public int numNodes()Get number of nodes in tree, including leaf nodes.- Returns:
- (undocumented)
-
depth
public int depth()Get depth of tree. E.g.: Depth 0 means 1 leaf node. Depth 1 means 1 internal node and 2 leaf nodes.- Returns:
- (undocumented)
-
toString
Print a summary of the model. -
toDebugString
Print the full model to a string.- Returns:
- (undocumented)
-
save
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
.
-