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
1d9fd6dc
Commit
1d9fd6dc
authored
2 years ago
by
Nathalie Vialaneix
Browse files
Options
Downloads
Patches
Plain Diff
added tests on plots
parent
91ff555c
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_sfcbplots.R
+139
-0
139 additions, 0 deletions
tests/testthat/test_sfcbplots.R
with
139 additions
and
0 deletions
tests/testthat/test_sfcbplots.R
0 → 100644
+
139
−
0
View file @
1d9fd6dc
library
(
"SISIR"
)
context
(
"Test that graphics for `SFCB` objects work as expected..."
)
data
(
"truffles"
)
test_that
(
"graphics for 'importance' work as expected."
,
{
out1
<-
sfcb
(
rainfall
,
truffles
,
group.method
=
"adjclust"
,
summary.method
=
"pls"
)
p
<-
plot
(
out1
,
plot.type
=
"importance"
)
expect_s3_class
(
p
,
"ggplot"
)
p
<-
plot
(
out1
,
plot.type
=
"importance"
,
shape.imp
=
"histogram"
)
expect_s3_class
(
p
,
"ggplot"
)
out2
<-
sfcb
(
rainfall
,
truffles
,
group.method
=
"adjclust"
,
summary.method
=
"pls"
,
selection.method
=
"relief"
,
range.at
=
c
(
5
,
12
))
p
<-
plot
(
out2
,
plot.type
=
"importance"
)
expect_s3_class
(
p
,
"ggplot"
)
p
<-
plot
(
out2
,
plot.type
=
"importance"
,
shape.imp
=
"histogram"
)
expect_s3_class
(
p
,
"ggplot"
)
out3
<-
sfcb
(
rainfall
,
truffles
,
group.method
=
"cclustofvar"
,
summary.method
=
"basics"
)
p
<-
plot
(
out3
,
plot.type
=
"importance"
)
expect_s3_class
(
p
,
"ggplot"
)
p
<-
plot
(
out3
,
plot.type
=
"importance"
,
shape.imp
=
"histogram"
)
expect_s3_class
(
p
,
"ggplot"
)
out4
<-
sfcb
(
rainfall
,
truffles
,
group.method
=
"adjclust"
,
summary.method
=
"basics"
,
range.at
=
c
(
5
,
7
))
p
<-
plot
(
out4
,
plot.type
=
"importance"
)
expect_s3_class
(
p
,
"ggplot"
)
p
<-
plot
(
out4
,
plot.type
=
"importance"
,
shape.imp
=
"histogram"
)
expect_s3_class
(
p
,
"ggplot"
)
out5
<-
sfcb
(
rainfall
,
truffles
,
group.method
=
"adjclust"
,
summary.method
=
"basics"
,
selection.method
=
"relief"
,
range.at
=
c
(
5
,
7
))
p
<-
plot
(
out5
,
plot.type
=
"importance"
)
expect_s3_class
(
p
,
"ggplot"
)
p
<-
plot
(
out5
,
plot.type
=
"importance"
,
shape.imp
=
"histogram"
)
expect_s3_class
(
p
,
"ggplot"
)
})
test_that
(
"graphics for 'selection' work as expected."
,
{
out1
<-
sfcb
(
rainfall
,
truffles
,
group.method
=
"adjclust"
,
summary.method
=
"pls"
)
p
<-
plot
(
out1
,
plot.type
=
"selection"
)
expect_s3_class
(
p
,
"ggplot"
)
p
<-
plot
(
out1
,
plot.type
=
"selection"
,
sel.type
=
"selection"
,
threshold
=
0.00011
)
expect_s3_class
(
p
,
"ggplot"
)
out2
<-
sfcb
(
rainfall
,
truffles
,
group.method
=
"adjclust"
,
summary.method
=
"pls"
,
selection.method
=
"relief"
)
p
<-
plot
(
out2
,
plot.type
=
"selection"
)
expect_s3_class
(
p
,
"ggplot"
)
p
<-
plot
(
out2
,
plot.type
=
"selection"
,
sel.type
=
"selection"
)
expect_s3_class
(
p
,
"ggplot"
)
out3
<-
sfcb
(
rainfall
,
truffles
,
group.method
=
"adjclust"
,
summary.method
=
"pls"
,
selection.method
=
"relief"
,
range.at
=
c
(
5
,
12
))
p
<-
plot
(
out3
,
plot.type
=
"selection"
)
expect_s3_class
(
p
,
"ggplot"
)
p
<-
plot
(
out3
,
plot.type
=
"selection"
,
sel.type
=
"selection"
)
expect_s3_class
(
p
,
"ggplot"
)
out4
<-
sfcb
(
rainfall
,
truffles
,
group.method
=
"cclustofvar"
,
summary.method
=
"basics"
)
p
<-
plot
(
out4
,
plot.type
=
"selection"
)
expect_s3_class
(
p
,
"ggplot"
)
p
<-
plot
(
out4
,
plot.type
=
"selection"
,
sel.type
=
"selection"
,
threshold
=
0.0015
)
expect_s3_class
(
p
,
"ggplot"
)
out5
<-
sfcb
(
rainfall
,
truffles
,
group.method
=
"adjclust"
,
summary.method
=
"basics"
,
range.at
=
c
(
5
,
7
))
suppressWarnings
({
p
<-
plot
(
out5
,
plot.type
=
"selection"
)
})
expect_s3_class
(
p
,
"ggplot"
)
p
<-
plot
(
out5
,
plot.type
=
"selection"
,
sel.type
=
"selection"
,
threshold
=
0.005
)
expect_s3_class
(
p
,
"ggplot"
)
out6
<-
sfcb
(
rainfall
,
truffles
,
group.method
=
"adjclust"
,
summary.method
=
"basics"
,
selection.method
=
"relief"
)
p
<-
plot
(
out6
,
plot.type
=
"selection"
,
sel.type
=
"selection"
)
expect_s3_class
(
p
,
"ggplot"
)
out7
<-
sfcb
(
rainfall
,
truffles
,
group.method
=
"adjclust"
,
summary.method
=
"basics"
,
selection.method
=
"relief"
,
range.at
=
c
(
5
,
7
))
p
<-
plot
(
out7
,
plot.type
=
"selection"
,
sel.type
=
"selection"
)
expect_s3_class
(
p
,
"ggplot"
)
out8
<-
sfcb
(
rainfall
,
truffles
,
group.method
=
"adjclust"
,
summary.method
=
"pls"
,
range.at
=
c
(
5
,
7
))
p
<-
plot
(
out8
,
plot.type
=
"selection"
,
sel.type
=
"selection"
,
threshold
=
0.02
)
expect_s3_class
(
p
,
"ggplot"
)
expect_error
({
p
<-
plot
(
out8
,
plot.type
=
"selection"
,
sel.type
=
"selection"
,
threshold
=
"1"
)
},
"'threshold' must be numeric."
,
fixed
=
FALSE
)
expect_error
({
p
<-
plot
(
out7
,
plot.type
=
"selection"
,
sel.type
=
"selection"
,
threshold
=
1
)
},
"A selection method has already been used"
,
fixed
=
FALSE
)
expect_warning
({
p
<-
plot
(
out4
,
plot.type
=
"selection"
,
threshold
=
0.0015
)
},
"'sel.type' is not 'selection'. Automatically switching"
,
fixed
=
FALSE
)
expect_error
({
p
<-
plot
(
out4
,
plot.type
=
"selection"
,
sel.type
=
"selection"
)
},
"Choose sel.type = 'importance'"
,
fixed
=
FALSE
)
})
test_that
(
"graphics for 'dendrogram' work as expected."
,
{
out1
<-
sfcb
(
rainfall
,
truffles
,
group.method
=
"adjclust"
,
summary.method
=
"pls"
)
expect_message
({
plot
(
out1
)
},
"Reversals detected in the dendrogram."
)
out2
<-
sfcb
(
rainfall
,
truffles
,
group.method
=
"adjclust"
,
summary.method
=
"pls"
,
selection.method
=
"relief"
)
expect_message
({
plot
(
out2
)
},
"Reversals detected in the dendrogram."
)
out3
<-
sfcb
(
rainfall
,
truffles
,
group.method
=
"adjclust"
,
summary.method
=
"pls"
,
selection.method
=
"relief"
,
range.at
=
c
(
5
,
12
))
expect_message
({
plot
(
out3
)
},
"Only the first 3 selections are represented"
)
out4
<-
sfcb
(
rainfall
,
truffles
,
group.method
=
"cclustofvar"
,
summary.method
=
"basics"
)
expect_message
({
plot
(
out4
)
},
"Reversals detected in the dendrogram."
)
})
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