Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
small cleanup
  • Loading branch information
jkbradley committed Aug 20, 2015
commit eed83b1b07f526eea8d70db7b19b615ce83a448a
Original file line number Diff line number Diff line change
Expand Up @@ -605,8 +605,10 @@ class DistributedLDAModel private[clustering] (
(terms_topics0._1 ++ terms_topics1._1, terms_topics0._2 ++ terms_topics1._2)
}
// M-STEP: Aggregation computes new N_{kj}, N_{wk} counts.
graph.aggregateMessages[(Array[Int], Array[Int])](sendMsg, mergeMsg).filter(isDocumentVertex)
.map { case (docID: Long, (terms: Array[Int], topics: Array[Int])) =>
val perDocAssignments =
graph.aggregateMessages[(Array[Int], Array[Int])](sendMsg, mergeMsg).filter(isDocumentVertex)
perDocAssignments.map { case (docID: Long, (terms: Array[Int], topics: Array[Int])) =>
// TODO: Avoid zip, which is inefficient.
val (sortedTerms, sortedTopics) = terms.zip(topics).sortBy(_._1).unzip
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Leave a TODO because zip is not efficient

(docID, sortedTerms.toArray, sortedTopics.toArray)
}
Expand Down