Skip to content
This repository was archived by the owner on Dec 15, 2025. It is now read-only.

Commit a1dca4b

Browse files
author
Meng, Peng
authored
Merge pull request #503 from jtengyp/lda
Change LDA Optimization Method
2 parents 2dbd6ab + b661a1c commit a1dca4b

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

sparkbench/ml/src/main/scala/com/intel/sparkbench/ml/LDAExample.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ package com.intel.hibench.sparkbench.ml
1919

2020
import org.apache.spark.{SparkConf, SparkContext}
2121

22-
import org.apache.spark.mllib.clustering.{DistributedLDAModel, LDA}
22+
import org.apache.spark.mllib.clustering.{LDA, DistributedLDAModel, LocalLDAModel}
2323
import org.apache.spark.mllib.linalg.{Vector, Vectors}
2424
import org.apache.spark.rdd.RDD
2525

@@ -51,11 +51,11 @@ object LDAExample {
5151
val corpus: RDD[(Long, Vector)] = sc.objectFile(inputPath)
5252

5353
// Cluster the documents into numTopics topics using LDA
54-
val ldaModel = new LDA().setK(numTopics).run(corpus)
54+
val ldaModel = new LDA().setK(numTopics).setOptimizer("online").run(corpus)
5555

5656
// Save and load model.
5757
ldaModel.save(sc, outputPath)
58-
val sameModel = DistributedLDAModel.load(sc, outputPath)
58+
val savedModel = LocalLDAModel.load(sc, outputPath)
5959

6060
sc.stop()
6161
}

0 commit comments

Comments
 (0)