Skip to content

Commit

Permalink
Retraining not required at inferencing time
Browse files Browse the repository at this point in the history
Retraining not required at inferencing time
  • Loading branch information
rezacsedu authored Nov 29, 2018
1 parent e33f9be commit 14117be
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions Chapter05/TopicModelling/topicModellingwithLDA.scala
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class LDAforTM() {
.appName(s"OneVsRestExample")
.getOrCreate()

def run(params: Params): Unit = {
def run(params: Params, flag:Boolean): Unit = {
Logger.getRootLogger.setLevel(Level.WARN)

// Load documents, and prepare them for LDA.
Expand Down Expand Up @@ -92,7 +92,8 @@ class LDAforTM() {
val elapsed = (System.nanoTime() - startTime) / 1e9

//Saving the model for future use
params.ldaModel.save(spark.sparkContext, "model/LDATrainedModel")
if(flag == true)
params.ldaModel.save(spark.sparkContext, "model/LDATrainedModel")

println("Finished training LDA model. Summary:")
println("Training time: " + elapsed + " sec")
Expand Down Expand Up @@ -196,4 +197,4 @@ object helperForLDA {
}
string.toString()
}
}
}

0 comments on commit 14117be

Please sign in to comment.