You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@spark.apache.org by Robert Dodier <ro...@gmail.com> on 2015/10/23 21:43:42 UTC
slightly more informative error message in MLUtils.loadLibSVMFile
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
Re: slightly more informative error message in MLUtils.loadLibSVMFile
Posted by Jeff Zhang <zj...@gmail.com>.
+1
On Tue, Nov 17, 2015 at 7:43 AM, Joseph Bradley <jo...@databricks.com>
wrote:
> That sounds useful; would you mind submitting a JIRA (and a PR if you're
> willing)?
> Thanks,
> Joseph
>
> On Fri, Oct 23, 2015 at 12:43 PM, Robert Dodier <ro...@gmail.com>
> wrote:
>
>> 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
>>
>>
>
--
Best Regards
Jeff Zhang
Re: slightly more informative error message in MLUtils.loadLibSVMFile
Posted by Joseph Bradley <jo...@databricks.com>.
That sounds useful; would you mind submitting a JIRA (and a PR if you're
willing)?
Thanks,
Joseph
On Fri, Oct 23, 2015 at 12:43 PM, Robert Dodier <ro...@gmail.com>
wrote:
> 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
>
>