public class BisectingKMeansModel extends Object implements scala.Serializable, Saveable, org.apache.spark.internal.Logging
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
Modifier and Type | Class and Description |
---|---|
static class |
BisectingKMeansModel.SaveLoadV1_0$ |
static class |
BisectingKMeansModel.SaveLoadV2_0$ |
static class |
BisectingKMeansModel.SaveLoadV3_0$ |
Constructor and Description |
---|
BisectingKMeansModel(org.apache.spark.mllib.clustering.ClusteringTreeNode root) |
Modifier and Type | Method and Description |
---|---|
Vector[] |
clusterCenters()
Leaf cluster centers.
|
double |
computeCost(JavaRDD<Vector> data)
Java-friendly version of
computeCost() . |
double |
computeCost(RDD<Vector> data)
Computes the sum of squared distances between the input points and their corresponding cluster
centers.
|
double |
computeCost(Vector point)
Computes the squared distance between the input point and the cluster center it belongs to.
|
String |
distanceMeasure() |
int |
k() |
static BisectingKMeansModel |
load(SparkContext sc,
String path) |
JavaRDD<Integer> |
predict(JavaRDD<Vector> points)
Java-friendly version of
predict() . |
RDD<Object> |
predict(RDD<Vector> points)
Predicts the indices of the clusters that the input points belong to.
|
int |
predict(Vector point)
Predicts the index of the cluster that the input point belongs to.
|
void |
save(SparkContext sc,
String path)
Save this model to the given path.
|
double |
trainingCost() |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
$init$, initializeForcefully, initializeLogIfNecessary, initializeLogIfNecessary, initializeLogIfNecessary$default$2, initLock, isTraceEnabled, log, logDebug, logDebug, logError, logError, logInfo, logInfo, logName, logTrace, logTrace, logWarning, logWarning, org$apache$spark$internal$Logging$$log__$eq, org$apache$spark$internal$Logging$$log_, uninitialize
public BisectingKMeansModel(org.apache.spark.mllib.clustering.ClusteringTreeNode root)
public static BisectingKMeansModel load(SparkContext sc, String path)
public String distanceMeasure()
public double trainingCost()
public Vector[] clusterCenters()
public int k()
public int predict(Vector point)
point
- (undocumented)public RDD<Object> predict(RDD<Vector> points)
points
- (undocumented)public JavaRDD<Integer> predict(JavaRDD<Vector> points)
predict()
.points
- (undocumented)public double computeCost(Vector point)
point
- (undocumented)public double computeCost(RDD<Vector> data)
data
- (undocumented)public double computeCost(JavaRDD<Vector> data)
computeCost()
.data
- (undocumented)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
.