KMeans.train actually returns a KMeansModel so you can use predict() method of 
the model 

e.g. clusters.predict(pointToPredict)
or

clusters.predict(pointsToPredict)

first is a single Vector, 2nd is RDD[Vector]

Robin
On 12 Feb 2015, at 06:37, Shi Yu <shiyu....@gmail.com> wrote:

> Hi there,
> 
> I am new to spark.  When training a model using K-means using the following 
> code, how do I obtain the cluster assignment in the next step?
> 
> 
> val clusters = KMeans.train(parsedData, numClusters, numIterations)
> 
> 
>  I searched around many examples but they mostly calculate the WSSSE. I am 
> still confused. 
> 
> Thanks!
>  
> Eilian
> 
> 

Reply via email to