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

    https://github.com/apache/spark/pull/7760#discussion_r35893047
  
    --- Diff: 
mllib/src/main/scala/org/apache/spark/mllib/clustering/LDAModel.scala ---
    @@ -297,6 +294,33 @@ class LocalLDAModel private[clustering] (
         score
       }
     
    +  /**
    +   * Predicts the topic mixture distribution ("gamma") for a document. 
Returns a vector of zeros for
    +   * an empty document.
    +   * @param documents documents to predict topic mixture distributions for
    +   * @return topic mixture distributions for each document
    +   */
    +  // TODO: declare in LDAModel and override once implemented in 
DistributedLDAModel
    +  def topicDistributions(documents: RDD[(Long, Vector)]): RDD[(Long, 
Vector)] = {
    +    // Double transpose because dirichletExpectation normalizes by row and 
we need to normalize
    +    // by topic (columns of lambda)
    +    val expElogbeta = 
exp(LDAUtils.dirichletExpectation(topicsMatrix.toBreeze.toDenseMatrix.t).t)
    +    val topicConcentrationBrz = this.docConcentration.toBreeze
    --- End diff --
    
    OK


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