diff options
author | Liang-Chi Hsieh <viirya@gmail.com> | 2016-02-24 07:05:20 -0800 |
---|---|---|
committer | Xiangrui Meng <meng@databricks.com> | 2016-02-24 07:05:20 -0800 |
commit | 89301818334185fd4f9881e5c0b123be94018e76 (patch) | |
tree | 8d757ef721becded4c3eb86c7a6f756416b3ccf4 /R/pkg | |
parent | bcfd55fa982b24184c07fcd4ccdd55dcf6465bf4 (diff) | |
download | spark-89301818334185fd4f9881e5c0b123be94018e76.tar.gz spark-89301818334185fd4f9881e5c0b123be94018e76.tar.bz2 spark-89301818334185fd4f9881e5c0b123be94018e76.zip |
[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 <viirya@gmail.com>
Closes #11345 from viirya/fix-kmeans-r-test and squashes the following commits:
f959f61 [Liang-Chi Hsieh] Sort resulted clusters.
Diffstat (limited to 'R/pkg')
-rw-r--r-- | R/pkg/inst/tests/testthat/test_mllib.R | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/R/pkg/inst/tests/testthat/test_mllib.R b/R/pkg/inst/tests/testthat/test_mllib.R index 595512e0e0..af84a0abcf 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) |