You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spark.apache.org by me...@apache.org on 2014/11/04 18:54:00 UTC
git commit: fixed MLlib Naive-Bayes java example bug
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 <da...@gmail.com>
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 <da...@gmail.com>
Authored: Tue Nov 4 09:53:43 2014 -0800
Committer: Xiangrui Meng <me...@databricks.com>
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: commits-unsubscribe@spark.apache.org
For additional commands, e-mail: commits-help@spark.apache.org