diff options
author | Xiangrui Meng <meng@databricks.com> | 2015-04-23 14:46:54 -0700 |
---|---|---|
committer | Xiangrui Meng <meng@databricks.com> | 2015-04-23 14:46:54 -0700 |
commit | 1ed46a60adacb352b385d2331401822a5a2c55c0 (patch) | |
tree | a87bd5135bade5ba267194881e4a7b8298716c38 | |
parent | 6d0749cae301ee4bf37632d657de48e75548a523 (diff) | |
download | spark-1ed46a60adacb352b385d2331401822a5a2c55c0.tar.gz spark-1ed46a60adacb352b385d2331401822a5a2c55c0.tar.bz2 spark-1ed46a60adacb352b385d2331401822a5a2c55c0.zip |
[SPARK-7070] [MLLIB] LDA.setBeta should call setTopicConcentration.
jkbradley
Author: Xiangrui Meng <meng@databricks.com>
Closes #5649 from mengxr/SPARK-7070 and squashes the following commits:
c66023c [Xiangrui Meng] setBeta should call setTopicConcentration
-rw-r--r-- | mllib/src/main/scala/org/apache/spark/mllib/clustering/LDA.scala | 2 | ||||
-rw-r--r-- | mllib/src/test/scala/org/apache/spark/mllib/clustering/LDASuite.scala | 8 |
2 files changed, 9 insertions, 1 deletions
diff --git a/mllib/src/main/scala/org/apache/spark/mllib/clustering/LDA.scala b/mllib/src/main/scala/org/apache/spark/mllib/clustering/LDA.scala index 9d63a08e21..d006b39acb 100644 --- a/mllib/src/main/scala/org/apache/spark/mllib/clustering/LDA.scala +++ b/mllib/src/main/scala/org/apache/spark/mllib/clustering/LDA.scala @@ -177,7 +177,7 @@ class LDA private ( def getBeta: Double = getTopicConcentration /** Alias for [[setTopicConcentration()]] */ - def setBeta(beta: Double): this.type = setBeta(beta) + def setBeta(beta: Double): this.type = setTopicConcentration(beta) /** * Maximum number of iterations for learning. diff --git a/mllib/src/test/scala/org/apache/spark/mllib/clustering/LDASuite.scala b/mllib/src/test/scala/org/apache/spark/mllib/clustering/LDASuite.scala index 15de10fd13..cc747dabb9 100644 --- a/mllib/src/test/scala/org/apache/spark/mllib/clustering/LDASuite.scala +++ b/mllib/src/test/scala/org/apache/spark/mllib/clustering/LDASuite.scala @@ -123,6 +123,14 @@ class LDASuite extends FunSuite with MLlibTestSparkContext { assert(termVertexIds.map(i => LDA.index2term(i.toLong)) === termIds) assert(termVertexIds.forall(i => LDA.isTermVertex((i.toLong, 0)))) } + + test("setter alias") { + val lda = new LDA().setAlpha(2.0).setBeta(3.0) + assert(lda.getAlpha === 2.0) + assert(lda.getDocConcentration === 2.0) + assert(lda.getBeta === 3.0) + assert(lda.getTopicConcentration === 3.0) + } } private[clustering] object LDASuite { |