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
3c57e4e6
Commit
3c57e4e6
authored
2 years ago
by
Nathalie Vialaneix
Browse files
Options
Downloads
Patches
Plain Diff
created framework to deal with tests using testthat
parent
b6c8aa3d
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
DESCRIPTION
+2
-0
2 additions, 0 deletions
DESCRIPTION
tests/testthat.R
+4
-0
4 additions, 0 deletions
tests/testthat.R
tests/testthat/test_ridge.R
+9
-5
9 additions, 5 deletions
tests/testthat/test_ridge.R
with
15 additions
and
5 deletions
DESCRIPTION
+
2
−
0
View file @
3c57e4e6
...
...
@@ -38,6 +38,8 @@ Imports:
dendextend,
reshape2,
RColorBrewer
Suggests:
testthat
License: GPL (>= 2)
RoxygenNote: 7.1.2
Encoding: UTF-8
...
...
This diff is collapsed.
Click to expand it.
tests/testthat.R
0 → 100644
+
4
−
0
View file @
3c57e4e6
library
(
"testthat"
)
library
(
"SISIR"
)
test_check
(
"SISIR"
)
This diff is collapsed.
Click to expand it.
tests/test_ridge.R
→
tests/
testthat/
test_ridge.R
+
9
−
5
View file @
3c57e4e6
library
(
SISIR
)
library
(
"
SISIR
"
)
context
(
"Testing ridge regression `ridgeSIR`"
)
test_that
(
"Normalization in ridgeSIR works as expected."
,
{
set.seed
(
1140
)
tsteps
<-
seq
(
0
,
1
,
length
=
200
)
...
...
@@ -15,7 +18,8 @@ res_ridge <- ridgeSIR(x, y, H = 10, d = 5, mu2 = 10^8)
# test if normalization is OK
norm_EDR
<-
res_ridge
$
utils
$
norm_EDR
stopifnot
(
max
(
abs
(
diag
(
res_ridge
$
parameters
$
d
)
-
crossprod
(
res_ridge
$
EDR
,
norm_EDR
)
%*%
res_ridge
$
EDR
))
<
10
^
(
-10
))
expect_equal
(
diag
(
res_ridge
$
parameters
$
d
),
crossprod
(
res_ridge
$
EDR
,
norm_EDR
)
%*%
res_ridge
$
EDR
,
tolerance
=
10
^
(
-10
))
})
This diff is collapsed.
Click to expand it.
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