[jira] [Commented] (SPARK-2748) Loss of precision for small arguments to Math.exp, Math.log
[ https://issues.apache.org/jira/browse/SPARK-2748?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14079207#comment-14079207 ] Apache Spark commented on SPARK-2748: - User 'srowen' has created a pull request for this issue: https://github.com/apache/spark/pull/1659 Loss of precision for small arguments to Math.exp, Math.log --- Key: SPARK-2748 URL: https://issues.apache.org/jira/browse/SPARK-2748 Project: Spark Issue Type: Bug Components: GraphX, MLlib Affects Versions: 1.0.1 Reporter: Sean Owen Priority: Minor In a few places in MLlib, an expression of the form log(1.0 + p) is evaluated. When p is so small that 1.0 + p == 1.0, the result is 0.0. However the correct answer is very near p. This is why Math.log1p exists. Similarly for one instance of exp(m) - 1 in GraphX; there's a special Math.expm1 method. While the errors occur only for very small arguments, given their use in machine learning algorithms, this is entirely possible. Also, while we're here, naftaliharris discovered a case in Python where 1 - 1 / (1 + exp(margin)) is less accurate than exp(margin) / (1 + exp(margin)). I don't think there's a JIRA on that one, so maybe this can serve as an umbrella for all of these related issues. -- This message was sent by Atlassian JIRA (v6.2#6252)
[jira] [Commented] (SPARK-2748) Loss of precision for small arguments to Math.exp, Math.log
[ https://issues.apache.org/jira/browse/SPARK-2748?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14079208#comment-14079208 ] Sean Owen commented on SPARK-2748: -- PR: https://github.com/apache/spark/pull/1659 See also: https://github.com/apache/spark/pull/1652 Loss of precision for small arguments to Math.exp, Math.log --- Key: SPARK-2748 URL: https://issues.apache.org/jira/browse/SPARK-2748 Project: Spark Issue Type: Bug Components: GraphX, MLlib Affects Versions: 1.0.1 Reporter: Sean Owen Priority: Minor In a few places in MLlib, an expression of the form log(1.0 + p) is evaluated. When p is so small that 1.0 + p == 1.0, the result is 0.0. However the correct answer is very near p. This is why Math.log1p exists. Similarly for one instance of exp(m) - 1 in GraphX; there's a special Math.expm1 method. While the errors occur only for very small arguments, given their use in machine learning algorithms, this is entirely possible. Also, while we're here, naftaliharris discovered a case in Python where 1 - 1 / (1 + exp(margin)) is less accurate than exp(margin) / (1 + exp(margin)). I don't think there's a JIRA on that one, so maybe this can serve as an umbrella for all of these related issues. -- This message was sent by Atlassian JIRA (v6.2#6252)