File tree Expand file tree Collapse file tree 2 files changed +4
-3
lines changed
mllib/src/main/scala/org/apache/spark/mllib/clustering Expand file tree Collapse file tree 2 files changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -210,14 +210,15 @@ class LDA private (
210
210
211
211
/**
212
212
* Set the LDAOptimizer used to perform the actual calculation by algorithm name.
213
- * Currently "em" is supported.
213
+ * Currently "em", "online" is supported.
214
214
*/
215
215
def setOptimizer (optimizerName : String ): this .type = {
216
216
this .ldaOptimizer =
217
217
optimizerName.toLowerCase match {
218
218
case " em" => new EMLDAOptimizer
219
+ case " online" => new OnlineLDAOptimizer
219
220
case other =>
220
- throw new IllegalArgumentException (s " Only em is supported but got $other. " )
221
+ throw new IllegalArgumentException (s " Only em, online are supported but got $other. " )
221
222
}
222
223
this
223
224
}
Original file line number Diff line number Diff line change @@ -396,7 +396,7 @@ class OnlineLDAOptimizer extends LDAOptimizer {
396
396
val batchResult = statsSum :* expElogbeta
397
397
398
398
// Note that this is an optimization to avoid batch.count
399
- update(batchResult, iteration, (miniBatchFraction * corpusSize).toInt)
399
+ update(batchResult, iteration, (miniBatchFraction * corpusSize).ceil. toInt)
400
400
this
401
401
}
402
402
You can’t perform that action at this time.
0 commit comments