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

[SPARK-21806][MLLIB] BinaryClassificationMetrics pr(): first point (0.0, 1.0) is misleading #19038

Closed
wants to merge 1 commit into from

Conversation

srowen
Copy link
Member

@srowen srowen commented Aug 24, 2017

What changes were proposed in this pull request?

Prepend (0,p) to precision-recall curve not (0,1) where p matches lowest recall point

How was this patch tested?

Updated tests.


private def assertSequencesMatch(left: Seq[Double], right: Seq[Double]): Unit = {
assert(left.zip(right).forall(areWithinEpsilon))
private def assertSequencesMatch(actual: Seq[Double], expected: Seq[Double]): Unit = {
Copy link
Member Author

Choose a reason for hiding this comment

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

90% of the changes in this file were to improve the error log message and clean up the code a bit.

@SparkQA
Copy link

SparkQA commented Aug 24, 2017

Test build #81078 has finished for PR 19038 at commit 48c9159.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

Copy link
Member Author

@srowen srowen left a comment

Choose a reason for hiding this comment

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

I think this is a good fix -- minimal change, replaces a value that is maybe the only one that can't be justified with one that can. Only thing I can't decide is whether to change the Precision "computer" class which defines 0/0 precision to be 1, even though that logic is never actually used.

@@ -111,7 +109,7 @@ class BinaryClassificationMetricsSuite extends SparkFunSuite with MLlibTestSpark
val fpr = Seq(1.0)
val rocCurve = Seq((0.0, 0.0)) ++ fpr.zip(recalls) ++ Seq((1.0, 1.0))
val pr = recalls.zip(precisions)
val prCurve = Seq((0.0, 1.0)) ++ pr
val prCurve = Seq((0.0, 0.0)) ++ pr
Copy link
Member Author

Choose a reason for hiding this comment

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

(This was the only actual test change)

@srowen
Copy link
Member Author

srowen commented Aug 30, 2017

Merged to master

@asfgit asfgit closed this in 734ed7a Aug 30, 2017
@srowen srowen deleted the SPARK-21806 branch August 30, 2017 10:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants