Github user jkbradley commented on a diff in the pull request:
https://github.com/apache/spark/pull/7705#discussion_r35818044
--- Diff:
mllib/src/main/scala/org/apache/spark/mllib/clustering/LDAModel.scala ---
@@ -197,8 +229,92 @@ class LocalLDAModel private[clustering] (
// TODO:
// override def topicDistributions(documents: RDD[(Long, Vector)]):
RDD[(Long, Vector)] = ???
+ /**
+ * Calculate and return log variational bound on perplexity using the
provided `documents` of
+ * documents as a test corpus.
+ * Perplexity on a test corpus is calculated as:
+ * perplexity(documents) = exp( -log p(documents) / numWords )
+ * where p is the LDA model. It is upper bounded by the variational
distribution using:
+ * perplexity(documents) <= exp( -(E_q[log p(documents] - E_q[log
q(documents)]) / numWords }
--- End diff --
Now that I see it, this description seems too simplified to be useful.
E.g., "p(documents)" and "q(documents)" are misleading since they are actually
distributions over different sets of random variables. But including full
details sounds too complex. How about keeping lines 233-235 and replacing the
equations with a reference to Eq 16 in the Online LDA paper?
Also, state that this is returning the log perplexity per word.
---
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]