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_r324803335
##########
File path: src/ports/postgres/modules/lda/test/lda.sql_in
##########
@@ -288,3 +288,126 @@ CREATE OR REPLACE FUNCTION validate_lda_output() RETURNS
integer AS $$
$$ LANGUAGE plpgsql;
select validate_lda_output();
+
+
+---------- TEST CASES FOR PERPLEXITY ----------
+
+drop table if exists lda_model, lda_output_data;
+SELECT lda_train(
+ 'lda_training',
+ 'lda_model',
+ 'lda_output_data',
+ 20, 5, 2, 10, 0.01, 2, .2);
+
+SELECT assert(perplexity_iters = '{2}', 'Number of Perplexity iterations are
wrong') from lda_model;
+
+
+drop table if exists lda_model, lda_output_data;
+SELECT lda_train(
+ 'lda_training', -- data_table
+ 'lda_model', -- model_table
+ 'lda_output_data', -- output_data_table
+ 20, -- voc_size
+ 5, -- topic_num
+ 3, -- iter_num
+ 10, -- alpha
+ 0.01, -- beta
+ 1, -- evaluate_every
+ .1 -- perplexity_tol
+ );
+
+SELECT assert(array_upper(perplexity,1) = 3, 'Perplexity calculation is
wrong') from lda_model;
Review comment:
we should assert the value of `perplexity_iters` here and also that all
perplexity values are > 0
----------------------------------------------------------------
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