public class BisectingKMeansModel extends Object implements scala.Serializable, Saveable, 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$ |
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.
|
int |
k()
Number of leaf clusters.
|
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.
|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
initializeLogging, initializeLogIfNecessary, initializeLogIfNecessary, isTraceEnabled, log_, log, logDebug, logDebug, logError, logError, logInfo, logInfo, logName, logTrace, logTrace, logWarning, logWarning
public static BisectingKMeansModel load(SparkContext sc, String path)
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
.