Skip to content

Commit

Permalink
isomap values are unique up to sign
Browse files Browse the repository at this point in the history
  • Loading branch information
topepo committed Nov 18, 2018
1 parent 39b0c4e commit d7f5df9
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions tests/testthat/test_isomap.R
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,16 @@ 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 = "")

im_trained <- prep(im_rec, training = dat1, verbose = FALSE)

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 = "")
Expand All @@ -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))
Expand Down

0 comments on commit d7f5df9

Please sign in to comment.