Github user jkbradley commented on a diff in the pull request:
https://github.com/apache/spark/pull/7064#discussion_r33716305
--- Diff:
mllib/src/test/scala/org/apache/spark/mllib/clustering/LDASuite.scala ---
@@ -99,9 +99,15 @@ class LDASuite extends SparkFunSuite with
MLlibTestSparkContext {
// Check: per-doc topic distributions
val topicDistributions = model.topicDistributions.collect()
+
// Ensure all documents are covered.
- assert(topicDistributions.length === tinyCorpus.length)
- assert(tinyCorpus.map(_._1).toSet ===
topicDistributions.map(_._1).toSet)
+ // SPARK-5562. since the topicDistribution returns the distribution of
docsI over topics .
+ // for empty docs, since the distribution of topic won't sum to 1 (and
hence it is not a pdf)
+ // So the output will not contain the empty docs and hence we modify
the unittest to
+ // compare against nonEmptyTinyCorpus
+ val nonEmptyTinyCorpus = getNonEmptyDoc(tinyCorpus)
+ assert(topicDistributions.length === nonEmptyTinyCorpus.length)
--- End diff --
I disagree; there should be topicDistributions for each empty document,
probably set to the prior for the corpus. I think this points to a deeper
problem. I'll comment on that elsewhere.
---
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]