File tree Expand file tree Collapse file tree 1 file changed +5
-6
lines changed
mllib/src/main/scala/org/apache/spark/mllib/api/python Expand file tree Collapse file tree 1 file changed +5
-6
lines changed Original file line number Diff line number Diff line change 1616 */
1717package org .apache .spark .mllib .api .python
1818
19+ import scala .collection .JavaConverters
20+
1921import org .apache .spark .SparkContext
2022import org .apache .spark .mllib .clustering .LDAModel
2123import org .apache .spark .mllib .linalg .Matrix
@@ -32,14 +34,11 @@ private[python] class LDAModelWrapper(model: LDAModel) {
3234 def describeTopics (): java.util.List [Array [Any ]] = describeTopics(this .model.vocabSize)
3335
3436 def describeTopics (maxTermsPerTopic : Int ): java.util.List [Array [Any ]] = {
35- import scala .collection .JavaConversions ._
3637
37- val javaList : java.util.List [Array [Any ]] =
38- model.describeTopics(maxTermsPerTopic).map { case (terms, termWeights) =>
39- var array = Array .empty[Any ]
38+ val seq = model.describeTopics(maxTermsPerTopic).map { case (terms, termWeights) =>
4039 Array .empty[Any ] ++ terms ++ termWeights
41- }.toList
42- javaList
40+ }.toSeq
41+ JavaConverters .seqAsJavaListConverter(seq).asJava
4342 }
4443
4544 def save (sc : SparkContext , path : String ): Unit = model.save(sc, path)
You can’t perform that action at this time.
0 commit comments