You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spark.apache.org by sr...@apache.org on 2017/06/09 09:49:08 UTC

spark git commit: Fix bug in JavaRegressionMetricsExample.

Repository: spark
Updated Branches:
  refs/heads/master 033839559 -> 6491cbf06


Fix bug in JavaRegressionMetricsExample.

the original code cant visit the last element of the"parts" array.
so the v[v.length–1] always equals 0

## What changes were proposed in this pull request?
change the recycle range from (1 to parts.length-1) to (1 to parts.length)

## How was this patch tested?

debug it in eclipse (´〜`*) zzz.

Please review http://spark.apache.org/contributing.html before opening a pull request.

Author: junzhi lu <45...@qq.com>

Closes #18237 from masterwugui/patch-1.


Project: http://git-wip-us.apache.org/repos/asf/spark/repo
Commit: http://git-wip-us.apache.org/repos/asf/spark/commit/6491cbf0
Tree: http://git-wip-us.apache.org/repos/asf/spark/tree/6491cbf0
Diff: http://git-wip-us.apache.org/repos/asf/spark/diff/6491cbf0

Branch: refs/heads/master
Commit: 6491cbf065254e28bca61c9ef55b84f4009ac36c
Parents: 0338395
Author: junzhi lu <45...@qq.com>
Authored: Fri Jun 9 10:49:04 2017 +0100
Committer: Sean Owen <so...@cloudera.com>
Committed: Fri Jun 9 10:49:04 2017 +0100

----------------------------------------------------------------------
 .../apache/spark/examples/mllib/JavaRegressionMetricsExample.java  | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/spark/blob/6491cbf0/examples/src/main/java/org/apache/spark/examples/mllib/JavaRegressionMetricsExample.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/spark/examples/mllib/JavaRegressionMetricsExample.java b/examples/src/main/java/org/apache/spark/examples/mllib/JavaRegressionMetricsExample.java
index 7bb9993..00033b5 100644
--- a/examples/src/main/java/org/apache/spark/examples/mllib/JavaRegressionMetricsExample.java
+++ b/examples/src/main/java/org/apache/spark/examples/mllib/JavaRegressionMetricsExample.java
@@ -40,7 +40,7 @@ public class JavaRegressionMetricsExample {
     JavaRDD<LabeledPoint> parsedData = data.map(line -> {
       String[] parts = line.split(" ");
       double[] v = new double[parts.length - 1];
-      for (int i = 1; i < parts.length - 1; i++) {
+      for (int i = 1; i < parts.length; i++) {
         v[i - 1] = Double.parseDouble(parts[i].split(":")[1]);
       }
       return new LabeledPoint(Double.parseDouble(parts[0]), Vectors.dense(v));


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