You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Denis Serduik (JIRA)" <ji...@apache.org> on 2014/05/23 14:28:01 UTC

[jira] [Commented] (SPARK-1215) Clustering: Index out of bounds error

    [ https://issues.apache.org/jira/browse/SPARK-1215?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14007090#comment-14007090 ] 

Denis Serduik commented on SPARK-1215:
--------------------------------------

I don't think that the problem is about size of dataset. I've faced with similar issue on dataset  with about 900 items. As a workaround we've decided to fallback with random init mode.



> Clustering: Index out of bounds error
> -------------------------------------
>
>                 Key: SPARK-1215
>                 URL: https://issues.apache.org/jira/browse/SPARK-1215
>             Project: Spark
>          Issue Type: Bug
>          Components: MLlib
>            Reporter: dewshick
>            Assignee: Xiangrui Meng
>            Priority: Minor
>
> code:
> import org.apache.spark.mllib.clustering._
> val test = sc.makeRDD(Array(4,4,4,4,4).map(e => Array(e.toDouble)))
> val kmeans = new KMeans().setK(4)
> kmeans.run(test) evals with java.lang.ArrayIndexOutOfBoundsException
> error:
> 14/01/17 12:35:54 INFO scheduler.DAGScheduler: Stage 25 (collectAsMap at KMeans.scala:243) finished in 0.047 s
> 14/01/17 12:35:54 INFO spark.SparkContext: Job finished: collectAsMap at KMeans.scala:243, took 16.389537116 s
> Exception in thread "main" java.lang.reflect.InvocationTargetException
> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
> 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> 	at java.lang.reflect.Method.invoke(Method.java:606)
> 	at com.simontuffs.onejar.Boot.run(Boot.java:340)
> 	at com.simontuffs.onejar.Boot.main(Boot.java:166)
> Caused by: java.lang.ArrayIndexOutOfBoundsException: -1
> 	at org.apache.spark.mllib.clustering.LocalKMeans$.kMeansPlusPlus(LocalKMeans.scala:47)
> 	at org.apache.spark.mllib.clustering.KMeans$$anonfun$19.apply(KMeans.scala:247)
> 	at org.apache.spark.mllib.clustering.KMeans$$anonfun$19.apply(KMeans.scala:244)
> 	at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:233)
> 	at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:233)
> 	at scala.collection.immutable.Range.foreach(Range.scala:81)
> 	at scala.collection.TraversableLike$class.map(TraversableLike.scala:233)
> 	at scala.collection.immutable.Range.map(Range.scala:46)
> 	at org.apache.spark.mllib.clustering.KMeans.initKMeansParallel(KMeans.scala:244)
> 	at org.apache.spark.mllib.clustering.KMeans.run(KMeans.scala:124)
> 	at Clustering$$anonfun$1.apply$mcDI$sp(Clustering.scala:21)
> 	at Clustering$$anonfun$1.apply(Clustering.scala:19)
> 	at Clustering$$anonfun$1.apply(Clustering.scala:19)
> 	at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:233)
> 	at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:233)
> 	at scala.collection.immutable.Range.foreach(Range.scala:78)
> 	at scala.collection.TraversableLike$class.map(TraversableLike.scala:233)
> 	at scala.collection.immutable.Range.map(Range.scala:46)
> 	at Clustering$.main(Clustering.scala:19)
> 	at Clustering.main(Clustering.scala)
> 	... 6 more



--
This message was sent by Atlassian JIRA
(v6.2#6252)