spark-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Xiangrui Meng (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (SPARK-1215) Clustering: Index out of bounds error
Date Tue, 15 Apr 2014 16:48:15 GMT

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

Xiangrui Meng commented on SPARK-1215:
--------------------------------------

The error was due to small number of points and large k. The k-means|| initialization doesn't
collect more than k candidates. This is very unlikely to appear in practice because k is much
smaller than number of points. I will re-visit this issue once we implement better weighted
sampling algorithms.

> 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)

Mime
View raw message