Uploaded image for project: 'Spark'
  1. Spark
  2. SPARK-28604

Use log1p(x) instead of log(1+x) and expm1(x) instead of exp(x)-1

    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.4.3
    • Fix Version/s: 3.0.0
    • Component/s: ML
    • Labels:
      None
    • Target Version/s:

      Description

      Following https://issues.apache.org/jira/browse/SPARK-28519, I noticed that there are number of places in the MLlib code that may be, for example, computing log(1+x) where x is very small. All math libraries specialize for this case with log1p for better accuracy. Same for expm1. It shouldn't hurt to use log1p/expm1 where possible and in a few cases I think it will improve accuracy, as sometimes x is for example a very small probability.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                srowen Sean R. Owen
                Reporter:
                srowen Sean R. Owen
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: