Github user jkbradley commented on a diff in the pull request:
https://github.com/apache/spark/pull/3923#discussion_r22623139
--- Diff:
mllib/src/main/scala/org/apache/spark/mllib/stat/impl/MultivariateGaussian.scala
---
@@ -91,7 +127,7 @@ private[mllib] class MultivariateGaussian(
// by inverting the square root of all non-zero values
val pinvS = diag(new DBV(d.map(v => if (v > tol) math.sqrt(1.0 / v)
else 0.0).toArray))
- (pinvS * u, math.pow(2.0 * math.Pi, -mu.length / 2.0) *
math.pow(pdetSigma, -0.5))
+ (pinvS * u, math.log(math.pow(2.0 * math.Pi, -mu.length / 2.0) *
math.pow(pdetSigma, -0.5)))
--- End diff --
This should skip the log(pow("stuff")) combination and just have "stuff"
(with the log moved inside of "stuff"), in order to skip the math.pow call.
Also, since you'll need log(pdetSigma), you can compute that from the
beginning, using a sum instead of multiplying in line 124.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]