Github user jkbradley commented on a diff in the pull request:

    https://github.com/apache/spark/pull/7916#discussion_r36156091
  
    --- Diff: 
mllib/src/main/scala/org/apache/spark/mllib/clustering/LDAModel.scala ---
    @@ -267,32 +272,35 @@ class LocalLDAModel private[clustering] (
         // by topic (columns of lambda)
         val Elogbeta = LDAUtils.dirichletExpectation(lambda.t).t
     
    -    var score = documents.filter(_._2.numNonzeros > 0).map { case (id: 
Long, termCounts: Vector) =>
    -      var docScore = 0.0D
    -      val (gammad: BDV[Double], _) = 
OnlineLDAOptimizer.variationalTopicInference(
    -        termCounts, exp(Elogbeta), brzAlpha, gammaShape, k)
    -      val Elogthetad: BDV[Double] = LDAUtils.dirichletExpectation(gammad)
    -
    -      // E[log p(doc | theta, beta)]
    -      termCounts.foreachActive { case (idx, count) =>
    -        docScore += count * LDAUtils.logSumExp(Elogthetad + Elogbeta(idx, 
::).t)
    -      }
    -      // E[log p(theta | alpha) - log q(theta | gamma)]; assumes alpha is 
a vector
    -      docScore += sum((brzAlpha - gammad) :* Elogthetad)
    -      docScore += sum(lgamma(gammad) - lgamma(brzAlpha))
    -      docScore += lgamma(sum(brzAlpha)) - lgamma(sum(gammad))
    -
    -      docScore
    -    }.sum()
    +    // Sum bound components for each document:
    +    //  component for prob(tokens) + component for prob(document-topic 
distribution)
    --- End diff --
    
    Yes, it was meant to be clearer...hm


---
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]

Reply via email to