Skip to content

Commit 2401341

Browse files
committed
add more tests for grid search
1 parent 9aebc92 commit 2401341

File tree

1 file changed

+22
-2
lines changed

1 file changed

+22
-2
lines changed

tests/testthat/test-gridsearch1d.R

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# test grid search
2-
test_that('grid_search',{
2+
test_that('grid_search iterator',{
33
set.seed('57475')
44
# dataset
55
D=iris_dataset()
@@ -20,7 +20,27 @@ test_that('grid_search',{
2020
})
2121

2222
# test grid search
23-
test_that('grid_search',{
23+
test_that('grid_search wf',{
24+
set.seed('57475')
25+
# dataset
26+
D=iris_dataset()
27+
# iterator
28+
I = grid_search_1d(param_to_optimise='number_components',
29+
factor_name='Species',
30+
search_values=1:4,
31+
model_index=2,
32+
max_min='min')*
33+
(mean_centre()+PLSDA())
34+
# metric
35+
B=balanced_accuracy()
36+
# run
37+
I=run(I,D,B)
38+
# calculate metric
39+
expect_equal(I$metric$value[1],0.320)
40+
})
41+
42+
# test grid search
43+
test_that('grid_search chart',{
2444
set.seed('57475')
2545
# dataset
2646
D=iris_dataset()

0 commit comments

Comments
 (0)