From 05018dfeea11e0685ca03544bbc070288443a580 Mon Sep 17 00:00:00 2001 From: Waldir Leoncio Date: Mon, 12 Aug 2024 06:33:28 +0200 Subject: [PATCH] Defaults `cl` to 1 (closes #50) --- R/MADMMplasso.R | 2 +- R/cv_MADMMplasso.R | 2 +- man/MADMMplasso.Rd | 2 +- man/cv_MADMMplasso.Rd | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/R/MADMMplasso.R b/R/MADMMplasso.R index 17c4dc1..aab30ab 100644 --- a/R/MADMMplasso.R +++ b/R/MADMMplasso.R @@ -48,7 +48,7 @@ #' @example inst/examples/MADMMplasso_example.R #' @export -MADMMplasso <- function(X, Z, y, alpha, my_lambda = NULL, lambda_min = 0.001, max_it = 50000, e.abs = 1E-3, e.rel = 1E-3, maxgrid, nlambda, rho = 5, my_print = FALSE, alph = 1.8, tree, pal = cl == 1L, gg = NULL, tol = 1E-4, cl = detectCores() - 1L, legacy = FALSE) { +MADMMplasso <- function(X, Z, y, alpha, my_lambda = NULL, lambda_min = 0.001, max_it = 50000, e.abs = 1E-3, e.rel = 1E-3, maxgrid, nlambda, rho = 5, my_print = FALSE, alph = 1.8, tree, pal = cl == 1L, gg = NULL, tol = 1E-4, cl = 1L, legacy = FALSE) { # Recalculating the number of CPUs cl <- ifelse(pal, 1L, cl) # cl is irrelevant if pal = TRUE parallel <- cl > 1L diff --git a/R/cv_MADMMplasso.R b/R/cv_MADMMplasso.R index 832c9aa..bf0fc4d 100644 --- a/R/cv_MADMMplasso.R +++ b/R/cv_MADMMplasso.R @@ -11,7 +11,7 @@ #' @return results containing the CV values #' @example inst/examples/cv_MADMMplasso_example.R #' @export -cv_MADMMplasso <- function(fit, nfolds, X, Z, y, alpha = 0.5, lambda = fit$Lambdas, max_it = 50000, e.abs = 1E-3, e.rel = 1E-3, nlambda, rho = 5, my_print = FALSE, alph = 1, foldid = NULL, pal = cl == 1L, gg = c(7, 0.5), TT, tol = 1E-4, cl = detectCores() - 1L, legacy = FALSE) { +cv_MADMMplasso <- function(fit, nfolds, X, Z, y, alpha = 0.5, lambda = fit$Lambdas, max_it = 50000, e.abs = 1E-3, e.rel = 1E-3, nlambda, rho = 5, my_print = FALSE, alph = 1, foldid = NULL, pal = cl == 1L, gg = c(7, 0.5), TT, tol = 1E-4, cl = 1L, legacy = FALSE) { BIG <- 10e9 no <- nrow(X) ggg <- vector("list", nfolds) diff --git a/man/MADMMplasso.Rd b/man/MADMMplasso.Rd index 15497bf..10334f8 100644 --- a/man/MADMMplasso.Rd +++ b/man/MADMMplasso.Rd @@ -25,7 +25,7 @@ MADMMplasso( pal = cl == 1L, gg = NULL, tol = 1e-04, - cl = detectCores() - 1L, + cl = 1L, legacy = FALSE ) } diff --git a/man/cv_MADMMplasso.Rd b/man/cv_MADMMplasso.Rd index b368c7c..44aa3fa 100644 --- a/man/cv_MADMMplasso.Rd +++ b/man/cv_MADMMplasso.Rd @@ -24,7 +24,7 @@ cv_MADMMplasso( gg = c(7, 0.5), TT, tol = 1e-04, - cl = detectCores() - 1L, + cl = 1L, legacy = FALSE ) }