context("glasso optimizer")
test_that("line search", {
x <- readRDS('../data/reference_glasso_x')
tree_line <- hdcd(x, method = 'glasso', optimizer = 'line_search', delta = 0.1, lambda = 0.1, control = hdcd_control())
expect_equal(get_change_points_from_tree(tree_line, 'max_gain'), c(39, 70, 108, 128, 148, 176))
})
test_that("section search", {
x <- readRDS('../data/reference_glasso_x')
tree_section <- hdcd(x, method = 'glasso', optimizer = 'section_search', delta = 0.1, lambda = 0.1, control = hdcd_control(section_search_min_points = 10))
expect_equal(get_change_points_from_tree(tree_section, 'max_gain'), c(22, 44, 77, 102, 125, 150, 173))
})
test_that("two step search", {
x <- readRDS('../data/reference_glasso_x')
set.seed(0)
tree_two_step <- hdcd(x, method = 'glasso', optimizer = 'two_step_search', delta = 0.1, lambda = 0.1, control = hdcd_control())
expect_equal(get_change_points_from_tree(tree_two_step, 'max_gain'), c(22, 46, 70, 98, 128, 164))
})
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.