Skip to content
Closed
Changes from all commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ final class EMLDAOptimizer extends LDAOptimizer {
// For each document, create an edge (Document -> Term) for each unique term in the document.
val edges: RDD[Edge[TokenCount]] = docs.flatMap { case (docID: Long, termCounts: Vector) =>
// Add edges for terms with non-zero counts.
termCounts.asBreeze.activeIterator.filter(_._2 != 0.0).map { case (term, cnt) =>
termCounts.nonZeroIterator.map { case (term, cnt) =>
Edge(docID, term2index(term), cnt)
}
}
Expand Down Expand Up @@ -211,11 +211,14 @@ final class EMLDAOptimizer extends LDAOptimizer {
val docTopicDistributions: VertexRDD[TopicCounts] =
graph.aggregateMessages[(Boolean, TopicCounts)](sendMsg, mergeMsg)
.mapValues(_._2)
val prevGraph = graph
Copy link
Member

Choose a reason for hiding this comment

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

I buy it, but where is graph persisted again?

Copy link
Member

Choose a reason for hiding this comment

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

@zhengruifeng I'm still kind of curious, but trust your judgment so I will merge it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks! I am on the holidy, so can no reply quickly.
Current change is following what Pregel does,
I will go on looking into it, since the persistance in GraphX is a little complex.

// Update the vertex descriptors with the new counts.
val newGraph = Graph(docTopicDistributions, graph.edges)
graph = newGraph
graphCheckpointer.update(newGraph)
globalTopicTotals = computeGlobalTopicTotals()
prevGraph.unpersistVertices()
prevGraph.edges.unpersist()
this
}

Expand Down