kaknikhil 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_r320473209
 
 

 ##########
 File path: src/ports/postgres/modules/lda/lda.py_in
 ##########
 @@ -191,7 +199,32 @@ class LDATrainer:
         # etime = time.time()
         # plpy.notice('\t\ttime elapsed: %.2f seconds' % (etime - stime))
 
+        # JIRA: MADLIB-1351
+        # Calculate Perplexity for evaluate_every Iteration
+        # Skil the calculation at the first iteration as the model generated
+        # at first iteration is a random model
+        if it > self.evaluate_every and self.evaluate_every > 0 and (
 
 Review comment:
   1. we already assert that evaluate_every >=0 (line 514) , we don't need to 
repeat this check. 
   2. Unless I am missing something, the whole if check can be simplified by 
skipping the perplexity calculation when `it == 0` instead of using `it` and 
`it-1`.
   3. We could move this code logic (lines 206 - 216) to it's own function and 
unit test all the logic. 

----------------------------------------------------------------
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