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
91ff555c
Commit
91ff555c
authored
2 years ago
by
Nathalie Vialaneix
Browse files
Options
Downloads
Patches
Plain Diff
added tests on extract
parent
d27e222f
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_sfcbextract.R
+64
-0
64 additions, 0 deletions
tests/testthat/test_sfcbextract.R
with
64 additions
and
0 deletions
tests/testthat/test_sfcbextract.R
0 → 100644
+
64
−
0
View file @
91ff555c
library
(
"SISIR"
)
context
(
"Test that extract works as expected..."
)
data
(
"truffles"
)
test_that
(
"extract works as expected without selection."
,
{
expected_outputs
<-
c
(
"dendro"
,
"groups"
,
"summaries"
,
"mse"
,
"importances"
,
"call"
)
out1
<-
sfcb
(
rainfall
,
truffles
,
group.method
=
"adjclust"
,
summary.method
=
"pls"
,
range.at
=
c
(
5
,
7
))
out1b
<-
extract_at
(
out1
,
5
)
expect_named
(
out1b
,
expected_outputs
)
expect_length
(
out1b
$
groups
,
1
)
expect_length
(
out1b
$
summaries
,
1
)
expect_length
(
out1b
$
importances
,
1
)
expect_equal
(
nrow
(
out1b
$
mse
),
5
)
out2
<-
sfcb
(
rainfall
,
truffles
,
group.method
=
"cclustofvar"
,
summary.method
=
"cclustofvar"
,
range.at
=
c
(
5
,
7
))
out2b
<-
extract_at
(
out2
,
5
)
expect_named
(
out2b
,
expected_outputs
)
out3
<-
sfcb
(
rainfall
,
truffles
,
group.method
=
"adjclust"
,
summary.method
=
"basics"
,
range.at
=
c
(
5
,
7
))
out3b
<-
extract_at
(
out3
,
5
:
6
)
expect_named
(
out3b
,
expected_outputs
)
expect_length
(
out3b
$
groups
,
2
)
expect_length
(
out3b
$
summaries
,
2
)
expect_length
(
out3b
$
importances
,
2
)
expect_equal
(
nrow
(
out3b
$
mse
),
5
*
2
)
})
test_that
(
"extract works as expected with selection."
,
{
expected_outputs
<-
c
(
"dendro"
,
"groups"
,
"summaries"
,
"selected"
,
"mse"
,
"importances"
,
"call"
)
out4
<-
sfcb
(
rainfall
,
truffles
,
group.method
=
"adjclust"
,
summary.method
=
"pls"
,
selection.method
=
"relief"
,
range.at
=
c
(
5
,
7
))
out4b
<-
extract_at
(
out4
,
6
)
expect_named
(
out4b
,
expected_outputs
)
out5
<-
sfcb
(
rainfall
,
truffles
,
group.method
=
"adjclust"
,
summary.method
=
"pls"
,
selection.method
=
"relief"
,
range.at
=
c
(
5
,
12
))
out5b
<-
extract_at
(
out5
,
c
(
9
,
11
:
12
))
expect_named
(
out5b
,
expected_outputs
)
expect_length
(
out5b
$
groups
,
3
)
expect_length
(
out5b
$
summaries
,
3
)
expect_length
(
out5b
$
importances
,
3
)
expect_equal
(
nrow
(
out5b
$
mse
),
5
*
3
)
})
test_that
(
"extract returns errors as expected."
,
{
out1
<-
sfcb
(
rainfall
,
truffles
,
group.method
=
"adjclust"
,
summary.method
=
"pls"
,
range.at
=
c
(
5
,
7
))
expect_error
({
extract_at
(
out1
,
"A"
)
},
"'at' must be a numeric vector"
,
fixed
=
FALSE
)
expect_error
({
extract_at
(
out1
,
9
)
},
"'at' must be included in the range of tested groups for"
,
fixed
=
FALSE
)
})
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