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 <452756565@qq.com> Closes #18237 from masterwugui/patch-1.
This commit is contained in:
parent
033839559e
commit
6491cbf065
|
@ -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));
|
||||
|
|
Loading…
Reference in a new issue