Repository: spark
Updated Branches:
  refs/heads/master e4f42631a -> bcecd73fd


fixed MLlib Naive-Bayes java example bug

the filter tests Double objects by references whereas it should test their 
values

Author: Dariusz Kobylarz <[email protected]>

Closes #3081 from dkobylarz/master and squashes the following commits:

5d43a39 [Dariusz Kobylarz] naive bayes example update
a304b93 [Dariusz Kobylarz] fixed MLlib Naive-Bayes java example bug


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

Branch: refs/heads/master
Commit: bcecd73fdd4d2ec209259cfd57d3ad1d63f028f2
Parents: e4f4263
Author: Dariusz Kobylarz <[email protected]>
Authored: Tue Nov 4 09:53:43 2014 -0800
Committer: Xiangrui Meng <[email protected]>
Committed: Tue Nov 4 09:53:43 2014 -0800

----------------------------------------------------------------------
 docs/mllib-naive-bayes.md | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/spark/blob/bcecd73f/docs/mllib-naive-bayes.md
----------------------------------------------------------------------
diff --git a/docs/mllib-naive-bayes.md b/docs/mllib-naive-bayes.md
index 7f9d4c6..d5b044d 100644
--- a/docs/mllib-naive-bayes.md
+++ b/docs/mllib-naive-bayes.md
@@ -88,11 +88,11 @@ JavaPairRDD<Double, Double> predictionAndLabel =
       return new Tuple2<Double, Double>(model.predict(p.features()), 
p.label());
     }
   });
-double accuracy = 1.0 * predictionAndLabel.filter(new Function<Tuple2<Double, 
Double>, Boolean>() {
+double accuracy = predictionAndLabel.filter(new Function<Tuple2<Double, 
Double>, Boolean>() {
     @Override public Boolean call(Tuple2<Double, Double> pl) {
-      return pl._1() == pl._2();
+      return pl._1().equals(pl._2());
     }
-  }).count() / test.count();
+  }).count() / (double) test.count();
 {% endhighlight %}
 </div>
 


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to