Github user mengxr commented on a diff in the pull request:

    https://github.com/apache/spark/pull/5374#discussion_r27808046
  
    --- Diff: python/pyspark/mllib/tests.py ---
    @@ -363,6 +363,13 @@ def test_col_norms(self):
             self.assertEqual(10, len(summary.normL1()))
             self.assertEqual(10, len(summary.normL2()))
     
    +        data2 = self.sc.parallelize(xrange(10)).map(lambda x: 
Vectors.dense(x))
    +        summary2 = Statistics.colStats(data2)
    +        self.assertEqual(array([45.0]), summary2.normL1())
    +        # Confirm normL2 is among this span because it is a float value.
    +        self.assertTrue(summary2.normL2()[0] > 16.5)
    --- End diff --
    
    The bounds are too loose. We should reach machine precision for this.
    
    ~~~
    import math
    expectedNormL2 = math.sqrt(sum(map(lambda x: x*x, xrange(10))))
    self.assertTrue(math.abs(summary2.normL2()[0] - expectedNormL2) < 1e-14)
    ~~~


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

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

Reply via email to