Github user tgaloppo commented on a diff in the pull request:
https://github.com/apache/spark/pull/3923#discussion_r22628165
--- 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 --
Calculating log(pdetSigma) that way will incur a performance penalty
(calling log for each singular value), but it is probably more numerically
stable.
---
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]