Class BisectingKMeansModel
Object
org.apache.spark.mllib.clustering.BisectingKMeansModel
- All Implemented Interfaces:
Serializable
,org.apache.spark.internal.Logging
,Saveable
public class BisectingKMeansModel
extends Object
implements Serializable, Saveable, org.apache.spark.internal.Logging
Clustering model produced by
BisectingKMeans
.
The prediction is done level-by-level from the root node to a leaf node, and at each node among
its children the closest to the input point is selected.
param: root the root node of the clustering tree
- See Also:
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
static class
static class
Nested classes/interfaces inherited from interface org.apache.spark.internal.Logging
org.apache.spark.internal.Logging.LogStringContext, org.apache.spark.internal.Logging.SparkShellLoggingFilter
-
Constructor Summary
ConstructorDescriptionBisectingKMeansModel
(org.apache.spark.mllib.clustering.ClusteringTreeNode root) -
Method Summary
Modifier and TypeMethodDescriptionVector[]
Leaf cluster centers.double
computeCost
(JavaRDD<Vector> data) Java-friendly version ofcomputeCost()
.double
computeCost
(Vector point) Computes the squared distance between the input point and the cluster center it belongs to.double
computeCost
(RDD<Vector> data) Computes the sum of squared distances between the input points and their corresponding cluster centers.int
k()
static BisectingKMeansModel
load
(SparkContext sc, String path) Java-friendly version ofpredict()
.int
Predicts the index of the cluster that the input point belongs to.Predicts the indices of the clusters that the input points belong to.void
save
(SparkContext sc, String path) Save this model to the given path.double
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.apache.spark.internal.Logging
initializeForcefully, initializeLogIfNecessary, initializeLogIfNecessary, initializeLogIfNecessary$default$2, isTraceEnabled, log, logDebug, logDebug, logDebug, logDebug, logError, logError, logError, logError, logInfo, logInfo, logInfo, logInfo, logName, LogStringContext, logTrace, logTrace, logTrace, logTrace, logWarning, logWarning, logWarning, logWarning, org$apache$spark$internal$Logging$$log_, org$apache$spark$internal$Logging$$log__$eq, withLogContext
-
Constructor Details
-
BisectingKMeansModel
public BisectingKMeansModel(org.apache.spark.mllib.clustering.ClusteringTreeNode root)
-
-
Method Details
-
load
-
distanceMeasure
-
trainingCost
public double trainingCost() -
clusterCenters
Leaf cluster centers.- Returns:
- (undocumented)
-
k
public int k() -
predict
Predicts the index of the cluster that the input point belongs to.- Parameters:
point
- (undocumented)- Returns:
- (undocumented)
-
predict
Predicts the indices of the clusters that the input points belong to.- Parameters:
points
- (undocumented)- Returns:
- (undocumented)
-
predict
Java-friendly version ofpredict()
.- Parameters:
points
- (undocumented)- Returns:
- (undocumented)
-
computeCost
Computes the squared distance between the input point and the cluster center it belongs to.- Parameters:
point
- (undocumented)- Returns:
- (undocumented)
-
computeCost
Computes the sum of squared distances between the input points and their corresponding cluster centers.- Parameters:
data
- (undocumented)- Returns:
- (undocumented)
-
computeCost
Java-friendly version ofcomputeCost()
.- Parameters:
data
- (undocumented)- 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
.
-