Re: K-Mean retrieving Cluster Members

2016-10-19 Thread Robin East

or alternatively this should work (assuming parsedData is an RDD[Vector]):

clusters.predict(parsedData)





> On 18 Oct 2016, at 00:35, Reth RM  wrote:
> 
> I think I got it
>  
>   parsedData.foreach(
> new VoidFunction() {
> @Override
> public void call(Vector vector) throws Exception {
> System.out.println(clusters.predict(vector));
> 
> }
> }
> );
> 
> 
> On Mon, Oct 17, 2016 at 10:56 AM, Reth RM  > wrote:
> Could you please point me to sample code to retrieve the cluster members of K 
> mean?
> 
> The below code prints cluster centers.  I needed cluster members belonging to 
> each center.
> 
>  
> val clusters = KMeans.train(parsedData, numClusters, numIterations) 
> clusters.clusterCenters.foreach(println)
> 



Re: K-Mean retrieving Cluster Members

2016-10-17 Thread Reth RM
I think I got it

  parsedData.foreach(
new VoidFunction() {
@Override
public void call(Vector vector) throws Exception {
System.out.println(clusters.predict(vector));

}
}
);


On Mon, Oct 17, 2016 at 10:56 AM, Reth RM  wrote:

> Could you please point me to sample code to retrieve the cluster members
> of K mean?
>
> The below code prints cluster centers. * I
> needed cluster members belonging to each center.*
>
>
>
> val clusters = KMeans.train(parsedData, numClusters, numIterations) 
> clusters.clusterCenters.foreach(println)
>
>


K-Mean retrieving Cluster Members

2016-10-17 Thread Reth RM
Could you please point me to sample code to retrieve the cluster members of
K mean?

The below code prints cluster centers. * I needed cluster members belonging
to each center.*



val clusters = KMeans.train(parsedData, numClusters, numIterations)
clusters.clusterCenters.foreach(println)