Github user srowen commented on a diff in the pull request:
https://github.com/apache/spark/pull/20070#discussion_r159129816
--- Diff:
examples/src/main/scala/org/apache/spark/examples/mllib/LatentDirichletAllocationExample.scala
---
@@ -42,11 +42,11 @@ object LatentDirichletAllocationExample {
val ldaModel = new LDA().setK(3).run(corpus)
// Output topics. Each is a distribution over words (matching word
count vectors)
- println("Learned topics (as distributions over vocab of " +
ldaModel.vocabSize + " words):")
+ println(s"Learned topics (as distributions over vocab of
${ldaModel.vocabSize} words):")
val topics = ldaModel.topicsMatrix
for (topic <- Range(0, 3)) {
- print("Topic " + topic + ":")
- for (word <- Range(0, ldaModel.vocabSize)) { print(" " +
topics(word, topic)); }
+ print(s"Topic $topic :")
+ for (word <- Range(0, ldaModel.vocabSize)) { print(s" ${topics(word,
topic)}") }
--- End diff --
Go ahead and put the print on a new line (I know it wasn't before)
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]