Github user jkbradley commented on a diff in the pull request:
https://github.com/apache/spark/pull/7454#discussion_r35070523
--- Diff:
mllib/src/main/scala/org/apache/spark/mllib/clustering/LDAOptimizer.scala ---
@@ -387,39 +387,32 @@ final class OnlineLDAOptimizer extends LDAOptimizer {
}
// Initialize the variational distribution q(theta|gamma) for the
mini-batch
- var gammad = new Gamma(gammaShape, 1.0 /
gammaShape).samplesVector(k).t // 1 * K
- var Elogthetad = digamma(gammad) - digamma(sum(gammad)) // 1 *
K
- var expElogthetad = exp(Elogthetad) // 1 *
K
- val expElogbetad = expElogbeta(::, ids).toDenseMatrix // K *
ids
+ var gammad: BDV[Double] =
+ new Gamma(gammaShape, 1.0 / gammaShape).samplesVector(k)
// K
+ val expElogthetad: BDV[Double] = exp(digamma(gammad) -
digamma(sum(gammad))) // K
+ val expElogbetad: BDM[Double] = expElogbeta(ids, ::).toDenseMatrix
// ids * K
- var phinorm = expElogthetad * expElogbetad + 1e-100 // 1 *
ids
+ var phinorm: BDV[Double] = expElogbetad * expElogthetad :+ 1e-100
// ids
--- End diff --
Should this be a val since you use Breeze to mutate the internals?
---
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]