-
- Downloads
SPARK-2748 [MLLIB] [GRAPHX] Loss of precision for small arguments to Math.exp, Math.log
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 note the related PR for Python: https://github.com/apache/spark/pull/1652 Author: Sean Owen <srowen@gmail.com> Closes #1659 from srowen/SPARK-2748 and squashes the following commits: c5926d4 [Sean Owen] Use log1p, expm1 for better precision for tiny arguments
Showing
- graphx/src/main/scala/org/apache/spark/graphx/util/GraphGenerators.scala 4 additions, 2 deletions.../scala/org/apache/spark/graphx/util/GraphGenerators.scala
- mllib/src/main/scala/org/apache/spark/mllib/optimization/Gradient.scala 4 additions, 4 deletions.../scala/org/apache/spark/mllib/optimization/Gradient.scala
Please register or sign in to comment