Makes sense! That extra collection can be costly. 

On Jul 5, 2013, at 5:03 PM, Matei Zaharia <notifications@github.com> wrote:

> In mllib/src/main/scala/spark/ml/clustering/KMeans.scala:
> 
> > +                .setInitializationMode(initializationMode)
> > +                .train(data)
> > +  }
> > +
> > +  def train(data: RDD[Array[Double]], k: Int, maxIterations: Int, runs: Int): KMeansModel = {
> > +    train(data, k, maxIterations, runs, K_MEANS_PARALLEL)
> > +  }
> > +
> > +  def train(data: RDD[Array[Double]], k: Int, maxIterations: Int): KMeansModel = {
> > +    train(data, k, maxIterations, 1, K_MEANS_PARALLEL)
> > +  }
> > +
> > +  /**
> > +   * Return the index of the closest point in `centers` to `point`, as well as its distance.
> > +   */
> > +  private[mllib] def findClosest(centers: Array[Array[Double]], point: Array[Double])
> This is true but we wanted to avoid the object allocation done by zipWithIndex
> 
> —
> Reply to this email directly or view it on GitHub.