I am using the following vector definition in java Vectors.sparse(3, new int[] { 1, 2, 3 }, new double[] { 1.1, 1.1, 1.1 }))
However when I run the predict method on this vector it leads to Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 3 at org.apache.spark.mllib.linalg.BLAS$.dot(BLAS.scala:143) at org.apache.spark.mllib.linalg.BLAS$.dot(BLAS.scala:115) at org.apache.spark.mllib.util.MLUtils$.fastSquaredDistance(MLUtils.scala:298) at org.apache.spark.mllib.clustering.KMeans$.fastSquaredDistance(KMeans.scala:606) at org.apache.spark.mllib.clustering.KMeans$$anonfun$findClosest$1.apply(KMeans.scala:580) at org.apache.spark.mllib.clustering.KMeans$$anonfun$findClosest$1.apply(KMeans.scala:574) at scala.collection.mutable.ArraySeq.foreach(ArraySeq.scala:74) at org.apache.spark.mllib.clustering.KMeans$.findClosest(KMeans.scala:574) at org.apache.spark.mllib.clustering.KMeansModel.predict(KMeansModel.scala:59) at org.apache.spark.ml.clustering.KMeansModel.predict(KMeans.scala:130)