Skip to content

Commit f0bb735

Browse files
authored
Merge pull request #56 from dajmcdon/weight-normalization
Weight normalization
2 parents 0ebb531 + 4655a0b commit f0bb735

19 files changed

Lines changed: 50 additions & 83 deletions

DESCRIPTION

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Package: sparsegl
33
Title: Sparse Group Lasso
44
Version: 1.1.1.9000
55
Authors@R: c(
6-
person("Daniel J.", "McDonald", , "daniel@stat.ubc.ca", role = c("aut", "cre")),
6+
person("Daniel J.", "McDonald", , "daniel@stat.ubc.ca", role = c("aut", "cre", "cph")),
77
person("Xiaoxuan", "Liang", , "xiaoxuan.liang@stat.ubc.ca", role = "aut"),
88
person("Anibal", "Solón Heinsfeld", , "anibalsolon@gmail.com", role = "aut"),
99
person("Aaron", "Cohen", , "cohenaa@indiana.edu", role = "aut"),
@@ -19,7 +19,7 @@ Authors@R: c(
1919
person("James", "Yang", role = "ctb")
2020
)
2121
Description: Efficient implementation of sparse group lasso with optional
22-
bound constraints on the coefficients; see
22+
bound constraints on the coefficients; see Liang, et al., (2024)
2323
<doi:10.18637/jss.v110.i06>. It supports the use of a sparse design
2424
matrix as well as returning coefficient estimates in a sparse matrix.
2525
Furthermore, it correctly calculates the degrees of freedom to allow
@@ -36,7 +36,6 @@ Imports:
3636
cli,
3737
dotCall64,
3838
ggplot2,
39-
magrittr,
4039
Matrix,
4140
methods,
4241
rlang,

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
YEAR: 2024
1+
YEAR: 2025
22
COPYRIGHT HOLDER: sparsegl authors

LICENSE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# MIT License
22

3-
Copyright (c) 2024 sparsegl authors
3+
Copyright (c) 2025 sparsegl authors
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

NAMESPACE

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ S3method(print,summary.cvsparsegl)
2222
S3method(print,summary.sparsegl)
2323
S3method(summary,cv.sparsegl)
2424
S3method(summary,sparsegl)
25-
export("%>%")
2625
export(cv.sparsegl)
2726
export(estimate_risk)
2827
export(gr_one_norm)
@@ -45,7 +44,6 @@ importFrom(dotCall64,.C64)
4544
importFrom(dotCall64,integer_dc)
4645
importFrom(dotCall64,numeric_dc)
4746
importFrom(dotCall64,vector_dc)
48-
importFrom(magrittr,"%>%")
4947
importFrom(methods,as)
5048
importFrom(methods,cbind2)
5149
importFrom(methods,rbind2)

NEWS.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# sparsegl (development version)
22

3+
* Force `weights` to sum to `nobs` for all IRWLS cases.
4+
* Remove `magrittr` from imports
5+
36
# sparsegl 1.1.1
47

58
* Add CITATION and links to JSS article

R/data.R

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,13 @@
4646
#' \dontrun{
4747
#' library(splines)
4848
#' library(dplyr)
49-
#' library(magrittr)
5049
#' df <- 10
5150
#'
52-
#' trust_experts <- trust_experts %>%
53-
#' mutate(across(
51+
#' trust_experts <- mutate(
52+
#' trust_experts,
53+
#' across(
5454
#' where(is.factor),
55-
#' ~ set_attr(.x, "contrasts", contr.sum(nlevels(.x), FALSE, TRUE))
55+
#' ~ rlang::set_attrs(.x, "contrasts", contr.sum(nlevels(.x), FALSE, TRUE))
5656
#' ))
5757
#'
5858
#' x <- Matrix::sparse.model.matrix(

R/plot.cv.sparsegl.R

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,7 @@ plot.cv.sparsegl <- function(x, log_axis = c("xy", "x", "y", "none"),
3636
)
3737
log_axis <- match.arg(log_axis)
3838
sign.lambda <- sign(sign.lambda)
39-
g <- dat %>%
40-
ggplot2::ggplot(ggplot2::aes(x = .data$X, y = .data$y)) +
39+
g <- ggplot2::ggplot(dat, ggplot2::aes(x = .data$X, y = .data$y)) +
4140
ggplot2::geom_errorbar(
4241
ggplot2::aes(ymin = .data$lower, ymax = .data$upper),
4342
color = "darkgrey"

R/plot.sparsegl.R

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,7 @@ plot.sparsegl <- function(x,
6060

6161
df$lambda <- x$lambda
6262
df$penalty <- sgnorm / max(sgnorm)
63-
df <- df %>%
64-
tidyr::pivot_longer(!c(.data$lambda, .data$penalty), names_to = y_axis)
63+
df <- tidyr::pivot_longer(df, !c(.data$lambda, .data$penalty), names_to = y_axis)
6564

6665
plot_layer <- ggplot2::ggplot(
6766
df, ggplot2::aes(

R/sgl_irwls.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ sgl_irwls <- function(
5252
if (is.null(weights)) {
5353
weights <- rep(1, nobs)
5454
} else {
55-
weights <- weights / sum(weights)
55+
weights <- weights / sum(weights) * nobs
5656
}
5757
etastart <- 0
5858
mustart <- NULL

R/sparsegl-package.R

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
#' @keywords internal
1212
#' @references Liang, X., Cohen, A., Sólon Heinsfeld, A., Pestilli, F., and
1313
#' McDonald, D.J. 2024.
14-
#' \emph{sparsegl: An `R` Package for Estimating Sparse Group Lasso.}
15-
#' Journal of Statistical Software, Vol. 110(6): 1–23.
16-
#' \doi{10.18637/jss.v110.i06}.
14+
#' "sparsegl: An `R` Package for Estimating Sparse Group Lasso."
15+
#' _Journal of Statistical Software_, **110**(6): 1–23.
16+
#' [doi:10.18637/jss.v110.i06](https://doi.org/10.18637/jss.v110.i06).
1717
"_PACKAGE"

0 commit comments

Comments
 (0)