-
Notifications
You must be signed in to change notification settings - Fork 635
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
598 additions
and
519 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,46 +1,52 @@ | ||
# Sample .travis.yml for R projects from https://github.com/craigcitro/r-travis | ||
|
||
language: c | ||
language: r | ||
warnings_are_errors: false | ||
sudo: required | ||
|
||
env: | ||
global: | ||
- WARNINGS_ARE_ERRORS=1 | ||
- R_BUILD_ARGS=" " | ||
- R_CHECK_ARGS="--as-cran" | ||
- BOOTSTRAP_LATEX="1" | ||
- CRAN: http://cran.rstudio.com | ||
- R_BUILD_ARGS="--no-build-vignettes --no-manual --no-examples" | ||
- R_CHECK_ARGS="--no-build-vignettes --no-manuall --no-examples --as-cran" | ||
matrix: | ||
- NOT_CRAN="true" | ||
- NOT_CRAN="false" | ||
|
||
before_install: | ||
- cd pkg/caret | ||
- curl -OL http://raw.github.com/craigcitro/r-travis/master/scripts/travis-tool.sh | ||
- chmod 755 ./travis-tool.sh | ||
- ./travis-tool.sh bootstrap | ||
|
||
install: | ||
- ./travis-tool.sh install_deps | ||
- sudo add-apt-repository -y ppa:texlive-backports/ppa | ||
- sudo add-apt-repository ppa:texlive-backports/ppa -y | ||
- sudo apt-get -qq update | ||
- ./travis-tool.sh aptget_install texlive-base | ||
- ./travis-tool.sh aptget_install biblatex | ||
- ./travis-tool.sh aptget_install texlive-latex-base | ||
- ./travis-tool.sh aptget_install texlive-latex-recommended | ||
- ./travis-tool.sh aptget_install texlive-latex-extra | ||
- ./travis-tool.sh aptget_install texlive-fonts-recommended | ||
- ./travis-tool.sh aptget_install texlive-fonts-extra | ||
- ./travis-tool.sh aptget_install texlive-science | ||
- ./travis-tool.sh github_package jimhester/covr | ||
|
||
script: ./travis-tool.sh run_tests | ||
|
||
on_failure: | ||
- ./travis-tool.sh dump_logs | ||
|
||
after_success: | ||
- Rscript -e 'library(covr);coveralls()' | ||
apt_packages: | ||
- texlive-base | ||
- biblatex | ||
- texlive-latex-base | ||
- texlive-latex-recommended | ||
- texlive-latex-extra | ||
- texlive-fonts-recommended | ||
- texlive-fonts-extra | ||
- texlive-science | ||
|
||
r_binary_packages: | ||
- arm | ||
- glmnet | ||
- rpart | ||
- C50 | ||
- ipred | ||
- plyr | ||
- earth | ||
- kknn | ||
|
||
r_github_packages: | ||
- jimhester/covr | ||
|
||
notifications: | ||
email: | ||
on_success: change | ||
on_failure: change | ||
|
||
after_script: | ||
- Rscript -e 'library(devtools);test()' | ||
- dump_logs | ||
|
||
after_success: | ||
- Rscript -e 'library(covr);coveralls()' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
library(caret) | ||
context('Test Data Splitting Functions') | ||
|
||
test_that('createTimeSlices', { | ||
set.seed(1) | ||
y <- 1:10 | ||
|
||
s1 <- createTimeSlices(y, initialWindow=5, horizon=1, fixedWindow=TRUE) | ||
expect_equal(length(s1$train), 5) | ||
expect_equal(length(s1$test), 5) | ||
expect_equal(s1$train$Training1, 1:5) | ||
expect_equal(s1$train$Training2, 2:6) | ||
expect_equal(s1$train$Training3, 3:7) | ||
expect_equal(s1$train$Training4, 4:8) | ||
expect_equal(s1$train$Training5, 5:9) | ||
expect_equal(s1$test$Testing1, 6) | ||
expect_equal(s1$test$Testing2, 7) | ||
expect_equal(s1$test$Testing3, 8) | ||
expect_equal(s1$test$Testing4, 9) | ||
expect_equal(s1$test$Testing5, 10) | ||
|
||
s2 <- createTimeSlices(y, initialWindow=5, horizon=1, fixedWindow=FALSE) | ||
expect_equal(length(s2$train), 5) | ||
expect_equal(length(s2$test), 5) | ||
expect_equal(s2$train$Training1, 1:5) | ||
expect_equal(s2$train$Training2, 1:6) | ||
expect_equal(s2$train$Training3, 1:7) | ||
expect_equal(s2$train$Training4, 1:8) | ||
expect_equal(s2$train$Training5, 1:9) | ||
expect_equal(s2$test$Testing1, 6) | ||
expect_equal(s2$test$Testing2, 7) | ||
expect_equal(s2$test$Testing3, 8) | ||
expect_equal(s2$test$Testing4, 9) | ||
expect_equal(s2$test$Testing5, 10) | ||
|
||
s3 <- createTimeSlices(y, initialWindow=5, horizon=5, fixedWindow=TRUE) | ||
expect_equal(length(s3$train), 1) | ||
expect_equal(length(s3$test), 1) | ||
expect_equal(s3$train$Training1, 1:5) | ||
expect_equal(s3$test$Testing1, 6:10) | ||
|
||
s4 <- createTimeSlices(y, initialWindow=5, horizon=5, fixedWindow=FALSE) | ||
expect_equal(length(s3$train), 1) | ||
expect_equal(length(s3$test), 1) | ||
expect_equal(s3$train$Training1, 1:5) | ||
expect_equal(s3$test$Testing1, 6:10) | ||
|
||
expect_identical(s3, s4) | ||
}) |
Oops, something went wrong.