Skip to content

Commit cdb1fe0

Browse files
authored
Update package for CRAN compliance (0.4.0) (#11)
Brings the package back in line with current CRAN policies so it can be resubmitted after being unlisted. * Register native routines via R_registerRoutines (required since R 3.4) and disable dynamic symbol lookup. * Add FCONE / USE_FC_LEN_T for the F77_CALL(dgemv) call so it compiles against modern R headers. * Replace printf with Rprintf and drop stdio.h from C sources. * Replace T/F with TRUE/FALSE in R sources and tests. * print.ftrlprox now returns invisible(x) and documents @return. * DESCRIPTION: bump version to 0.4.0, drop unused LazyData, raise min R to 3.5.0, add stats to Imports, refresh RoxygenNote. * Documentation: fix ftrlprox.matrix -> ftrlprox.default reference, author typo, missing \value in print. * LICENSE: fix copyright holder spelling. * tests/testthat.R: pin RNGversion("3.5.0") so legacy hard-coded coefficient expectations remain reproducible after R 3.6's sample() change. * CI: drop .travis.yml in favour of r-lib/actions workflows for R-CMD-check (macOS/Windows/Ubuntu x release/devel/oldrel-1) and test-coverage. Refresh README badges.
1 parent 90b7db5 commit cdb1fe0

29 files changed

Lines changed: 208 additions & 56 deletions

.Rbuildignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
^.*\.Rproj$
22
^\.Rproj\.user$
3-
^\.travis\.yml$
43
^.*\.o$
54
^Makefile$
5+
^\.github$
6+
^README\.md$
7+
^codecov\.yml$

.github/workflows/R-CMD-check.yaml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
2+
on:
3+
push:
4+
branches: [main, master]
5+
pull_request:
6+
branches: [main, master]
7+
8+
name: R-CMD-check
9+
10+
jobs:
11+
R-CMD-check:
12+
runs-on: ${{ matrix.config.os }}
13+
14+
name: ${{ matrix.config.os }} (${{ matrix.config.r }})
15+
16+
strategy:
17+
fail-fast: false
18+
matrix:
19+
config:
20+
- {os: macos-latest, r: 'release'}
21+
- {os: windows-latest, r: 'release'}
22+
- {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'}
23+
- {os: ubuntu-latest, r: 'release'}
24+
- {os: ubuntu-latest, r: 'oldrel-1'}
25+
26+
env:
27+
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
28+
R_KEEP_PKG_SOURCE: yes
29+
30+
steps:
31+
- uses: actions/checkout@v4
32+
33+
- uses: r-lib/actions/setup-pandoc@v2
34+
35+
- uses: r-lib/actions/setup-r@v2
36+
with:
37+
r-version: ${{ matrix.config.r }}
38+
http-user-agent: ${{ matrix.config.http-user-agent }}
39+
use-public-rspm: true
40+
41+
- uses: r-lib/actions/setup-r-dependencies@v2
42+
with:
43+
extra-packages: any::rcmdcheck
44+
needs: check
45+
46+
- uses: r-lib/actions/check-r-package@v2
47+
with:
48+
upload-snapshots: true
49+
build_args: 'c("--no-manual","--compact-vignettes=gs+qpdf")'
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
2+
on:
3+
push:
4+
branches: [main, master]
5+
pull_request:
6+
branches: [main, master]
7+
8+
name: test-coverage
9+
10+
jobs:
11+
test-coverage:
12+
runs-on: ubuntu-latest
13+
env:
14+
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
15+
16+
steps:
17+
- uses: actions/checkout@v4
18+
19+
- uses: r-lib/actions/setup-r@v2
20+
with:
21+
use-public-rspm: true
22+
23+
- uses: r-lib/actions/setup-r-dependencies@v2
24+
with:
25+
extra-packages: any::covr
26+
needs: coverage
27+
28+
- name: Test coverage
29+
run: |
30+
covr::codecov(
31+
quiet = FALSE,
32+
clean = FALSE,
33+
install_path = file.path(normalizePath(Sys.getenv("RUNNER_TEMP"), winslash = "/"), "package")
34+
)
35+
shell: Rscript {0}
36+
37+
- name: Show testthat output
38+
if: always()
39+
run: |
40+
## --------------------------------------------------------------------
41+
find ${{ runner.temp }}/package -name 'testthat.Rout*' -exec cat '{}' \; || true
42+
shell: bash
43+
44+
- name: Upload test results
45+
if: failure()
46+
uses: actions/upload-artifact@v4
47+
with:
48+
name: coverage-test-failures
49+
path: ${{ runner.temp }}/package

.travis.yml

Lines changed: 0 additions & 11 deletions
This file was deleted.

DESCRIPTION

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,23 @@
11
Package: FTRLProximal
22
Title: FTRL Proximal Implementation for Elastic Net Regression
3-
Version: 0.3.1
3+
Version: 0.4.0
44
Authors@R: person("Vilhelm", "von Ehrenheim", email = "vonehrenheim@gmail.com", role = c("aut", "cre"))
5-
Description: Implementation of Follow The Regularized Leader (FTRL) Proximal algorithm, proposed by McMahan et al. (2013) <doi:10.1145/2487575.2488200>, used for online training of large scale regression models using a mixture of L1 and L2 regularization.
5+
Description: Implementation of Follow The Regularized Leader (FTRL) Proximal
6+
algorithm, proposed by McMahan et al. (2013)
7+
<doi:10.1145/2487575.2488200>, used for online training of large scale
8+
regression models using a mixture of L1 and L2 regularization.
69
URL: https://github.com/while/FTRLProximal
710
BugReports: https://github.com/while/FTRLProximal/issues
811
Depends:
9-
R (>= 3.2.3)
12+
R (>= 3.5.0)
1013
Imports:
1114
Matrix,
12-
methods
15+
methods,
16+
stats
1317
License: MIT + file LICENSE
1418
Encoding: UTF-8
15-
LazyData: true
16-
RoxygenNote: 5.0.1
17-
Suggests:
19+
RoxygenNote: 7.3.2
20+
Suggests:
1821
testthat,
1922
covr,
2023
mlbench

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
YEAR: 2016
2-
COPYRIGHT HOLDER: Vilhelm von Erenheim
2+
COPYRIGHT HOLDER: Vilhelm von Ehrenheim

NAMESPACE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@ export(initialize.ftrlprox)
1111
import(Matrix)
1212
importFrom(methods,as)
1313
importFrom(stats,model.matrix)
14-
useDynLib(FTRLProximal)
14+
useDynLib(FTRLProximal, .registration = TRUE)

R/ftrlprox.default.r

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,12 @@
1818
#' @author Vilhelm von Ehrenheim
1919
#'
2020
#' @method ftrlprox default
21-
#' @useDynLib FTRLProximal
21+
#' @useDynLib FTRLProximal, .registration = TRUE
2222
#' @importFrom methods as
2323
#' @export
2424
##------------------------------------------------------------------------------
2525
ftrlprox.default <- function(x, y, lambda, alpha, a, b=1, num_epochs=1,
26-
save_loss=F, ...) {
26+
save_loss=FALSE, ...) {
2727
if (nrow(x) != length(y))
2828
stop(sprintf("Input has differing number of rows, nrow(x)=%d, length(y)=%d",
2929
nrow(x), length(y)))

R/ftrlprox.formula.r

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
#' @param ... additional args
1717
#' @return ftrlprox model object
1818
#' @author Vilhelm von Ehrenheim
19-
#' @useDynLib FTRLProximal
19+
#' @useDynLib FTRLProximal, .registration = TRUE
2020
#' @importFrom stats model.matrix
2121
#' @export
2222
#'
@@ -30,7 +30,7 @@
3030
#' a = 0.3, lambda = 5.0, alpha = 1.0)
3131
#' print(mdl)
3232
##------------------------------------------------------------------------------
33-
ftrlprox.formula <- function(formula, data, lambda, alpha, a, b=1, num_epochs=1, save_loss=F, ...) {
33+
ftrlprox.formula <- function(formula, data, lambda, alpha, a, b=1, num_epochs=1, save_loss=FALSE, ...) {
3434

3535
X <- model.matrix(formula, data)
3636
y <- data[[all.vars(formula[[2]])]]

R/ftrlprox.r

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@
33
#'
44
#' Online elastic net regression using the FTRL Proximal algorithm for training.
55
#'
6-
#' This is the generic method. Please look at ftrlprox.matrix and ftrlprox.formula for the model matrix and formula versions respectively.
6+
#' This is the generic method. Please look at ftrlprox.default and ftrlprox.formula for the model matrix and formula versions respectively.
77
#'
88
#' @param x the model matrix containing features
99
#' @param ... the rest of the model parameters
1010
#' @return ftrlprox model object
1111
#' @author Vilhelm von Ehrenheim
1212
#'
13-
#' @useDynLib FTRLProximal
13+
#' @useDynLib FTRLProximal, .registration = TRUE
1414
#' @export
1515
##------------------------------------------------------------------------------
1616
ftrlprox <- function(x, ...) {

0 commit comments

Comments
 (0)