@@ -2,7 +2,7 @@ library(testthat)
2
2
library(parsnip )
3
3
4
4
source(test_path(" helper-objects.R" ))
5
- hpc <- hpc_data [1 : 150 , c(2 : 5 , 8 )]
5
+ hpc <- hpc_data [1 : 150 , c(2 : 5 , 8 )] % > % as.data.frame()
6
6
7
7
# ------------------------------------------------------------------------------
8
8
@@ -29,7 +29,7 @@ eval_descrs <- function(descrs, not = NULL) {
29
29
lapply(descrs , do.call , list ())
30
30
}
31
31
32
- class_tab <- table(hpc_data $ class , dnn = NULL )
32
+ class_tab <- table(hpc $ class , dnn = NULL )
33
33
34
34
# ------------------------------------------------------------------------------
35
35
@@ -86,12 +86,12 @@ context("Testing formula -> xy conversion")
86
86
87
87
test_that(" numeric y and dummy vars" , {
88
88
expect_equal(
89
- template(5 , 4 , 150 , NA , 1 , hpc , hpc [- 2 ], hpc [," compounds " ]),
90
- eval_descrs(get_descr_form(compounds ~ . , data = hpc ))
89
+ template(6 , 4 , 150 , NA , 1 , hpc , hpc [- 2 ], hpc [," input_fields " ]),
90
+ eval_descrs(get_descr_form(input_fields ~ . , data = hpc ))
91
91
)
92
92
expect_equal(
93
- template(2 , 1 , 150 , NA , 1 , hpc , hpc [" class" ], hpc [," compounds " ]),
94
- eval_descrs(get_descr_form(compounds ~ class , data = hpc ))
93
+ template(3 , 1 , 150 , NA , 1 , hpc , hpc [" class" ], hpc [," input_fields " ]),
94
+ eval_descrs(get_descr_form(input_fields ~ class , data = hpc ))
95
95
)
96
96
})
97
97
@@ -117,8 +117,8 @@ test_that("factor y", {
117
117
eval_descrs(get_descr_form(class ~ . , data = hpc ))
118
118
)
119
119
expect_equal(
120
- template(1 , 1 , 150 , class_tab , 0 , hpc , hpc [" input_fields " ], hpc [," class" ]),
121
- eval_descrs(get_descr_form(class ~ input_fields , data = hpc ))
120
+ template(1 , 1 , 150 , class_tab , 0 , hpc , hpc [" compounds " ], hpc [," class" ]),
121
+ eval_descrs(get_descr_form(class ~ compounds , data = hpc ))
122
122
)
123
123
})
124
124
@@ -134,8 +134,8 @@ test_that("weird cases", {
134
134
# So model.frame ignores - signs in a model formula so class is not removed
135
135
# prior to model.matrix; otherwise this should have n_cols = 3
136
136
expect_equal(
137
- template(3 , 4 , 150 , NA , 1 , hpc , hpc [- 2 ], hpc [," compounds " ]),
138
- eval_descrs(get_descr_form(compounds ~ . - class , data = hpc ))
137
+ template(3 , 4 , 150 , NA , 1 , hpc , hpc [- 2 ], hpc [," input_fields " ]),
138
+ eval_descrs(get_descr_form(input_fields ~ . - class , data = hpc ))
139
139
)
140
140
141
141
# Oy ve! Before going to model.matrix, model.frame produces a data frame
@@ -173,7 +173,7 @@ test_that("numeric y and dummy vars", {
173
173
eval_descrs(get_descr_xy(x = hpc [, 4 : 5 ], y = hpc [, 1 : 2 ]))
174
174
)
175
175
176
- hpc3 <- hpc2 [,c(" iterations " , " class" , " input_fields " )]
176
+ hpc3 <- hpc2 [,c(" num_pending " , " class" , " compounds " )]
177
177
expect_equal(
178
178
template(2 , 2 , 150 , NA , 1 , hpc3 , hpc [, 4 : 5 ], hpc [, 1 , drop = FALSE ]),
179
179
eval_descrs(get_descr_xy(x = hpc [, 4 : 5 ], y = hpc [, 1 , drop = FALSE ]))
0 commit comments