Skip to content

Commit

Permalink
fix for setOptimizer
Browse files Browse the repository at this point in the history
  • Loading branch information
hhbyyh committed May 1, 2015
1 parent cf0007d commit 6149ca6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -210,14 +210,15 @@ class LDA private (

/**
* Set the LDAOptimizer used to perform the actual calculation by algorithm name.
* Currently "em" is supported.
* Currently "em", "online" is supported.
*/
def setOptimizer(optimizerName: String): this.type = {
this.ldaOptimizer =
optimizerName.toLowerCase match {
case "em" => new EMLDAOptimizer
case "online" => new OnlineLDAOptimizer
case other =>
throw new IllegalArgumentException(s"Only em is supported but got $other.")
throw new IllegalArgumentException(s"Only em, online are supported but got $other.")
}
this
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@ class OnlineLDAOptimizer extends LDAOptimizer {
val batchResult = statsSum :* expElogbeta

// Note that this is an optimization to avoid batch.count
update(batchResult, iteration, (miniBatchFraction * corpusSize).toInt)
update(batchResult, iteration, (miniBatchFraction * corpusSize).ceil.toInt)
this
}

Expand Down

0 comments on commit 6149ca6

Please sign in to comment.