From d7f5df9622f75ca81d30a35851ab9f074f50111a Mon Sep 17 00:00:00 2001 From: topepo Date: Sun, 18 Nov 2018 10:29:26 -0500 Subject: [PATCH] isomap values are unique up to sign --- tests/testthat/test_isomap.R | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tests/testthat/test_isomap.R b/tests/testthat/test_isomap.R index 9417d0888..0517328b6 100644 --- a/tests/testthat/test_isomap.R +++ b/tests/testthat/test_isomap.R @@ -29,7 +29,7 @@ test_that('correct Isomap values', { skip_if_not_installed("igraph") skip_if_not_installed("RANN") skip_if_not_installed("dimRed") - + im_rec <- rec %>% step_isomap(x1, x2, x3, neighbors = 3, num_terms = 3, id = "") @@ -37,7 +37,8 @@ test_that('correct Isomap values', { im_pred <- bake(im_trained, new_data = dat2) - all.equal(as.matrix(im_pred), as.matrix(exp_res)) + # unique up to sign + all.equal(abs(as.matrix(im_pred)), abs(as.matrix(exp_res))) im_tibble <- tibble(terms = c("x1", "x2", "x3"), id = "") @@ -61,7 +62,7 @@ test_that('printing', { skip_if_not_installed("igraph") skip_if_not_installed("RANN") skip_if_not_installed("dimRed") - + im_rec <- rec %>% step_isomap(x1, x2, x3, neighbors = 3, num_terms = 3) expect_output(print(im_rec))