@@ -166,12 +166,16 @@ test_that("spark.lda with libsvm", {
166166 topics <- stats $ topicTopTerms
167167 weights <- stats $ topicTopTermsWeights
168168 vocabulary <- stats $ vocabulary
169+ trainingLogLikelihood <- stats $ trainingLogLikelihood
170+ logPrior <- stats $ logPrior
169171
170- expect_false (isDistributed )
172+ expect_true (isDistributed )
171173 expect_true(logLikelihood < = 0 & is.finite(logLikelihood ))
172174 expect_true(logPerplexity > = 0 & is.finite(logPerplexity ))
173175 expect_equal(vocabSize , 11 )
174176 expect_true(is.null(vocabulary ))
177+ expect_true(trainingLogLikelihood < = 0 & ! is.na(trainingLogLikelihood ))
178+ expect_true(logPrior < = 0 & ! is.na(logPrior ))
175179
176180 # Test model save/load
177181 modelPath <- tempfile(pattern = " spark-lda" , fileext = " .tmp" )
@@ -181,11 +185,13 @@ test_that("spark.lda with libsvm", {
181185 model2 <- read.ml(modelPath )
182186 stats2 <- summary(model2 )
183187
184- expect_false (stats2 $ isDistributed )
188+ expect_true (stats2 $ isDistributed )
185189 expect_equal(logLikelihood , stats2 $ logLikelihood )
186190 expect_equal(logPerplexity , stats2 $ logPerplexity )
187191 expect_equal(vocabSize , stats2 $ vocabSize )
188192 expect_equal(vocabulary , stats2 $ vocabulary )
193+ expect_equal(trainingLogLikelihood , stats2 $ trainingLogLikelihood )
194+ expect_equal(logPrior , stats2 $ logPrior )
189195
190196 unlink(modelPath )
191197})
@@ -202,12 +208,16 @@ test_that("spark.lda with text input", {
202208 topics <- stats $ topicTopTerms
203209 weights <- stats $ topicTopTermsWeights
204210 vocabulary <- stats $ vocabulary
211+ trainingLogLikelihood <- stats $ trainingLogLikelihood
212+ logPrior <- stats $ logPrior
205213
206214 expect_false(isDistributed )
207215 expect_true(logLikelihood < = 0 & is.finite(logLikelihood ))
208216 expect_true(logPerplexity > = 0 & is.finite(logPerplexity ))
209217 expect_equal(vocabSize , 10 )
210218 expect_true(setequal(stats $ vocabulary , c(" 0" , " 1" , " 2" , " 3" , " 4" , " 5" , " 6" , " 7" , " 8" , " 9" )))
219+ expect_true(is.na(trainingLogLikelihood ))
220+ expect_true(is.na(logPrior ))
211221
212222 # Test model save/load
213223 modelPath <- tempfile(pattern = " spark-lda-text" , fileext = " .tmp" )
@@ -222,6 +232,8 @@ test_that("spark.lda with text input", {
222232 expect_equal(logPerplexity , stats2 $ logPerplexity )
223233 expect_equal(vocabSize , stats2 $ vocabSize )
224234 expect_true(all.equal(vocabulary , stats2 $ vocabulary ))
235+ expect_true(is.na(stats2 $ trainingLogLikelihood ))
236+ expect_true(is.na(stats2 $ logPrior ))
225237
226238 unlink(modelPath )
227239})
0 commit comments