zhengruifeng commented on a change in pull request #32124:
URL: https://github.com/apache/spark/pull/32124#discussion_r613816728



##########
File path: python/pyspark/ml/tests/test_training_summary.py
##########
@@ -223,12 +223,12 @@ def test_linear_svc_summary(self):
         self.assertTrue(isinstance(s.precisionByThreshold, DataFrame))
         self.assertTrue(isinstance(s.recallByThreshold, DataFrame))
         print(s.weightedTruePositiveRate)
-        self.assertAlmostEqual(s.weightedTruePositiveRate, 0.5, 2)
-        self.assertAlmostEqual(s.weightedFalsePositiveRate, 0.5, 2)
-        self.assertAlmostEqual(s.weightedRecall, 0.5, 2)
-        self.assertAlmostEqual(s.weightedPrecision, 0.25, 2)
-        self.assertAlmostEqual(s.weightedFMeasure(), 0.3333333333333333, 2)
-        self.assertAlmostEqual(s.weightedFMeasure(1.0), 0.3333333333333333, 2)
+        self.assertAlmostEqual(s.weightedTruePositiveRate, 1.0, 2)
+        self.assertAlmostEqual(s.weightedFalsePositiveRate, 0.0, 2)
+        self.assertAlmostEqual(s.weightedRecall, 1.0, 2)
+        self.assertAlmostEqual(s.weightedPrecision, 1.0, 2)
+        self.assertAlmostEqual(s.weightedFMeasure(), 1.0, 2)
+        self.assertAlmostEqual(s.weightedFMeasure(1.0), 1.0, 2)

Review comment:
       this test used dataset of only 2 instances, which seems unreliable.
   But the new solution has better metrics (weightedFMeasure 0.5 -> 1.0)  




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]



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

Reply via email to