Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed MLlib Naive-Bayes java example bug #3081

Closed
wants to merge 2 commits into from
Closed

fixed MLlib Naive-Bayes java example bug #3081

wants to merge 2 commits into from

Conversation

dkobylarz
Copy link
Contributor

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

@AmplabJenkins
Copy link

Can one of the admins verify this patch?

@@ -90,7 +90,7 @@ JavaPairRDD<Double, Double> predictionAndLabel =
});
double accuracy = 1.0 * predictionAndLabel.filter(new Function<Tuple2<Double, Double>, Boolean>() {
@Override public Boolean call(Tuple2<Double, Double> pl) {
return pl._1() == pl._2();
return pl._1().doubleValue() == pl._2().doubleValue();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is pl._1().equals(pl._2()) better?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah kinda. Also would the esteemed author indulge me and remove 1.0 * in favor of an actual cast or .doubleValue() as well?

@dkobylarz
Copy link
Contributor Author

there you go, looks more elegant now

@mengxr
Copy link
Contributor

mengxr commented Nov 4, 2014

LGTM. I've merged this into master and branch-1.2 (skipped Jenkins because it only contains doc change). Thanks!

@asfgit asfgit closed this in bcecd73 Nov 4, 2014
asfgit pushed a commit that referenced this pull request Nov 4, 2014
the filter tests Double objects by references whereas it should test their values

Author: Dariusz Kobylarz <darek.kobylarz@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

(cherry picked from commit bcecd73)
Signed-off-by: Xiangrui Meng <meng@databricks.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants