File tree Expand file tree Collapse file tree 1 file changed +43
-0
lines changed Expand file tree Collapse file tree 1 file changed +43
-0
lines changed Original file line number Diff line number Diff line change
1
+ # test grid search
2
+ test_that(' grid_search' ,{
3
+ set.seed(' 57475' )
4
+ # dataset
5
+ D = iris_dataset()
6
+ # iterator
7
+ I = grid_search_1d(param_to_optimise = ' number_components' ,
8
+ factor_name = ' Species' ,
9
+ search_values = 1 : 4 ,
10
+ model_index = 2 ,
11
+ max_min = ' min' )*
12
+ kfold_xval(folds = 5 )*
13
+ (mean_centre()+ PLSDA())
14
+ # metric
15
+ B = balanced_accuracy()
16
+ # run
17
+ I = run(I ,D ,B )
18
+ # calculate metric
19
+ expect_equal(I $ metric $ value ,0.3 )
20
+ })
21
+
22
+ # test grid search
23
+ test_that(' grid_search' ,{
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
+ kfold_xval(folds = 5 )*
34
+ (mean_centre()+ PLSDA())
35
+ # metric
36
+ B = balanced_accuracy()
37
+ # run
38
+ I = run(I ,D ,B )
39
+ # calculate metric
40
+ C = gs_line()
41
+ gg = chart.plot(C ,I )
42
+ expect_true(is(gg ,' ggplot' ))
43
+ })
You can’t perform that action at this time.
0 commit comments