dakep / pense-rpkg

R Package implementing the Penalized Elastic Net S- and MM-Estimator for Linear Regression
https://dakep.github.io/pense-rpkg
Other
4 stars 2 forks source link

pense issue with new Armadillo 12.6.0 / RcppArmadillo 0.12.6.0.1 #8

Closed eddelbuettel closed 1 year ago

eddelbuettel commented 1 year ago

Hi pense team

Conrad released Armadillo 12.6.0 a few days ago, and I wrapped it up in RcppArmadillo 0.12.6.0.1 (with a first revision removing some new move constructors for row and col vectors we do not currently support). This packages tests well for the over 1000 CRAN packages using RcppArmadillo with the exception of two packages having issues at CRAN too (so "it is them") -- and package pense where I get 21 numeric errors in your unit tests.

I have not dug into the code, and given that over 1000 other packages are fine am suspecting it may be at your end. Could you take a look? You can get the updated RcppArmadillo via remotes::install_github("rcppcore/rcpparmadillo") or via install.packages("RcppArmadillo", repos=c("https://RcppCore.github.io/drat", "https://cloud.r-project.org")) .

Please do not hesitate to reach out if you have any questions.

dakep commented 1 year ago

Thanks, @eddelbuettel, for reporting. It most certainly is my code. I'll take a look at it.

eddelbuettel commented 1 year ago

Thanks @dakep -- at first glance it is quite clear how / why / the new armadillo would impact downstream code. It may also be a 'dormant' on either side (you in pense, us in RcppArmadilo, ...) rather than Conrad. Thanks for taking a peek.

dakep commented 1 year ago

Thanks, @conradsnicta, for the insights. It's most likely the numerical tolerance as this has happened to me before.

I tested with the latest RcppArmadillo version from github (8d24c46b) both on rhub/debian-gcc-devel and on macOS with (R 4.3.1 Patched (2023-07-21 r84719)), but the unit tests run successfully. @eddelbuettel, could you please share details on which platform/compiler you see the errors?

eddelbuettel commented 1 year ago

Sweet! Thanks for checking.

I am running on a courtesy shell account I have on a VM in Vienna and while it runs current and decent software (Debian testing, generally current) the hardware is ancient and among the rought 2700 reverse depends of Rcpp I had this once or twice before. So I could be hardware-local!

For the record it is 'Intel(R) Xeon(R) CPU 5140 @ 2.33GHz'. I could drill down into particular tests of yours and/or try a branch if you have one.

eddelbuettel commented 1 year ago

I also get 19 FAIL on my machine. More recent i7, Ubuntu 23.04, default blas if that matters. Details below the fold.

