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

    • Improvement
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 2.4.3
    • 3.0.0
    • ML
    • None

    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

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

              Dates

                Created:
                Updated:
                Resolved: