Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sjwilczynski committed Jun 8, 2018
1 parent 166bb9f commit 8000139
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion tests/testthat/test_mlcc_bic.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ library(varclust)
test_that("mlcc.bic for small matrix",{
load("test_data/small_matrix.rda")
true_segmentation <- rep(1:2, each=50)
result <- mlcc.bic(X, numb.clusters = 1:5, max.dim = 2, numb.cores = 1, deterministic = TRUE)
result <- mlcc.bic(X, numb.clusters = 1:5, max.dim = 2, numb.cores = 1, seed = 10)
expect_equal(2, result$nClusters)
scores <- integration(result$segmentation, true_segmentation)
expect_equal(scores[1],1)
Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/test_mlcc_kmeans.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ context("Testing mlcc.kmeans")
library(varclust)

test_that("principal components returned by mlcc.kmeans are in fact principal components of the clusters", {
set.seed(1)
set.seed(10)
X <- data.simulation.factors(n=20, K = 2, numb.vars = 50, numb.factors = 5)$X
result <- mlcc.kmeans(X, number.clusters = 2, max.iter = 1)
segmentation <- result[[1]]
Expand Down
4 changes: 2 additions & 2 deletions tests/testthat/test_mlcc_reps.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ library(varclust)

test_that("mlcc.reps on small matrix", {
load("test_data/small_matrix.rda")
result <- mlcc.reps(X, max.dim = 2, numb.cores = 1, deterministic = TRUE)
result <- mlcc.reps(X, max.dim = 2, numb.cores = 1, seed = 10)
true_segmentation <- rep(1:2, each=50)
scores <- integration(result$segmentation, true_segmentation)
expect_equal(scores[1],1)
Expand All @@ -15,7 +15,7 @@ test_that("perfect segmentation", {
load("test_data/small_matrix.rda")
true_segmentation <- rep(1:2, each=50)
bad_segmentation <- c(rep(1:2, each=25), rep(1:2, each=25))
segmentation <- mlcc.reps(X, initial.segmentations = list(true_segmentation, bad_segmentation), numb.cores = 1, deterministic = TRUE)$segmentation
segmentation <- mlcc.reps(X, initial.segmentations = list(true_segmentation, bad_segmentation), numb.cores = 1, seed = 10)$segmentation
expect_equal(segmentation, true_segmentation)
})

Expand Down

0 comments on commit 8000139

Please sign in to comment.