@@ -10,7 +10,7 @@ test_that('glmnet execution error', {
10
10
data(" hpc_data" , package = " modeldata" , envir = rlang :: current_env())
11
11
hpc <- hpc_data [1 : 150 , c(2 : 5 , 8 )]
12
12
13
- hpc_basic <- linear_reg(penalty = .1 , mixture = .3 ) %> %
13
+ hpc_basic <- linear_reg(penalty = 0 .1 , mixture = 0 .3 ) %> %
14
14
set_engine(" glmnet" , nlambda = 15 )
15
15
16
16
# this error/test is not glmnet-specific,
@@ -26,14 +26,16 @@ test_that('glmnet execution error', {
26
26
})
27
27
28
28
test_that(" glmnet model object" , {
29
+ skip_if_not_installed(" glmnet" )
30
+
29
31
hpc <- hpc_data [1 : 150 , c(2 : 5 , 8 )]
30
32
hpc_x <- model.matrix(~ log(compounds ) + class , data = hpc )[, - 1 ]
31
33
hpc_y <- hpc $ input_fields
32
34
33
35
exp_fit <- glmnet :: glmnet(x = hpc_x , y = hpc_y , family = " gaussian" ,
34
36
alpha = 0.3 , nlambda = 15 )
35
37
36
- lm_spec <- linear_reg(penalty = 0.123 , mixture = 0.3 ) %> %
38
+ lm_spec <- linear_reg(penalty = 0.1 , mixture = 0.3 ) %> %
37
39
set_engine(" glmnet" , nlambda = 15 )
38
40
expect_no_error(
39
41
f_fit <- fit(lm_spec , input_fields ~ log(compounds ) + class , data = hpc )
@@ -81,7 +83,6 @@ test_that("glmnet prediction: type numeric", {
81
83
})
82
84
83
85
test_that(' glmnet prediction: column order of `new_data` irrelevant' , {
84
-
85
86
skip_if_not_installed(" glmnet" )
86
87
87
88
data(" hpc_data" , package = " modeldata" , envir = rlang :: current_env())
@@ -133,7 +134,6 @@ test_that("formula interface can deal with missing values", {
133
134
hpc <- hpc_data [1 : 150 , c(2 : 5 , 8 )]
134
135
135
136
hpc $ compounds [1 ] <- NA
136
- hpc_x [1 ,1 ] <- NA
137
137
138
138
lm_spec <- linear_reg(penalty = 0.123 ) %> % set_engine(" glmnet" )
139
139
f_fit <- fit(lm_spec , input_fields ~ log(compounds ) + class , data = hpc )
0 commit comments