Skip to content

Commit

Permalink
Merge pull request #59 from tlverse/devel
Browse files Browse the repository at this point in the history
  • Loading branch information
nhejazi authored Sep 23, 2021
2 parents 35e8b79 + 5c1dc7f commit 49c69b3
Show file tree
Hide file tree
Showing 38 changed files with 489 additions and 498 deletions.
1 change: 1 addition & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
^.*\.Rproj$
^\.Rproj\.user$
^\.github$
^\.travis\.yml$
^appveyor\.yml$
^codecov\.yml$
Expand Down
1 change: 1 addition & 0 deletions .github/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.html
66 changes: 66 additions & 0 deletions .github/workflows/R-CMD-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
on:
push:
branches:
- master
- devel
pull_request:
branches:
- master
- devel

name: R-CMD-check

jobs:
R-CMD-check:
runs-on: ${{ matrix.config.os }}
name: ${{ matrix.config.os }} (${{ matrix.config.r }})

strategy:
fail-fast: false
matrix:
config:
- {os: ubuntu-latest, r: 'release'}
- {os: macOS-latest, r: 'release'}
- {os: windows-latest, r: 'release'}

env:
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}

steps:
- name: Checkout repo
uses: actions/checkout@v2

- name: Setup R
uses: r-lib/actions/setup-r@master
with:
r-version: ${{ matrix.config.r }}

- name: Install pandoc
uses: r-lib/actions/setup-pandoc@v1

- name: Install tinyTeX
uses: r-lib/actions/setup-tinytex@v1

- name: Install system dependencies
if: runner.os == 'Linux'
run: |
sudo apt install -y curl libcurl4-doc libcurl4-openssl-dev
- name: Install package dependencies
run: |
install.packages(c("remotes", "rcmdcheck", "covr", "sessioninfo"))
remotes::install_deps(dependencies = TRUE)
shell: Rscript {0}

- name: Check package
run: |
options(crayon.enabled = TRUE)
rcmdcheck::rcmdcheck(args = "--no-manual", error_on = "error")
shell: Rscript {0}

- name: Upload code coverage
if: runner.os == 'Linux'
run: |
covr::codecov()
shell: Rscript {0}
36 changes: 0 additions & 36 deletions .travis.yml

This file was deleted.

5 changes: 3 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: origami
Title: Generalized Framework for Cross-Validation
Version: 1.0.4
Version: 1.0.5
Authors@R: c(
person("Jeremy", "Coyle", email = "jeremyrcoyle@gmail.com",
role = c("aut", "cre", "cph"),
Expand Down Expand Up @@ -39,8 +39,9 @@ Suggests:
rmarkdown,
knitr,
stringr,
glmnet,
forecast,
randomForest
LazyData: true
VignetteBuilder: knitr
RoxygenNote: 7.1.1.9000
RoxygenNote: 7.1.2
11 changes: 8 additions & 3 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# origami 1.0.5
* Addition of `glmnet` to package `Suggests` since used in the vignette.
* Resolve issue stemming from the partial matching of argument names
(https://github.com/tlverse/origami/issues/56) by specifying throughout.

# origami 1.0.4
* Fix the incorrect use of `future.apply` by including `future.seed = TRUE`,
as per https://github.com/tlverse/origami/issues/48.
Expand All @@ -6,10 +11,10 @@
* Sped up all pooled time-series fold functions with `lapply`.
* All pooled time-series fold functions (`folds_rolling_origin_pooled`,
`folds_rolling_window_pooled`, `folds_vfold_rolling_origin_pooled`,
`folds_vfold_rolling_window_pooled`) now allow for variability in the
number of observations for each independent unit (i.e. subject).
`folds_vfold_rolling_window_pooled`) now allow for variability in the
number of observations for each independent unit (i.e., the subject).
* Added test for pooled time-series cross-validation with multi-unit time-series
to test the update above. In this test, the total number of observations
to test the update above. In this test, the total number of observations
and the time-points for which there are observations varies across the units.

# origami 1.0.3
Expand Down
14 changes: 7 additions & 7 deletions R/fold_funs.R
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ folds_vfold <- function(n, V = 10L) {
warning("n <= V so using leave-one-out CV")
return(folds_loo(n))
}
folds <- rep(seq_len(V), length = n)
folds <- rep(x = seq_len(V), length.out = n)

# shuffle folds
folds <- sample(folds)
Expand Down Expand Up @@ -157,7 +157,7 @@ folds_rolling_origin_pooled <- function(n, t, id = NULL, time = NULL,

# make IDs the same length as time if only one ID provided
if (length(id) == 1L) {
id <- rep(id, length(time))
id <- rep(x = id, length.out = length(time))
}

# make skeleton dataset with IDs and times
Expand Down Expand Up @@ -202,7 +202,7 @@ folds_rolling_window_pooled <- function(n, t, id = NULL, time = NULL,

# make IDs the same length as time if only one ID provided
if (length(id) == 1L) {
id <- rep(id, length(time))
id <- rep(x = id, length.out = length(time))
}

# make skeleton dataset with IDs and times
Expand Down Expand Up @@ -249,7 +249,7 @@ folds_vfold_rolling_origin_pooled <- function(n, t, id = NULL, time = NULL,

# make IDs the same length as time if only one ID provided
if (length(id) == 1L) {
id <- rep(id, length(time))
id <- rep(x = id, length.out = length(time))
}

# make skeleton dataset with IDs and times
Expand All @@ -268,7 +268,7 @@ folds_vfold_rolling_origin_pooled <- function(n, t, id = NULL, time = NULL,
message(paste("Processing", length(ids), "samples with", t, "time points."))

# establish V folds for cross-validating ids
Vfold_allocation <- sample(rep(seq_len(V), length = length(ids)))
Vfold_allocation <- sample(rep(x = seq_len(V), length.out = length(ids)))
Vfolds_skeleton <- lapply(seq_len(V), fold_from_foldvec, Vfold_allocation)

# establish rolling origin forecast for time-series cross-validation
Expand Down Expand Up @@ -316,7 +316,7 @@ folds_vfold_rolling_window_pooled <- function(n, t, id = NULL, time = NULL,

# make IDs the same length as time if only one ID provided
if (length(id) == 1) {
id <- rep(id, length(time))
id <- rep(x = id, length.out = length(time))
}

# make skeleton dataset with IDs and times
Expand All @@ -335,7 +335,7 @@ folds_vfold_rolling_window_pooled <- function(n, t, id = NULL, time = NULL,
message(paste("Processing", length(ids), "samples with", t, "time points."))

# establish V folds for cross-validating ids
Vfold_allocation <- sample(rep(seq_len(V), length = length(ids)))
Vfold_allocation <- sample(rep(x = seq_len(V), length.out = length(ids)))
Vfolds_skeleton <- lapply(seq_len(V), fold_from_foldvec, Vfold_allocation)

# establish rolling origin forecast for time-series cross-validation
Expand Down
19 changes: 8 additions & 11 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ knitr::opts_chunk$set(

# R/`origami` <img src="./hex/origami-sticker.png" align="right" width='125'/>

[![Travis-CI Build Status](https://travis-ci.org/tlverse/origami.svg?branch=master)](https://travis-ci.org/tlverse/origami)
[![Build status](https://ci.appveyor.com/api/projects/status/bfe2jd9a065jhql7?svg=true)](https://ci.appveyor.com/project/tlverse/origami)
[![R-CMD-check](https://github.com/tlverse/origami/workflows/R-CMD-check/badge.svg)](https://github.com/tlverse/origami/actions)
[![Coverage Status](https://codecov.io/gh/tlverse/origami/branch/master/graph/badge.svg)](https://codecov.io/gh/tlverse/origami)
[![CRAN](http://www.r-pkg.org/badges/version/origami)](http://www.r-pkg.org/pkg/origami)
[![CRAN downloads](https://cranlogs.r-pkg.org/badges/origami)](https://CRAN.R-project.org/package=origami)
Expand All @@ -34,11 +33,11 @@ Phillips](https://github.com/rachaelvphillips)

---

## Description
## What's `origami`?

`origami` is an R package that provides a general framework for the application
of cross-validation schemes to particular functions. By allowing arbitrary lists
of results, `origami` accommodates a range of cross-validation applications.
The `origami` R package provides a general framework for the application of
cross-validation schemes to particular functions. By allowing arbitrary lists of
results, `origami` accommodates a range of cross-validation applications.

---

Expand Down Expand Up @@ -124,10 +123,8 @@ issue](https://github.com/tlverse/origami/issues).

## Contributions

It is our hope that `origami` will grow to be adopted as a backend for most any
procedure requiring cross-validation, including its integration into larger
machine learning frameworks. To that end, contributions are very welcome, though
we ask that interested contributors consult our [contribution
Contributions are very welcome. Interested contributors should consult our
[contribution
guidelines](https://github.com/tlverse/origami/blob/master/CONTRIBUTING.md)
prior to submitting a pull request.

Expand All @@ -154,7 +151,7 @@ After using the `origami` R package, please cite it:

## License

&copy; 2017-2020 [Jeremy R. Coyle](https://github.com/jeremyrcoyle)
&copy; 2017-2021 [Jeremy R. Coyle](https://github.com/jeremyrcoyle)

The contents of this repository are distributed under the GPL-3 license. See
file `LICENSE` for details.
25 changes: 9 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@

# R/`origami` <img src="./hex/origami-sticker.png" align="right" width='125'/>

[![Travis-CI Build
Status](https://travis-ci.org/tlverse/origami.svg?branch=master)](https://travis-ci.org/tlverse/origami)
[![Build
status](https://ci.appveyor.com/api/projects/status/bfe2jd9a065jhql7?svg=true)](https://ci.appveyor.com/project/tlverse/origami)
[![R-CMD-check](https://github.com/tlverse/origami/workflows/R-CMD-check/badge.svg)](https://github.com/tlverse/origami/actions)
[![Coverage
Status](https://codecov.io/gh/tlverse/origami/branch/master/graph/badge.svg)](https://codecov.io/gh/tlverse/origami)
[![CRAN](http://www.r-pkg.org/badges/version/origami)](http://www.r-pkg.org/pkg/origami)
Expand All @@ -32,11 +29,11 @@ Phillips](https://github.com/rachaelvphillips)

-----

## Description
## What’s `origami`?

`origami` is an R package that provides a general framework for the
application of cross-validation schemes to particular functions. By
allowing arbitrary lists of results, `origami` accommodates a range of
The `origami` R package provides a general framework for the application
of cross-validation schemes to particular functions. By allowing
arbitrary lists of results, `origami` accommodates a range of
cross-validation applications.

-----
Expand Down Expand Up @@ -78,7 +75,7 @@ estimate of the mean:
``` r
library(stringr)
library(origami)
#> origami v1.0.3: Generalized Framework for Cross-Validation
#> origami v1.0.4: Generalized Framework for Cross-Validation
set.seed(4795)

data(mtcars)
Expand All @@ -90,7 +87,6 @@ head(mtcars)
#> Hornet 4 Drive 21.4 6 258 110 3.08 3.215 19.44 1 0 3 1
#> Hornet Sportabout 18.7 8 360 175 3.15 3.440 17.02 0 0 3 2
#> Valiant 18.1 6 225 105 2.76 3.460 20.22 1 0 3 1

# build a cv_fun that wraps around lm
cv_lm <- function(fold, data, reg_form) {
# get name and index of outcome variable from regression formula
Expand Down Expand Up @@ -133,11 +129,8 @@ If you encounter any bugs or have any specific feature requests, please

## Contributions

It is our hope that `origami` will grow to be adopted as a backend for
most any procedure requiring cross-validation, including its integration
into larger machine learning frameworks. To that end, contributions are
very welcome, though we ask that interested contributors consult our
[contribution
Contributions are very welcome. Interested contributors should consult
our [contribution
guidelines](https://github.com/tlverse/origami/blob/master/CONTRIBUTING.md)
prior to submitting a pull request.

Expand Down Expand Up @@ -166,7 +159,7 @@ After using the `origami` R package, please cite it:

## License

© 2017-2020 [Jeremy R. Coyle](https://github.com/jeremyrcoyle)
© 2017-2021 [Jeremy R. Coyle](https://github.com/jeremyrcoyle)

The contents of this repository are distributed under the GPL-3 license.
See file `LICENSE` for details.
Loading

0 comments on commit 49c69b3

Please sign in to comment.