File tree Expand file tree Collapse file tree 2 files changed +10
-7
lines changed
mllib/src/main/scala/org/apache/spark/mllib/clustering Expand file tree Collapse file tree 2 files changed +10
-7
lines changed Original file line number Diff line number Diff line change @@ -82,9 +82,11 @@ class LDA private (
8282 def getAsymmetricDocConcentration : Vector = this .docConcentration
8383
8484 /**
85- * Gets the concentration parameter, assuming the document-topic Dirichlet distribution is
86- * symmetric. Included for backwards compatibility. This method should fail if
87- * [[docConcentration ]] is asymmetric.
85+ * Concentration parameter (commonly named "alpha") for the prior placed on documents'
86+ * distributions over topics ("theta").
87+ *
88+ * This method assumes the Dirichlet distribution is symmetric and can be described by a single
89+ * [[Double ]] parameter. It should fail if docConcentration is asymmetric.
8890 */
8991 def getDocConcentration : Double = {
9092 val parameter = docConcentration(0 )
@@ -121,6 +123,7 @@ class LDA private (
121123 * [[https://github.com/Blei-Lab/onlineldavb ]].
122124 */
123125 def setDocConcentration (docConcentration : Vector ): this .type = {
126+ require(docConcentration.size > 0 , " docConcentration must have > 0 elements" )
124127 this .docConcentration = docConcentration
125128 this
126129 }
Original file line number Diff line number Diff line change @@ -189,8 +189,8 @@ class LocalLDAModel private[clustering] (
189189 val topics : Matrix ,
190190 override val docConcentration : Vector ,
191191 override val topicConcentration : Double ,
192- override protected [clustering] val gammaShape : Double = 100
193- ) extends LDAModel with Serializable {
192+ override protected [clustering] val gammaShape : Double = 100 )
193+ extends LDAModel with Serializable {
194194
195195 override def k : Int = topics.numCols
196196
@@ -456,8 +456,8 @@ class DistributedLDAModel private[clustering] (
456456 override val docConcentration : Vector ,
457457 override val topicConcentration : Double ,
458458 private [spark] val iterationTimes : Array [Double ],
459- override protected [clustering] val gammaShape : Double = 100
460- ) extends LDAModel {
459+ override protected [clustering] val gammaShape : Double = 100 )
460+ extends LDAModel {
461461
462462 import LDA ._
463463
You can’t perform that action at this time.
0 commit comments