Skip to content

Commit 1c21b0d

Browse files
authored
feat!: use libslope (#35)
Closes #32, closes #25, closes #5, closes #24, closes #11 feat!: use libslope Closes #32, closes #25, closes #5, closes #24, closes #11
1 parent a9b29a3 commit 1c21b0d

File tree

205 files changed

+24524
-3992
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

205 files changed

+24524
-3992
lines changed

..Rcheck/00check.log

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
* using log directory ‘/home/jola/projects/SLOPE/..Rcheck’
2+
* using R version 4.4.2 (2024-10-31)
3+
* using platform: x86_64-pc-linux-gnu
4+
* R was compiled by
5+
gcc (GCC) 14.2.1 20241116
6+
GNU Fortran (GCC) 14.2.1 20241116
7+
* running under: NixOS 25.05 (Warbler)
8+
* using session charset: UTF-8
9+
* checking for file ‘./DESCRIPTION’ ... ERROR
10+
Required fields missing or empty:
11+
‘Author’ ‘Maintainer’
12+
* DONE
13+
Status: 1 ERROR

.Rbuildignore

+3
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,6 @@
3131
^flake\.nix$
3232
^\.envrc$
3333
^Taskfile.yml$
34+
^doc$
35+
^Meta$
36+
^_libs$

.gitignore

+3-12
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,4 @@
1-
inst/doc
2-
.Rhistory
3-
.RData
4-
.Rproj.user
5-
docs/
6-
.vscode/
7-
compile_commands.json
8-
*.swp
9-
.cache
10-
src/.cache
11-
12-
# NIX
1+
# NIX ---------------------------------------------
132
# Ignore build outputs from performing a nix-build or command
143
result
154
result-*
@@ -18,3 +7,5 @@ result-*
187
.direnv/
198

209
_libs
10+
/doc/
11+
/Meta/

DESCRIPTION

+3-4
Original file line numberDiff line numberDiff line change
@@ -89,19 +89,18 @@ Imports:
8989
Rcpp
9090
LinkingTo:
9191
Rcpp,
92-
RcppArmadillo (>= 0.9.850.1.0)
92+
RcppEigen (>= 0.3.4.0.0)
9393
Suggests:
9494
bench,
95-
glmnet,
9695
covr,
9796
dplyr,
9897
knitr,
9998
rmarkdown,
10099
scales,
101100
spelling,
102101
testthat (>= 2.1.0),
103-
tidyr,
104-
vdiffr
102+
tidyr
103+
SystemRequirements: C++17
105104
Roxygen: list(markdown = TRUE)
106105
RoxygenNote: 7.3.2
107106
Language: en-US

NEWS.md

+82
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# SLOPE 0.5.2.9000
22

3+
This update of SLOPE brings an entirely different C++ implementation of the
4+
underlying package based on the C++ library
5+
[libslope](https://github.com/jolars/libslope). It comes with several large and
6+
breaking changes with respect to the previous version of the package.
7+
8+
We realized that this may throw off some users, and hope that you will be
9+
patient with dealing with the large number of breaking changes.
10+
311
## Breaking Changes
412

513
- The `caretSLOPE()` function that was deprecated has now been removed from the
@@ -10,6 +18,80 @@
1018
respectively, have been removed. The proximal operator is now always computed
1119
using the fast stack-based algorithm. There was never any reason to use the
1220
slower PAVA algorithm.
21+
- The ADMM solver has been removed from the package. Calling `SLOPE()` with
22+
`solver = "admm"` will now throws a warning and the value will be
23+
automatically set to `"auto"`.
24+
- `alpha` is now scaled by `n` (the number of observations) and differences with
25+
respect to the type of scaling are no longer taken into account.
26+
- The multinomial family now uses the redundant parameterization of the
27+
multinomial logistic regression model. This means that regularization
28+
sequences need to be of length `p` times `m` (number of classes). The returned
29+
coefficients from `SLOPE()` now have dimensions `p` times `m` (rather than
30+
`m - 1`).
31+
- The object `coefficients` from `SLOPE()` is now a list of sparse matrices
32+
(rather than a three-dimensional array as before). Now it contains only the
33+
coefficients and not the intercepts. The intercepts are instead stored in
34+
`intercepts` in the returned object and are always present even if
35+
`intercept = FALSE`.
36+
- The behavior of `coef.SLOPE()` has changed somewhat.
37+
- The default value of `q` in `SLOPE()` has changed from
38+
`0.1 * min(1, NROW(x) / NCOL(x))` to `0.1`.
39+
- Arguments `sigma`, `n_sigma`, and `lambda_min_ratio` in `SLOPE()` that were
40+
previously deprecated have been removed.
41+
- `SLOPE()` now internally solves the problem normalized by scaling with the
42+
number of observations, which means that values returned in `deviance` and
43+
`prmals` and `duals` if `diagnostics = TRUE` are now scaled by `n`.
44+
- `path_length` in `SLOPE()` now defaults to 100 (previously 20).
45+
- `tol_dev_ratio` in `SLOPE()` now defaults to `0.999` (previously `0.995`).
46+
47+
## Deprecated Functionality
48+
49+
- Arguments `tol_rel_gap`, `tol_infeas`, `tol_abs`, `tol_rel`, `tol_rel_coef` in
50+
`SLOPE()` are now deprecated. The solvers now all rely on the same tolerance
51+
criterion, which is set by `tol` and uses the duality gap normalized by the
52+
current primal value.
53+
- Arguments `screen` and `screen_alg` are now deprecated and have no effect.
54+
Feature screening is always used. These arguments were only used for
55+
debugging.
56+
- The argument `verbosity` in `SLOPE()` is now defunct and has no effect.
57+
- The argument `prox_method` in `SLOPE()` and `sortedL1Prox()` is now defunct
58+
and has no effect.
59+
60+
## New Features
61+
62+
- Centering `x` in `SLOPE()` is now allowed again.
63+
- Centers and scales can now be specified manually by providing vectors to
64+
`center` and `scale` in `SLOPE()`.
65+
- A new solver based on a hybrid method of proximal gradient descent and
66+
coordinate descent is available and used by default by the Gaussian and
67+
binomial families. Use it by specifying `solver = "hybrid"`.
68+
- Solver can now be set to `"auto"`, in which case the package automatically
69+
chooses a solver.
70+
- The returned duality gaps when `diagnostics = TRUE` are now _true_ duality
71+
gaps, computed by guaranteeing that the dual variable is feasible (which was
72+
not the case previously).
73+
- `scale` in `SLOPE()` gains a new option `"max_abs"` which scales the columns
74+
of `x` by their maximum absolute value.
75+
76+
## Performance Improvements
77+
78+
The new hybrid algorithm that's implemented in libslope and now used in the
79+
package constitutes a major upgrade in terms of performance.
80+
81+
- The solver is now much more memory-efficient and can avoid copies of the
82+
design matrix entirely by normalizing the columns just-in-time. This is the
83+
standard behavior. Future versions of the package will allow the user to
84+
specify whether to copy (and modify) the design matrix or not.
85+
86+
## Dependencies
87+
88+
We have made an effort to reduce the footprint of the package and reduce the
89+
number of dependencies.
90+
91+
- The package now relies on Eigen (through RcppEigen) rather than Armadillo,
92+
which means that there is no longer any reliance on BLAS and LAPACK libraries.
93+
- The `vdiffr` and `glmnet` packages in the `Suggests` field that were used for
94+
testing are now removed.
1395

1496
# SLOPE 0.5.2
1597

R/RcppExports.R

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
# Generated by using Rcpp::compileAttributes() -> do not edit by hand
22
# Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393
33

4-
lambdaSequence <- function(n_lambda, q, theta1, theta2, lambda_type, n) {
5-
.Call(`_SLOPE_lambdaSequence`, n_lambda, q, theta1, theta2, lambda_type, n)
4+
sortedL1ProxCpp <- function(x, lambda) {
5+
.Call(`_SLOPE_sortedL1ProxCpp`, x, lambda)
66
}
77

8-
sortedL1ProxCpp <- function(x, lambda, method) {
9-
.Call(`_SLOPE_sortedL1ProxCpp`, x, lambda, method)
8+
lambdaSequenceCpp <- function(n_lambda, q, theta1, theta2, lambda_type, n) {
9+
.Call(`_SLOPE_lambdaSequenceCpp`, n_lambda, q, theta1, theta2, lambda_type, n)
1010
}
1111

1212
sparseSLOPE <- function(x, y, control) {

0 commit comments

Comments
 (0)