From bdc7e4ac435db6f4bd8e423f2597b4f60e092134 Mon Sep 17 00:00:00 2001 From: "wm624@hotmail.com" Date: Tue, 17 Jan 2017 11:52:32 -0800 Subject: [PATCH 1/2] backport bug fix --- R/pkg/inst/tests/testthat/test_mllib.R | 2 +- mllib/src/main/scala/org/apache/spark/ml/r/LDAWrapper.scala | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/R/pkg/inst/tests/testthat/test_mllib.R b/R/pkg/inst/tests/testthat/test_mllib.R index 1f2fae9c813f..1d60018a56c7 100644 --- a/R/pkg/inst/tests/testthat/test_mllib.R +++ b/R/pkg/inst/tests/testthat/test_mllib.R @@ -860,7 +860,7 @@ test_that("spark.lda with libsvm", { weights <- stats$topicTopTermsWeights vocabulary <- stats$vocabulary - expect_false(isDistributed) + expect_true(isDistributed) expect_true(logLikelihood <= 0 & is.finite(logLikelihood)) expect_true(logPerplexity >= 0 & is.finite(logPerplexity)) expect_equal(vocabSize, 11) diff --git a/mllib/src/main/scala/org/apache/spark/ml/r/LDAWrapper.scala b/mllib/src/main/scala/org/apache/spark/ml/r/LDAWrapper.scala index cbe6a705007d..e7851e148855 100644 --- a/mllib/src/main/scala/org/apache/spark/ml/r/LDAWrapper.scala +++ b/mllib/src/main/scala/org/apache/spark/ml/r/LDAWrapper.scala @@ -122,6 +122,7 @@ private[r] object LDAWrapper extends MLReadable[LDAWrapper] { .setK(k) .setMaxIter(maxIter) .setSubsamplingRate(subsamplingRate) + .setOptimizer(optimizer) val featureSchema = data.schema(features) val stages = featureSchema.dataType match { From 3b17c3d37ba70b3929a5de70c607dbffe7e074e3 Mon Sep 17 00:00:00 2001 From: "wm624@hotmail.com" Date: Tue, 17 Jan 2017 15:58:20 -0800 Subject: [PATCH 2/2] fix a unit test --- R/pkg/inst/tests/testthat/test_mllib.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/pkg/inst/tests/testthat/test_mllib.R b/R/pkg/inst/tests/testthat/test_mllib.R index 1d60018a56c7..3891f0044d4f 100644 --- a/R/pkg/inst/tests/testthat/test_mllib.R +++ b/R/pkg/inst/tests/testthat/test_mllib.R @@ -874,7 +874,7 @@ test_that("spark.lda with libsvm", { model2 <- read.ml(modelPath) stats2 <- summary(model2) - expect_false(stats2$isDistributed) + expect_true(stats2$isDistributed) expect_equal(logLikelihood, stats2$logLikelihood) expect_equal(logPerplexity, stats2$logPerplexity) expect_equal(vocabSize, stats2$vocabSize)