Skip to content

Commit e76317b

Browse files
committed
[SPARK-7070] [MLLIB] LDA.setBeta should call setTopicConcentration.
jkbradley Author: Xiangrui Meng <[email protected]> Closes #5649 from mengxr/SPARK-7070 and squashes the following commits: c66023c [Xiangrui Meng] setBeta should call setTopicConcentration (cherry picked from commit 1ed46a6) Signed-off-by: Xiangrui Meng <[email protected]>
1 parent 3b38cac commit e76317b

2 files changed

Lines changed: 9 additions & 1 deletion

File tree

  • mllib/src

mllib/src/main/scala/org/apache/spark/mllib/clustering/LDA.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ class LDA private (
177177
def getBeta: Double = getTopicConcentration
178178

179179
/** Alias for [[setTopicConcentration()]] */
180-
def setBeta(beta: Double): this.type = setBeta(beta)
180+
def setBeta(beta: Double): this.type = setTopicConcentration(beta)
181181

182182
/**
183183
* Maximum number of iterations for learning.

mllib/src/test/scala/org/apache/spark/mllib/clustering/LDASuite.scala

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,14 @@ class LDASuite extends FunSuite with MLlibTestSparkContext {
123123
assert(termVertexIds.map(i => LDA.index2term(i.toLong)) === termIds)
124124
assert(termVertexIds.forall(i => LDA.isTermVertex((i.toLong, 0))))
125125
}
126+
127+
test("setter alias") {
128+
val lda = new LDA().setAlpha(2.0).setBeta(3.0)
129+
assert(lda.getAlpha === 2.0)
130+
assert(lda.getDocConcentration === 2.0)
131+
assert(lda.getBeta === 3.0)
132+
assert(lda.getTopicConcentration === 3.0)
133+
}
126134
}
127135

128136
private[clustering] object LDASuite {

0 commit comments

Comments
 (0)