public class KMeansModel
extends Object
implements scala.Serializable
Constructor and Description |
---|
KMeansModel(Vector[] clusterCenters) |
Modifier and Type | Method and Description |
---|---|
Vector[] |
clusterCenters() |
double |
computeCost(RDD<Vector> data)
Return the K-means cost (sum of squared distances of points to their nearest center) for this
model on the given data.
|
int |
k()
Total number of clusters.
|
JavaRDD<Integer> |
predict(JavaRDD<Vector> points)
Maps given points to their cluster indices.
|
RDD<Object> |
predict(RDD<Vector> points)
Maps given points to their cluster indices.
|
int |
predict(Vector point)
Returns the cluster index that a given point belongs to.
|
public KMeansModel(Vector[] clusterCenters)
public Vector[] clusterCenters()
public int k()
public int predict(Vector point)
public JavaRDD<Integer> predict(JavaRDD<Vector> points)