spark-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Robert Dodier <robert.dod...@gmail.com>
Subject slightly more informative error message in MLUtils.loadLibSVMFile
Date Fri, 23 Oct 2015 19:43:42 GMT
Hi,

MLUtils.loadLibSVMFile verifies that indices are 1-based and
increasing, and otherwise triggers an error. I'd like to suggest that
the error message be a little more informative. I ran into this when
loading a malformed file. Exactly what gets printed isn't too crucial,
maybe you would want to print something else, all that matters is to
give some context so that the user can find the problem more quickly.

Hope this helps in some way.

Robert Dodier

PS.

diff --git a/mllib/src/main/scala/org/apache/spark/mllib/util/MLUtils.scala
b/mllib/src/main/scala/org/apache/spark/mllib/util/MLUtils.scala
index 81c2f0c..6f5f680 100644
--- a/mllib/src/main/scala/org/apache/spark/mllib/util/MLUtils.scala
+++ b/mllib/src/main/scala/org/apache/spark/mllib/util/MLUtils.scala
@@ -91,7 +91,7 @@ object MLUtils {
         val indicesLength = indices.length
         while (i < indicesLength) {
           val current = indices(i)
-          require(current > previous, "indices should be one-based
and in ascending order" )
+          require(current > previous, "indices should be one-based
and in ascending order; found current=" + current + ", previous=" +
previous + "; line=\"" + line + "\"" )
           previous = current
           i += 1
         }

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@spark.apache.org
For additional commands, e-mail: dev-help@spark.apache.org


Mime
View raw message