You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spark.apache.org by me...@apache.org on 2016/02/24 16:05:23 UTC

spark git commit: [SPARK-13472] [SPARKR] Fix unstable Kmeans test in R

Repository: spark
Updated Branches:
  refs/heads/master bcfd55fa9 -> 893018183


[SPARK-13472] [SPARKR] Fix unstable Kmeans test in R

JIRA: https://issues.apache.org/jira/browse/SPARK-13472

## What changes were proposed in this pull request?

One Kmeans test in R is unstable and sometimes fails. We should fix it.

## How was this patch tested?

Unit test is modified in this PR.

Author: Liang-Chi Hsieh <vi...@gmail.com>

Closes #11345 from viirya/fix-kmeans-r-test and squashes the following commits:

f959f61 [Liang-Chi Hsieh] Sort resulted clusters.


Project: http://git-wip-us.apache.org/repos/asf/spark/repo
Commit: http://git-wip-us.apache.org/repos/asf/spark/commit/89301818
Tree: http://git-wip-us.apache.org/repos/asf/spark/tree/89301818
Diff: http://git-wip-us.apache.org/repos/asf/spark/diff/89301818

Branch: refs/heads/master
Commit: 89301818334185fd4f9881e5c0b123be94018e76
Parents: bcfd55f
Author: Liang-Chi Hsieh <vi...@gmail.com>
Authored: Wed Feb 24 07:05:20 2016 -0800
Committer: Xiangrui Meng <me...@databricks.com>
Committed: Wed Feb 24 07:05:20 2016 -0800

----------------------------------------------------------------------
 R/pkg/inst/tests/testthat/test_mllib.R | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/spark/blob/89301818/R/pkg/inst/tests/testthat/test_mllib.R
----------------------------------------------------------------------
diff --git a/R/pkg/inst/tests/testthat/test_mllib.R b/R/pkg/inst/tests/testthat/test_mllib.R
index 595512e..af84a0a 100644
--- a/R/pkg/inst/tests/testthat/test_mllib.R
+++ b/R/pkg/inst/tests/testthat/test_mllib.R
@@ -130,7 +130,7 @@ test_that("kmeans", {
 
   # Test stats::kmeans is working
   statsModel <- kmeans(x = newIris, centers = 2)
-  expect_equal(unique(statsModel$cluster), c(1, 2))
+  expect_equal(sort(unique(statsModel$cluster)), c(1, 2))
 
   # Test fitted works on KMeans
   fitted.model <- fitted(model)


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@spark.apache.org
For additional commands, e-mail: commits-help@spark.apache.org