Skip to content
This repository was archived by the owner on Dec 15, 2025. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ package com.intel.hibench.sparkbench.ml

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

import org.apache.spark.mllib.clustering.{DistributedLDAModel, LDA}
import org.apache.spark.mllib.clustering.{LDA, DistributedLDAModel, LocalLDAModel}
import org.apache.spark.mllib.linalg.{Vector, Vectors}
import org.apache.spark.rdd.RDD

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

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

// Save and load model.
ldaModel.save(sc, outputPath)
val sameModel = DistributedLDAModel.load(sc, outputPath)
val savedModel = LocalLDAModel.load(sc, outputPath)

sc.stop()
}
Expand Down