tests/testthat/test_spectral.R

library(sneer)
context("Spectral Direction")

test_that("characterizes spectral direction performance", {
# characterizes the spectral direction method rather than recreates any
# external data
tsne_iris <- embed_prob(iris[, 1:4],
                        method = tsne(verbose = FALSE),
                        opt = mize_opt("PHESS", c2 = 0.9),
                        init_inp = inp_from_perp(
                          perplexity = 50,
                          input_weight_fn = sqrt_exp_weight,
                          verbose = FALSE),
                        preprocess = make_preprocess(range_scale_matrix = TRUE,
                                                     verbose = FALSE),
                        max_iter = 50,
                        reporter = make_reporter(verbose = FALSE),
                        export = c("report"),
                        verbose = FALSE)
expect_equal(tsne_iris$report$norm, 0.0526, tolerance = 1.e-4, scale = 1)
})
jlmelville/sneer documentation built on Sept. 8, 2024, 9:58 p.m.