Re: getting the cluster elements from kmeans run
You can use model.predict(point) that will help you identify the cluster center and map it to the point. rdd.map(x = (x,model.predict(x))) Thanks, Vishnu On Wed, Feb 11, 2015 at 11:06 PM, Harini Srinivasan har...@us.ibm.com wrote: Hi, Is there a way to get the elements of each cluster after running kmeans clustering? I am using the Java version. thanks
Re: getting the cluster elements from kmeans run
KMeansModel only returns the cluster centroids. To get the # of elements in each cluster, try calling kmeans.predict() on each of the points in the data used to build the model. See https://github.com/OryxProject/oryx/blob/master/oryx-app-mllib/src/main/java/com/cloudera/oryx/app/mllib/kmeans/KMeansUpdate.java Look at method fetchClusterCountsFromModel() From: Harini Srinivasan har...@us.ibm.com To: user@spark.apache.org Sent: Wednesday, February 11, 2015 12:36 PM Subject: getting the cluster elements from kmeans run Hi, Is there a way to get the elements ofeach cluster after running kmeans clustering? I am using the Java version. thanks