``` R version 4.3.1 (2023-06-16) -- "Beagle Scouts" Copyright (C) 2023 The R Foundation for Statistical Computing Platform: x86_64-pc-linux-gnu (64-bit) R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > if (require(testthat)) { + library(pense) + test_check("pense") + } else { + warning("'pense' requires 'testthat' for tests.") + } Loading required package: testthat Loading required package: Matrix [ FAIL 19 | WARN 0 | SKIP 8 | PASS 120 ] ══ Skipped tests (8) ═══════════════════════════════════════════════════════════ • Environment variable `PENSE_TEST_FULL` not defined. (8): 'test_mest_algorithm.R:6:3', 'test_mest_algorithm.R:58:3', 'test_multiple_alpha.R:5:3', 'test_multiple_alpha.R:47:3', 'test_multiple_alpha.R:102:3', 'test_multiple_alpha.R:142:3', 'test_pense_algorithm.R:6:3', 'test_pense_algorithm.R:51:3' ══ Failed tests ════════════════════════════════════════════════════════════════ ── Failure ('test_elnet_algorithms.R:119:3'): Elastic Net Algorithm `DAL` ────── max_gradient(alpha = 0.1, "w/o weights", "w/o loadings", "w/o intercept") is not less than 1e-06. Difference: Inf Backtrace: ▆ 1. └─pense (local) check_en_algorithm(en_dal_options(), num_tol_comp = 1e-06, num_tol = 1e-09) at test_elnet_algorithms.R:119:2 2. └─base::lapply(...) at test_elnet_algorithms.R:101:2 3. └─pense (local) FUN(X[[i]], ...) 4. └─base::lapply(...) at test_elnet_algorithms.R:102:4 5. └─pense (local) FUN(X[[i]], ...) 6. └─base::lapply(...) at test_elnet_algorithms.R:103:6 7. └─pense (local) FUN(X[[i]], ...) 8. └─base::lapply(...) at test_elnet_algorithms.R:105:10 9. └─pense (local) FUN(X[[i]], ...) 10. └─testthat::expect_lte(...) at test_elnet_algorithms.R:106:12 ── Failure ('test_elnet_algorithms.R:119:3'): Elastic Net Algorithm `DAL` ────── max_gradient(alpha = 0.1, "w/o weights", "w/ loadings", "w/o intercept") is not less than 1e-06. Difference: Inf Backtrace: ▆ 1. └─pense (local) check_en_algorithm(en_dal_options(), num_tol_comp = 1e-06, num_tol = 1e-09) at test_elnet_algorithms.R:119:2 2. └─base::lapply(...) at test_elnet_algorithms.R:101:2 3. └─pense (local) FUN(X[[i]], ...) 4. └─base::lapply(...) at test_elnet_algorithms.R:102:4 5. └─pense (local) FUN(X[[i]], ...) 6. └─base::lapply(...) at test_elnet_algorithms.R:103:6 7. └─pense (local) FUN(X[[i]], ...) 8. └─base::lapply(...) at test_elnet_algorithms.R:105:10 9. └─pense (local) FUN(X[[i]], ...) 10. └─testthat::expect_lte(...) at test_elnet_algorithms.R:106:12 ── Failure ('test_elnet_algorithms.R:119:3'): Elastic Net Algorithm `DAL` ────── max_gradient(alpha = 0.1, "w/o weights", "w/o loadings", "w/ intercept") is not less than 1e-06. Difference: Inf Backtrace: ▆ 1. └─pense (local) check_en_algorithm(en_dal_options(), num_tol_comp = 1e-06, num_tol = 1e-09) at test_elnet_algorithms.R:119:2 2. └─base::lapply(...) at test_elnet_algorithms.R:101:2 3. └─pense (local) FUN(X[[i]], ...) 4. └─base::lapply(...) at test_elnet_algorithms.R:102:4 5. └─pense (local) FUN(X[[i]], ...) 6. └─base::lapply(...) at test_elnet_algorithms.R:103:6 7. └─pense (local) FUN(X[[i]], ...) 8. └─base::lapply(...) at test_elnet_algorithms.R:105:10 9. └─pense (local) FUN(X[[i]], ...) 10. └─testthat::expect_lte(...) at test_elnet_algorithms.R:106:12 ── Failure ('test_elnet_algorithms.R:119:3'): Elastic Net Algorithm `DAL` ────── max_gradient(alpha = 0.1, "w/o weights", "w/ loadings", "w/ intercept") is not less than 1e-06. Difference: Inf Backtrace: ▆ 1. └─pense (local) check_en_algorithm(en_dal_options(), num_tol_comp = 1e-06, num_tol = 1e-09) at test_elnet_algorithms.R:119:2 2. └─base::lapply(...) at test_elnet_algorithms.R:101:2 3. └─pense (local) FUN(X[[i]], ...) 4. └─base::lapply(...) at test_elnet_algorithms.R:102:4 5. └─pense (local) FUN(X[[i]], ...) 6. └─base::lapply(...) at test_elnet_algorithms.R:103:6 7. └─pense (local) FUN(X[[i]], ...) 8. └─base::lapply(...) at test_elnet_algorithms.R:105:10 9. └─pense (local) FUN(X[[i]], ...) 10. └─testthat::expect_lte(...) at test_elnet_algorithms.R:106:12 ── Failure ('test_elnet_algorithms.R:119:3'): Elastic Net Algorithm `DAL` ────── max_gradient(alpha = 0.1, "w/ weights", "w/o loadings", "w/ intercept") is not less than 1e-06. Difference: 0.666 Backtrace: ▆ 1. └─pense (local) check_en_algorithm(en_dal_options(), num_tol_comp = 1e-06, num_tol = 1e-09) at test_elnet_algorithms.R:119:2 2. └─base::lapply(...) at test_elnet_algorithms.R:101:2 3. └─pense (local) FUN(X[[i]], ...) 4. └─base::lapply(...) at test_elnet_algorithms.R:102:4 5. └─pense (local) FUN(X[[i]], ...) 6. └─base::lapply(...) at test_elnet_algorithms.R:103:6 7. └─pense (local) FUN(X[[i]], ...) 8. └─base::lapply(...) at test_elnet_algorithms.R:105:10 9. └─pense (local) FUN(X[[i]], ...) 10. └─testthat::expect_lte(...) at test_elnet_algorithms.R:106:12 ── Failure ('test_elnet_algorithms.R:119:3'): Elastic Net Algorithm `DAL` ────── max_gradient(alpha = 0.5, "w/ weights", "w/o loadings", "w/o intercept") is not less than 1e-06. Difference: 0.799 Backtrace: ▆ 1. └─pense (local) check_en_algorithm(en_dal_options(), num_tol_comp = 1e-06, num_tol = 1e-09) at test_elnet_algorithms.R:119:2 2. └─base::lapply(...) at test_elnet_algorithms.R:101:2 3. └─pense (local) FUN(X[[i]], ...) 4. └─base::lapply(...) at test_elnet_algorithms.R:102:4 5. └─pense (local) FUN(X[[i]], ...) 6. └─base::lapply(...) at test_elnet_algorithms.R:103:6 7. └─pense (local) FUN(X[[i]], ...) 8. └─base::lapply(...) at test_elnet_algorithms.R:105:10 9. └─pense (local) FUN(X[[i]], ...) 10. └─testthat::expect_lte(...) at test_elnet_algorithms.R:106:12 ── Failure ('test_elnet_algorithms.R:119:3'): Elastic Net Algorithm `DAL` ────── max_gradient(alpha = 0.5, "w/ weights", "w/o loadings", "w/ intercept") is not less than 1e-06. Difference: 0.0693 Backtrace: ▆ 1. └─pense (local) check_en_algorithm(en_dal_options(), num_tol_comp = 1e-06, num_tol = 1e-09) at test_elnet_algorithms.R:119:2 2. └─base::lapply(...) at test_elnet_algorithms.R:101:2 3. └─pense (local) FUN(X[[i]], ...) 4. └─base::lapply(...) at test_elnet_algorithms.R:102:4 5. └─pense (local) FUN(X[[i]], ...) 6. └─base::lapply(...) at test_elnet_algorithms.R:103:6 7. └─pense (local) FUN(X[[i]], ...) 8. └─base::lapply(...) at test_elnet_algorithms.R:105:10 9. └─pense (local) FUN(X[[i]], ...) 10. └─testthat::expect_lte(...) at test_elnet_algorithms.R:106:12 ── Failure ('test_elnet_algorithms.R:119:3'): Elastic Net Algorithm `DAL` ────── max_gradient(alpha = 0.8, "w/o weights", "w/ loadings", "w/o intercept") is not less than 1e-06. Difference: 2.78 Backtrace: ▆ 1. └─pense (local) check_en_algorithm(en_dal_options(), num_tol_comp = 1e-06, num_tol = 1e-09) at test_elnet_algorithms.R:119:2 2. └─base::lapply(...) at test_elnet_algorithms.R:101:2 3. └─pense (local) FUN(X[[i]], ...) 4. └─base::lapply(...) at test_elnet_algorithms.R:102:4 5. └─pense (local) FUN(X[[i]], ...) 6. └─base::lapply(...) at test_elnet_algorithms.R:103:6 7. └─pense (local) FUN(X[[i]], ...) 8. └─base::lapply(...) at test_elnet_algorithms.R:105:10 9. └─pense (local) FUN(X[[i]], ...) 10. └─testthat::expect_lte(...) at test_elnet_algorithms.R:106:12 ── Failure ('test_elnet_algorithms.R:119:3'): Elastic Net Algorithm `DAL` ────── max_gradient(alpha = 0.8, "w/o weights", "w/ loadings", "w/ intercept") is not less than 1e-06. Difference: 0.51 Backtrace: ▆ 1. └─pense (local) check_en_algorithm(en_dal_options(), num_tol_comp = 1e-06, num_tol = 1e-09) at test_elnet_algorithms.R:119:2 2. └─base::lapply(...) at test_elnet_algorithms.R:101:2 3. └─pense (local) FUN(X[[i]], ...) 4. └─base::lapply(...) at test_elnet_algorithms.R:102:4 5. └─pense (local) FUN(X[[i]], ...) 6. └─base::lapply(...) at test_elnet_algorithms.R:103:6 7. └─pense (local) FUN(X[[i]], ...) 8. └─base::lapply(...) at test_elnet_algorithms.R:105:10 9. └─pense (local) FUN(X[[i]], ...) 10. └─testthat::expect_lte(...) at test_elnet_algorithms.R:106:12 ── Failure ('test_elnet_algorithms.R:119:3'): Elastic Net Algorithm `DAL` ────── max_gradient(alpha = 0.8, "w/ weights", "w/o loadings", "w/o intercept") is not less than 1e-06. Difference: 0.199 Backtrace: ▆ 1. └─pense (local) check_en_algorithm(en_dal_options(), num_tol_comp = 1e-06, num_tol = 1e-09) at test_elnet_algorithms.R:119:2 2. └─base::lapply(...) at test_elnet_algorithms.R:101:2 3. └─pense (local) FUN(X[[i]], ...) 4. └─base::lapply(...) at test_elnet_algorithms.R:102:4 5. └─pense (local) FUN(X[[i]], ...) 6. └─base::lapply(...) at test_elnet_algorithms.R:103:6 7. └─pense (local) FUN(X[[i]], ...) 8. └─base::lapply(...) at test_elnet_algorithms.R:105:10 9. └─pense (local) FUN(X[[i]], ...) 10. └─testthat::expect_lte(...) at test_elnet_algorithms.R:106:12 ── Failure ('test_elnet_algorithms.R:119:3'): Elastic Net Algorithm `DAL` ────── max_gradient(alpha = 0.8, "w/ weights", "w/o loadings", "w/ intercept") is not less than 1e-06. Difference: 0.00266 Backtrace: ▆ 1. └─pense (local) check_en_algorithm(en_dal_options(), num_tol_comp = 1e-06, num_tol = 1e-09) at test_elnet_algorithms.R:119:2 2. └─base::lapply(...) at test_elnet_algorithms.R:101:2 3. └─pense (local) FUN(X[[i]], ...) 4. └─base::lapply(...) at test_elnet_algorithms.R:102:4 5. └─pense (local) FUN(X[[i]], ...) 6. └─base::lapply(...) at test_elnet_algorithms.R:103:6 7. └─pense (local) FUN(X[[i]], ...) 8. └─base::lapply(...) at test_elnet_algorithms.R:105:10 9. └─pense (local) FUN(X[[i]], ...) 10. └─testthat::expect_lte(...) at test_elnet_algorithms.R:106:12 ── Failure ('test_elnet_algorithms.R:119:3'): Elastic Net Algorithm `DAL` ────── max_gradient(alpha = 0.8, "w/ weights", "w/ loadings", "w/ intercept") is not less than 1e-06. Difference: 0.126 Backtrace: ▆ 1. └─pense (local) check_en_algorithm(en_dal_options(), num_tol_comp = 1e-06, num_tol = 1e-09) at test_elnet_algorithms.R:119:2 2. └─base::lapply(...) at test_elnet_algorithms.R:101:2 3. └─pense (local) FUN(X[[i]], ...) 4. └─base::lapply(...) at test_elnet_algorithms.R:102:4 5. └─pense (local) FUN(X[[i]], ...) 6. └─base::lapply(...) at test_elnet_algorithms.R:103:6 7. └─pense (local) FUN(X[[i]], ...) 8. └─base::lapply(...) at test_elnet_algorithms.R:105:10 9. └─pense (local) FUN(X[[i]], ...) 10. └─testthat::expect_lte(...) at test_elnet_algorithms.R:106:12 ── Failure ('test_elnet_algorithms.R:119:3'): Elastic Net Algorithm `DAL` ────── max_gradient(alpha = 1, "w/o weights", "w/ loadings", "w/o intercept") is not less than 1e-06. Difference: 2.38 Backtrace: ▆ 1. └─pense (local) check_en_algorithm(en_dal_options(), num_tol_comp = 1e-06, num_tol = 1e-09) at test_elnet_algorithms.R:119:2 2. └─base::lapply(...) at test_elnet_algorithms.R:101:2 3. └─pense (local) FUN(X[[i]], ...) 4. └─base::lapply(...) at test_elnet_algorithms.R:102:4 5. └─pense (local) FUN(X[[i]], ...) 6. └─base::lapply(...) at test_elnet_algorithms.R:103:6 7. └─pense (local) FUN(X[[i]], ...) 8. └─base::lapply(...) at test_elnet_algorithms.R:105:10 9. └─pense (local) FUN(X[[i]], ...) 10. └─testthat::expect_lte(...) at test_elnet_algorithms.R:106:12 ── Failure ('test_elnet_algorithms.R:119:3'): Elastic Net Algorithm `DAL` ────── max_gradient(alpha = 1, "w/o weights", "w/o loadings", "w/ intercept") is not less than 1e-06. Difference: 0.379 Backtrace: ▆ 1. └─pense (local) check_en_algorithm(en_dal_options(), num_tol_comp = 1e-06, num_tol = 1e-09) at test_elnet_algorithms.R:119:2 2. └─base::lapply(...) at test_elnet_algorithms.R:101:2 3. └─pense (local) FUN(X[[i]], ...) 4. └─base::lapply(...) at test_elnet_algorithms.R:102:4 5. └─pense (local) FUN(X[[i]], ...) 6. └─base::lapply(...) at test_elnet_algorithms.R:103:6 7. └─pense (local) FUN(X[[i]], ...) 8. └─base::lapply(...) at test_elnet_algorithms.R:105:10 9. └─pense (local) FUN(X[[i]], ...) 10. └─testthat::expect_lte(...) at test_elnet_algorithms.R:106:12 ── Failure ('test_elnet_algorithms.R:119:3'): Elastic Net Algorithm `DAL` ────── max_gradient(alpha = 1, "w/o weights", "w/ loadings", "w/ intercept") is not less than 1e-06. Difference: 0.343 Backtrace: ▆ 1. └─pense (local) check_en_algorithm(en_dal_options(), num_tol_comp = 1e-06, num_tol = 1e-09) at test_elnet_algorithms.R:119:2 2. └─base::lapply(...) at test_elnet_algorithms.R:101:2 3. └─pense (local) FUN(X[[i]], ...) 4. └─base::lapply(...) at test_elnet_algorithms.R:102:4 5. └─pense (local) FUN(X[[i]], ...) 6. └─base::lapply(...) at test_elnet_algorithms.R:103:6 7. └─pense (local) FUN(X[[i]], ...) 8. └─base::lapply(...) at test_elnet_algorithms.R:105:10 9. └─pense (local) FUN(X[[i]], ...) 10. └─testthat::expect_lte(...) at test_elnet_algorithms.R:106:12 ── Failure ('test_elnet_algorithms.R:119:3'): Elastic Net Algorithm `DAL` ────── max_gradient(alpha = 1, "w/ weights", "w/o loadings", "w/o intercept") is not less than 1e-06. Difference: 0.0407 Backtrace: ▆ 1. └─pense (local) check_en_algorithm(en_dal_options(), num_tol_comp = 1e-06, num_tol = 1e-09) at test_elnet_algorithms.R:119:2 2. └─base::lapply(...) at test_elnet_algorithms.R:101:2 3. └─pense (local) FUN(X[[i]], ...) 4. └─base::lapply(...) at test_elnet_algorithms.R:102:4 5. └─pense (local) FUN(X[[i]], ...) 6. └─base::lapply(...) at test_elnet_algorithms.R:103:6 7. └─pense (local) FUN(X[[i]], ...) 8. └─base::lapply(...) at test_elnet_algorithms.R:105:10 9. └─pense (local) FUN(X[[i]], ...) 10. └─testthat::expect_lte(...) at test_elnet_algorithms.R:106:12 ── Failure ('test_elnet_algorithms.R:119:3'): Elastic Net Algorithm `DAL` ────── max_gradient(alpha = 1, "w/ weights", "w/ loadings", "w/o intercept") is not less than 1e-06. Difference: 0.91 Backtrace: ▆ 1. └─pense (local) check_en_algorithm(en_dal_options(), num_tol_comp = 1e-06, num_tol = 1e-09) at test_elnet_algorithms.R:119:2 2. └─base::lapply(...) at test_elnet_algorithms.R:101:2 3. └─pense (local) FUN(X[[i]], ...) 4. └─base::lapply(...) at test_elnet_algorithms.R:102:4 5. └─pense (local) FUN(X[[i]], ...) 6. └─base::lapply(...) at test_elnet_algorithms.R:103:6 7. └─pense (local) FUN(X[[i]], ...) 8. └─base::lapply(...) at test_elnet_algorithms.R:105:10 9. └─pense (local) FUN(X[[i]], ...) 10. └─testthat::expect_lte(...) at test_elnet_algorithms.R:106:12 ── Failure ('test_elnet_algorithms.R:119:3'): Elastic Net Algorithm `DAL` ────── max_gradient(alpha = 1, "w/ weights", "w/o loadings", "w/ intercept") is not less than 1e-06. Difference: 1.01e+03 Backtrace: ▆ 1. └─pense (local) check_en_algorithm(en_dal_options(), num_tol_comp = 1e-06, num_tol = 1e-09) at test_elnet_algorithms.R:119:2 2. └─base::lapply(...) at test_elnet_algorithms.R:101:2 3. └─pense (local) FUN(X[[i]], ...) 4. └─base::lapply(...) at test_elnet_algorithms.R:102:4 5. └─pense (local) FUN(X[[i]], ...) 6. └─base::lapply(...) at test_elnet_algorithms.R:103:6 7. └─pense (local) FUN(X[[i]], ...) 8. └─base::lapply(...) at test_elnet_algorithms.R:105:10 9. └─pense (local) FUN(X[[i]], ...) 10. └─testthat::expect_lte(...) at test_elnet_algorithms.R:106:12 ── Failure ('test_elnet_algorithms.R:119:3'): Elastic Net Algorithm `DAL` ────── max_gradient(alpha = 1, "w/ weights", "w/ loadings", "w/ intercept") is not less than 1e-06. Difference: 0.0792 Backtrace: ▆ 1. └─pense (local) check_en_algorithm(en_dal_options(), num_tol_comp = 1e-06, num_tol = 1e-09) at test_elnet_algorithms.R:119:2 2. └─base::lapply(...) at test_elnet_algorithms.R:101:2 3. └─pense (local) FUN(X[[i]], ...) 4. └─base::lapply(...) at test_elnet_algorithms.R:102:4 5. └─pense (local) FUN(X[[i]], ...) 6. └─base::lapply(...) at test_elnet_algorithms.R:103:6 7. └─pense (local) FUN(X[[i]], ...) 8. └─base::lapply(...) at test_elnet_algorithms.R:105:10 9. └─pense (local) FUN(X[[i]], ...) 10. └─testthat::expect_lte(...) at test_elnet_algorithms.R:106:12 [ FAIL 19 | WARN 0 | SKIP 8 | PASS 120 ] Error: Test failures Execution halted ```
dakep commented 1 year ago

Thanks, @conradsnicta and @eddelbuettel for digging into this issue. I have now been able to reproduce the errors on my end, too (on a different system). Once I applied Conrad's fix the tests ran successfully again. So I'm hopeful this was indeed the source of the error.

I'm leaving the issue open until the fix has been applied upstream to RcppArmadillo and the GitHub CI tests also show a green light again.

dakep commented 1 year ago

GitHub action CI unit tests run successfully again with RcppArmadillo 0.12.6.1.0 (commit ae097d1).

eddelbuettel commented 1 year ago

Yep. I am currently running the reverse depends check, alphabetically, but got past pense a little while ago. All good here too.

So it was always our end -- so big thank you for your patience here.