File tree Expand file tree Collapse file tree 1 file changed +65
-0
lines changed Expand file tree Collapse file tree 1 file changed +65
-0
lines changed Original file line number Diff line number Diff line change
1
+ # test kfold_xval class
2
+ test_that(' kfold xval' ,{
3
+ set.seed(' 57475' )
4
+ # dataset
5
+ D = iris_dataset()
6
+ # iterator
7
+ I = kfold_xval(folds = 5 ,method = ' venetian' )* (mean_centre()+ PLSDA())
8
+ # metric
9
+ B = balanced_accuracy()
10
+ # run
11
+ I = run(I ,D ,B )
12
+ # calculate metric
13
+ expect_equal(I $ metric $ mean ,0.23 )
14
+
15
+ # iterator
16
+ I = kfold_xval(folds = 5 ,method = ' blocks' )* (mean_centre()+ PLSDA())
17
+ # metric
18
+ B = balanced_accuracy()
19
+ # run
20
+ I = run(I ,D ,B )
21
+ # calculate metric
22
+ expect_equal(I $ metric $ mean ,0.305 )
23
+
24
+ # iterator
25
+ set.seed(57475 )
26
+ I = kfold_xval(folds = 5 ,method = ' random' )* (mean_centre()+ PLSDA())
27
+ # metric
28
+ B = balanced_accuracy()
29
+ # run
30
+ I = run(I ,D ,B )
31
+ # calculate metric
32
+ expect_equal(I $ metric $ mean ,0.2 )
33
+ })
34
+
35
+ test_that(' kfold xval metric plot' ,{
36
+ set.seed(' 57475' )
37
+ # dataset
38
+ D = iris_dataset()
39
+ # iterator
40
+ I = kfold_xval(folds = 5 ,method = ' venetian' )* (mean_centre()+ PLSDA())
41
+ # metric
42
+ B = balanced_accuracy()
43
+ # run
44
+ I = run(I ,D ,B )
45
+ # chart
46
+ C = kfoldxcv_metric()
47
+ gg = chart.plot(C ,I )
48
+ expect_true(is(gg ,' ggplot' ))
49
+ })
50
+
51
+ test_that(' kfold xval grid plot' ,{
52
+ set.seed(' 57475' )
53
+ # dataset
54
+ D = iris_dataset()
55
+ # iterator
56
+ I = kfold_xval(folds = 5 ,method = ' venetian' )* (mean_centre()+ PLSDA())
57
+ # metric
58
+ B = balanced_accuracy()
59
+ # run
60
+ I = run(I ,D ,B )
61
+ # chart
62
+ C = kfoldxcv_grid()
63
+ gg = chart.plot(C ,I )
64
+ expect_true(is(gg [[1 ]],' ggplot' ))
65
+ })
You can’t perform that action at this time.
0 commit comments