Skip to content

Commit 70462cb

Browse files
authored
1 parent 69c34f5 commit 70462cb

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

tests/testthat/test-glmnet-tidy.R

+23
Original file line numberDiff line numberDiff line change
@@ -55,4 +55,27 @@ test_that('multinomial regression', {
5555
}
5656
})
5757

58+
test_that('check proper penalty range', {
59+
skip_if_not_installed("glmnet")
60+
skip_if_not_installed("parsnip", minimum_version = "1.3.0.9000")
61+
62+
data(Chicago, package = "modeldata")
63+
64+
Chicago <- Chicago %>% select(ridership, Clark_Lake, Austin, Harlem)
65+
66+
glmnet_spec <-
67+
linear_reg(penalty = 0.1, mixture = 0.95) %>%
68+
set_engine("glmnet")
69+
70+
glmnet_wflow <-
71+
workflow() %>%
72+
add_model(glmnet_spec) %>%
73+
add_formula(ridership ~ .)
74+
75+
glmnet_fit <- fit(glmnet_wflow, Chicago)
76+
77+
res <- try(tidy(glmnet_fit, penalty = 5.5620), silent = TRUE)
78+
expect_s3_class(res, c("tbl_df", "tbl", "data.frame"))
79+
80+
})
5881

0 commit comments

Comments
 (0)