You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by "zhengruifeng (via GitHub)" <gi...@apache.org> on 2023/07/12 03:06:41 UTC

[GitHub] [spark] zhengruifeng commented on a diff in pull request #41947: [SPARK-44217][PYTHON] Allow custom precision for fp approx equality

zhengruifeng commented on code in PR #41947:
URL: https://github.com/apache/spark/pull/41947#discussion_r1260511824


##########
python/pyspark/testing/utils.py:
##########
@@ -243,6 +245,10 @@ def assertDataFrameEqual(df: DataFrame, expected: DataFrame, check_row_order: bo
         If set to `False` (default), the row order is not taken into account.
         If set to `True`, the order of rows is important and will be checked during comparison.
 
+    precision : float, optional
+        The level of precision when asserting approximate equality for float values in df
+        and expected. Set to 1e-5 by default.

Review Comment:
   good point, we actually use `rtol` and `atol` in both scala and python:
   
   in python:
   
   https://github.com/apache/spark/blob/5a702f22f49ca6a1b6220ac645e3fce70ec5189d/python/pyspark/ml/tests/test_algorithms.py#L390-L396
   
   https://github.com/apache/spark/blob/f3edc0c3570ea4b28f68607d6404c6b8d0801161/python/pyspark/pandas/tests/plot/test_series_plot_matplotlib.py#L364-L367
   
   in scala:
   
   https://github.com/apache/spark/blob/d679dabdd1b5ad04b8c7deb1c06ce886a154a928/mllib/src/test/scala/org/apache/spark/ml/classification/LogisticRegressionSuite.scala#L379-L400
   
   https://github.com/apache/spark/blob/d679dabdd1b5ad04b8c7deb1c06ce886a154a928/mllib/src/test/scala/org/apache/spark/ml/regression/GeneralizedLinearRegressionSuite.scala#L1021-L1040



-- 
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.

To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org