Skip to content

Commit

Permalink
add tests for n_predictor_min = 1
Browse files Browse the repository at this point in the history
  • Loading branch information
bcjaeger committed May 2, 2024
1 parent ded908b commit f447397
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions tests/testthat/test-orsf_vs.R
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,21 @@ test_that(
}
)

test_that(
desc = "variable selection can go down to 1 predictor",
code = {

fit_cars <- orsf(mpg ~ ., data = mtcars, n_tree = n_tree_test)

vs <- orsf_vs(fit_cars, n_predictor_min = 1)

# assert that we eliminated 1 predictor at each step and got down to
# 1 remaining predictor
expect_equal(nrow(vs), ncol(mtcars) - 1)
expect_length(vs$variables_included[[1]], 1)
expect_length(vs$predictors_included[[1]], 1)

}
)


0 comments on commit f447397

Please sign in to comment.