hpandeycodeit commented on a change in pull request #432: MADLIB-1351 : Added 
stopping criteria on perplexity to LDA
URL: https://github.com/apache/madlib/pull/432#discussion_r321872607
 
 

 ##########
 File path: src/ports/postgres/modules/lda/lda.py_in
 ##########
 @@ -135,20 +143,20 @@ class LDATrainer:
         # iteration to sycn up output table and model table
         self.update_model_table(work_table_final)
 
-        # Update output table
-        plpy.execute("TRUNCATE TABLE " + self.output_data_table)
-        plpy.execute("""
-            INSERT INTO {output_data_table}
-            SELECT
-                docid, wordcount, words, counts, doc_topic[1:{topic_num}] 
topic_count,
-                doc_topic[{topic_num} + 1:array_upper(doc_topic,1)] 
topic_assignment
-            FROM
-                {work_table_final}
-            """.format(output_data_table=self.output_data_table,
-                       topic_num=self.topic_num,
-                       work_table_final=work_table_final))
-        # etime = time.time()
-        # plpy.notice('\t\t\ttime elapsed: %.2f seconds' % (etime - stime))
+        self.gen_output_data_table(work_table_final)
+
+        # JIRA: MADLIB-1351
+        # Calculate Perplexity after the final update of
+        # the Model and Output Table
+        if self.evaluate_every > 0:
+            self.perplexity.append(
+                get_perplexity('madlib',
 
 Review comment:
   done

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to