Return-Path: X-Original-To: apmail-spark-issues-archive@minotaur.apache.org Delivered-To: apmail-spark-issues-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id D13AB115C7 for ; Wed, 30 Jul 2014 11:42:38 +0000 (UTC) Received: (qmail 49174 invoked by uid 500); 30 Jul 2014 11:42:38 -0000 Delivered-To: apmail-spark-issues-archive@spark.apache.org Received: (qmail 49144 invoked by uid 500); 30 Jul 2014 11:42:38 -0000 Mailing-List: contact issues-help@spark.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@spark.apache.org Delivered-To: mailing list issues@spark.apache.org Received: (qmail 49134 invoked by uid 99); 30 Jul 2014 11:42:38 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 30 Jul 2014 11:42:38 +0000 Date: Wed, 30 Jul 2014 11:42:38 +0000 (UTC) From: "Apache Spark (JIRA)" To: issues@spark.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (SPARK-2748) Loss of precision for small arguments to Math.exp, Math.log MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/SPARK-2748?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=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)