Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
SISIR
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
SFCB
SISIR
Commits
629d1e85
Commit
629d1e85
authored
2 years ago
by
Nathalie Vialaneix
Browse files
Options
Downloads
Patches
Plain Diff
added tests for SFCB method
parent
3c57e4e6
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tests/testthat/test_sfcb.R
+93
-0
93 additions, 0 deletions
tests/testthat/test_sfcb.R
with
93 additions
and
0 deletions
tests/testthat/test_sfcb.R
0 → 100644
+
93
−
0
View file @
629d1e85
library
(
"SISIR"
)
context
(
"Test that `sfcb` works as expected..."
)
data
(
"truffles"
)
test_that
(
"`sfcb` works for one `at` and no selection."
,
{
expected_outputs
<-
c
(
"dendro"
,
"groups"
,
"summaries"
,
"mse"
,
"importances"
,
"computational.times"
,
"call"
)
out1
<-
sfcb
(
rainfall
,
truffles
,
group.method
=
"adjclust"
,
summary.method
=
"pls"
,
seed
=
3
)
expect_named
(
out1
,
expected_outputs
)
out1b
<-
sfcb
(
rainfall
,
truffles
,
group.method
=
"adjclust"
,
summary.method
=
"pls"
,
seed
=
3
)
out1
$
"computational.times"
<-
NULL
out1b
$
"computational.times"
<-
NULL
expect_identical
(
out1
,
out1b
)
out2
<-
sfcb
(
rainfall
,
truffles
,
group.method
=
"cclustofvar"
,
summary.method
=
"cclustofvar"
,
keep.time
=
FALSE
)
expect_named
(
out2
,
setdiff
(
expected_outputs
,
"computational.times"
))
out3
<-
sfcb
(
rainfall
,
truffles
,
group.method
=
"cclustofvar"
,
summary.method
=
"basics"
,
repeats
=
6
)
expect_named
(
out3
,
expected_outputs
)
expect_equal
(
nrow
(
out3
$
mse
),
6
)
expect_equal
(
ncol
(
out3
$
importances
[[
1
]]),
6
*
2
)
})
test_that
(
"`sfcb` works for `range_at` and no selection."
,
{
expected_outputs
<-
c
(
"dendro"
,
"groups"
,
"summaries"
,
"mse"
,
"importances"
,
"computational.times"
,
"call"
)
out4
<-
sfcb
(
rainfall
,
truffles
,
group.method
=
"adjclust"
,
summary.method
=
"pls"
,
range.at
=
c
(
5
,
7
))
expect_named
(
out4
,
expected_outputs
)
expect_length
(
out4
$
summaries
,
3
)
out5
<-
sfcb
(
rainfall
,
truffles
,
group.method
=
"cclustofvar"
,
summary.method
=
"cclustofvar"
,
range.at
=
c
(
5
,
7
))
expect_named
(
out5
,
expected_outputs
)
out6
<-
sfcb
(
rainfall
,
truffles
,
group.method
=
"adjclust"
,
summary.method
=
"basics"
,
range.at
=
c
(
5
,
7
))
expect_named
(
out6
,
expected_outputs
)
})
test_that
(
"`sfcb` works for one `at` with selection."
,
{
expected_outputs
<-
c
(
"dendro"
,
"groups"
,
"summaries"
,
"selected"
,
"mse"
,
"importances"
,
"computational.times"
,
"call"
)
out7
<-
sfcb
(
rainfall
,
truffles
,
group.method
=
"adjclust"
,
summary.method
=
"pls"
,
selection.method
=
"relief"
)
expect_named
(
out7
,
expected_outputs
)
out8
<-
sfcb
(
rainfall
,
truffles
,
group.method
=
"adjclust"
,
summary.method
=
"pls"
,
selection.method
=
"relief"
)
expect_named
(
out8
,
expected_outputs
)
out9
<-
sfcb
(
rainfall
,
truffles
,
group.method
=
"adjclust"
,
summary.method
=
"basics"
,
selection.method
=
"relief"
)
expect_named
(
out9
,
expected_outputs
)
out10
<-
sfcb
(
rainfall
,
truffles
,
group.method
=
"adjclust"
,
summary.method
=
"pls"
,
selection.method
=
"boruta"
)
expect_named
(
out10
,
expected_outputs
)
})
test_that
(
"`sfcb` works for one `at` with selection."
,
{
expected_outputs
<-
c
(
"dendro"
,
"groups"
,
"summaries"
,
"selected"
,
"mse"
,
"importances"
,
"computational.times"
,
"call"
)
out11
<-
sfcb
(
rainfall
,
truffles
,
group.method
=
"adjclust"
,
summary.method
=
"pls"
,
selection.method
=
"relief"
,
range.at
=
c
(
5
,
7
))
expect_named
(
out11
,
expected_outputs
)
expect_length
(
out11
$
selected
,
3
)
out12
<-
sfcb
(
rainfall
,
truffles
,
group.method
=
"adjclust"
,
summary.method
=
"pls"
,
selection.method
=
"boruta"
,
seed
=
3
)
expect_named
(
out12
,
expected_outputs
)
out13
<-
sfcb
(
rainfall
,
truffles
,
group.method
=
"adjclust"
,
summary.method
=
"basics"
,
selection.method
=
"relief"
,
range.at
=
c
(
5
,
7
))
expect_named
(
out13
,
expected_outputs
)
out14
<-
sfcb
(
rainfall
,
truffles
,
group.method
=
"adjclust"
,
summary.method
=
"pls"
,
selection.method
=
"relief"
,
range.at
=
c
(
5
,
12
))
expect_named
(
out14
,
expected_outputs
)
})
This diff is collapsed.
Click to expand it.
Nathalie Vialaneix
@nathalie.villa-vialaneix
mentioned in issue
#2 (closed)
·
2 years ago
mentioned in issue
#2 (closed)
mentioned in issue #2
Toggle commit list
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment