From c10cc91eec0d362afb720c718b6643696ab1afd5 Mon Sep 17 00:00:00 2001 From: bbayukari <17bbayukari@gmail.com> Date: Tue, 19 Sep 2023 01:31:30 +0800 Subject: [PATCH 1/3] chore: set OMP_THREAD_LIMIT to 2 on CRAN the code in examples, unittest and vignettes of R will use less than 2 threads for requirement of CRAN --- R-package/R/abess.R | 1 + R-package/R/abesspca.R | 1 + R-package/R/abessrpca.R | 1 + R-package/man/abess.Rd | 1 + R-package/man/abesspca.Rd | 1 + R-package/man/abessrpca.Rd | 1 + R-package/tests/testthat.R | 2 ++ R-package/vignettes/_v13-Use-abess-via-mlr3.Rmd | 4 ++++ R-package/vignettes/v01-abess-guide.Rmd | 1 + R-package/vignettes/v03-classification.Rmd | 1 + R-package/vignettes/v04-PoissonGammaReg.Rmd | 1 + R-package/vignettes/v05-coxreg.Rmd | 1 + R-package/vignettes/v06-MultiTaskLearning.Rmd | 1 + R-package/vignettes/v07-advancedFeatures.Rmd | 1 + R-package/vignettes/v08-sPCA.Rmd | 4 ++++ R-package/vignettes/v09-fasterSetting.Rmd | 1 + R-package/vignettes/v10-algorithm.Rmd | 1 + R-package/vignettes/v11-power-of-abess.Rmd | 1 + .../vignettes/v12-Robust-Principal-Component-Analysis.Rmd | 1 + 19 files changed, 26 insertions(+) diff --git a/R-package/R/abess.R b/R-package/R/abess.R index ef7fbe056..b6aa05131 100644 --- a/R-package/R/abess.R +++ b/R-package/R/abess.R @@ -202,6 +202,7 @@ abess <- function(x, ...) UseMethod("abess") #' @examples #' \donttest{ #' library(abess) +#' Sys.setenv("OMP_THREAD_LIMIT" = 2) #' n <- 100 #' p <- 20 #' support.size <- 3 diff --git a/R-package/R/abesspca.R b/R-package/R/abesspca.R index ccc687318..3e7328a61 100644 --- a/R-package/R/abesspca.R +++ b/R-package/R/abesspca.R @@ -97,6 +97,7 @@ #' @examples #' \donttest{ #' library(abess) +#' Sys.setenv("OMP_THREAD_LIMIT" = 2) #' #' ## predictor matrix input: #' head(USArrests) diff --git a/R-package/R/abessrpca.R b/R-package/R/abessrpca.R index c22ba72a1..bd8e475c8 100644 --- a/R-package/R/abessrpca.R +++ b/R-package/R/abessrpca.R @@ -60,6 +60,7 @@ #' @examples #' \donttest{ #' library(abess) +#' Sys.setenv("OMP_THREAD_LIMIT" = 2) #' n <- 30 #' p <- 30 #' true_S_size <- 60 diff --git a/R-package/man/abess.Rd b/R-package/man/abess.Rd index c68d99ff4..96a4143ac 100644 --- a/R-package/man/abess.Rd +++ b/R-package/man/abess.Rd @@ -268,6 +268,7 @@ Please see \href{https://abess-team.github.io/abess/articles/v07-advancedFeature \examples{ \donttest{ library(abess) +Sys.setenv("OMP_THREAD_LIMIT" = 2) n <- 100 p <- 20 support.size <- 3 diff --git a/R-package/man/abesspca.Rd b/R-package/man/abesspca.Rd index 81f87871f..5794d4be5 100644 --- a/R-package/man/abesspca.Rd +++ b/R-package/man/abesspca.Rd @@ -168,6 +168,7 @@ because the meaning of these parameters are very similar. \examples{ \donttest{ library(abess) +Sys.setenv("OMP_THREAD_LIMIT" = 2) ## predictor matrix input: head(USArrests) diff --git a/R-package/man/abessrpca.Rd b/R-package/man/abessrpca.Rd index 9a863011b..d4ac02474 100644 --- a/R-package/man/abessrpca.Rd +++ b/R-package/man/abessrpca.Rd @@ -144,6 +144,7 @@ This feature will coming soon. \examples{ \donttest{ library(abess) +Sys.setenv("OMP_THREAD_LIMIT" = 2) n <- 30 p <- 30 true_S_size <- 60 diff --git a/R-package/tests/testthat.R b/R-package/tests/testthat.R index 332332e4c..f47104281 100644 --- a/R-package/tests/testthat.R +++ b/R-package/tests/testthat.R @@ -1,3 +1,5 @@ +Sys.setenv("OMP_THREAD_LIMIT" = 2) + library(testthat) library(abess) diff --git a/R-package/vignettes/_v13-Use-abess-via-mlr3.Rmd b/R-package/vignettes/_v13-Use-abess-via-mlr3.Rmd index beec7dd64..eba495ed4 100644 --- a/R-package/vignettes/_v13-Use-abess-via-mlr3.Rmd +++ b/R-package/vignettes/_v13-Use-abess-via-mlr3.Rmd @@ -17,6 +17,10 @@ output: This guide is to show how to use `abess` via mlr3 (Machine Learning in R universe). +```{r warning=FALSE} +Sys.setenv("OMP_THREAD_LIMIT" = 2) +``` + First, install `mlr3` and `mlr3extralearners` (from github) if they are not in the environment. ``` diff --git a/R-package/vignettes/v01-abess-guide.Rmd b/R-package/vignettes/v01-abess-guide.Rmd index d610e6b61..24f0f26e0 100644 --- a/R-package/vignettes/v01-abess-guide.Rmd +++ b/R-package/vignettes/v01-abess-guide.Rmd @@ -20,6 +20,7 @@ vignette: | ```{r, echo=FALSE, message=FALSE, warning=FALSE} knitr::opts_chunk$set(warning = FALSE, eval = TRUE, message = FALSE) +Sys.setenv("OMP_THREAD_LIMIT" = 2) ``` diff --git a/R-package/vignettes/v03-classification.Rmd b/R-package/vignettes/v03-classification.Rmd index e57ea8503..d62d4f431 100644 --- a/R-package/vignettes/v03-classification.Rmd +++ b/R-package/vignettes/v03-classification.Rmd @@ -18,6 +18,7 @@ output: ```{r setup, include=FALSE} knitr::opts_chunk$set(echo = TRUE, warning = F, message = F) +Sys.setenv("OMP_THREAD_LIMIT" = 2) ``` ## Titanic Dataset and Classification diff --git a/R-package/vignettes/v04-PoissonGammaReg.Rmd b/R-package/vignettes/v04-PoissonGammaReg.Rmd index 3f388c25c..0c042cc91 100644 --- a/R-package/vignettes/v04-PoissonGammaReg.Rmd +++ b/R-package/vignettes/v04-PoissonGammaReg.Rmd @@ -21,6 +21,7 @@ vignette: | ```{r setup, include=FALSE} knitr::opts_chunk$set(echo = TRUE, warning = F, message = F) +Sys.setenv("OMP_THREAD_LIMIT" = 2) ``` ## Poisson Regression diff --git a/R-package/vignettes/v05-coxreg.Rmd b/R-package/vignettes/v05-coxreg.Rmd index 63f130f87..d3abd166c 100644 --- a/R-package/vignettes/v05-coxreg.Rmd +++ b/R-package/vignettes/v05-coxreg.Rmd @@ -18,6 +18,7 @@ output: ```{r setup, include=FALSE} knitr::opts_chunk$set(echo = TRUE, warning = FALSE, message = FALSE) +Sys.setenv("OMP_THREAD_LIMIT" = 2) ``` diff --git a/R-package/vignettes/v06-MultiTaskLearning.Rmd b/R-package/vignettes/v06-MultiTaskLearning.Rmd index f516c80ab..1b5cdf63a 100644 --- a/R-package/vignettes/v06-MultiTaskLearning.Rmd +++ b/R-package/vignettes/v06-MultiTaskLearning.Rmd @@ -18,6 +18,7 @@ output: ```{r setup, include=FALSE} knitr::opts_chunk$set(echo = TRUE, warning = F, message = F) +Sys.setenv("OMP_THREAD_LIMIT" = 2) ``` ## Brief Introduction diff --git a/R-package/vignettes/v07-advancedFeatures.Rmd b/R-package/vignettes/v07-advancedFeatures.Rmd index a49a750ac..e9a18373b 100644 --- a/R-package/vignettes/v07-advancedFeatures.Rmd +++ b/R-package/vignettes/v07-advancedFeatures.Rmd @@ -18,6 +18,7 @@ output: ```{r setup, include=FALSE} knitr::opts_chunk$set(echo = TRUE) +Sys.setenv("OMP_THREAD_LIMIT" = 2) ``` ## Introduction diff --git a/R-package/vignettes/v08-sPCA.Rmd b/R-package/vignettes/v08-sPCA.Rmd index bd0d90c62..75c2d36ad 100644 --- a/R-package/vignettes/v08-sPCA.Rmd +++ b/R-package/vignettes/v08-sPCA.Rmd @@ -15,6 +15,10 @@ output: keep_md: yes --- +```{r warning=FALSE} +Sys.setenv("OMP_THREAD_LIMIT" = 2) +``` + ## Introduction Principal component analysis (PCA) is an important method in the field of data science, which can reduce the dimension of data and simplify our model. It actually solve an optimization problem like: diff --git a/R-package/vignettes/v09-fasterSetting.Rmd b/R-package/vignettes/v09-fasterSetting.Rmd index af3f49c26..f3bb8611f 100644 --- a/R-package/vignettes/v09-fasterSetting.Rmd +++ b/R-package/vignettes/v09-fasterSetting.Rmd @@ -21,6 +21,7 @@ editor_options: ```{r setup, include=FALSE} knitr::opts_chunk$set(echo = TRUE) +Sys.setenv("OMP_THREAD_LIMIT" = 2) ``` ## Introduction diff --git a/R-package/vignettes/v10-algorithm.Rmd b/R-package/vignettes/v10-algorithm.Rmd index a9d5a9c81..1b2fb8206 100644 --- a/R-package/vignettes/v10-algorithm.Rmd +++ b/R-package/vignettes/v10-algorithm.Rmd @@ -23,6 +23,7 @@ vignette: | ```{r setup, include=FALSE} knitr::opts_chunk$set(echo = TRUE, message = F, warning = F) +Sys.setenv("OMP_THREAD_LIMIT" = 2) ``` # Introduction diff --git a/R-package/vignettes/v11-power-of-abess.Rmd b/R-package/vignettes/v11-power-of-abess.Rmd index ea82f00b4..f520ffc23 100644 --- a/R-package/vignettes/v11-power-of-abess.Rmd +++ b/R-package/vignettes/v11-power-of-abess.Rmd @@ -18,6 +18,7 @@ output: ```{r setup, include=FALSE} knitr::opts_chunk$set(echo = TRUE, warning = F, message = F) +Sys.setenv("OMP_THREAD_LIMIT" = 2) ``` In this part, we are going to explore the power of the abess package using simulated data. We compare the abess package with popular R libraries: `glmnet`, `ncvreg` for linear and logistic regressions in the following section. diff --git a/R-package/vignettes/v12-Robust-Principal-Component-Analysis.Rmd b/R-package/vignettes/v12-Robust-Principal-Component-Analysis.Rmd index 01d55e048..37da59fea 100644 --- a/R-package/vignettes/v12-Robust-Principal-Component-Analysis.Rmd +++ b/R-package/vignettes/v12-Robust-Principal-Component-Analysis.Rmd @@ -5,6 +5,7 @@ output: html_document ```{r setup, include=FALSE} knitr::opts_chunk$set(echo = T) +Sys.setenv("OMP_THREAD_LIMIT" = 2) ``` This vignette introduces what is adaptive best subset selection robust principal component analysis and then we will show how it works using *abess* package on an artificial example. From 7af52d5e107b5650c908da94a8b9494ad628b438 Mon Sep 17 00:00:00 2001 From: bbayukari <17bbayukari@gmail.com> Date: Tue, 19 Sep 2023 19:05:25 +0800 Subject: [PATCH 2/3] chore: update date of R --- R-package/DESCRIPTION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R-package/DESCRIPTION b/R-package/DESCRIPTION index 5a5b2fdfb..fabf57336 100644 --- a/R-package/DESCRIPTION +++ b/R-package/DESCRIPTION @@ -2,7 +2,7 @@ Package: abess Type: Package Title: Fast Best Subset Selection Version: 0.4.8 -Date: 2023-02-19 +Date: 2023-09-19 Authors@R: c( person(given = "Jin", family = "Zhu", email = "zhuj37@mail2.sysu.edu.cn", role = c("aut", "cre"), comment = c(ORCID = "0000-0001-8550-5822")), person(given = "Zezhi", family = "Wang", email = "homura@mail.ustc.edu.cn", role = c("aut")), From 43a419584ce279aaf3657eb6e6cfd2373dbbb5e6 Mon Sep 17 00:00:00 2001 From: bbayukari <17bbayukari@gmail.com> Date: Sun, 1 Oct 2023 14:34:25 +0800 Subject: [PATCH 3/3] docs: fix docs build failing --- .readthedocs.yaml | 2 ++ docs/Tutorial/5-scikit-learn-connection/plot_2_geomstats.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.readthedocs.yaml b/.readthedocs.yaml index de5f0b288..bd11fd93c 100644 --- a/.readthedocs.yaml +++ b/.readthedocs.yaml @@ -10,6 +10,8 @@ build: - pip install --no-cache-dir pybind11[global] pre_build: - pip install --no-cache-dir -r docs/requirements.txt + apt_packages: + - graphviz python: install: diff --git a/docs/Tutorial/5-scikit-learn-connection/plot_2_geomstats.py b/docs/Tutorial/5-scikit-learn-connection/plot_2_geomstats.py index 4b24da064..41f55d573 100644 --- a/docs/Tutorial/5-scikit-learn-connection/plot_2_geomstats.py +++ b/docs/Tutorial/5-scikit-learn-connection/plot_2_geomstats.py @@ -53,7 +53,7 @@ data = np.concatenate((data0,data1)) train_data, test_data, train_labels, test_labels = train_test_split(data, labels, test_size=0.33, random_state=0) -mean = FrechetMean(metric=sphere.metric) +mean = FrechetMean(sphere) mean.fit(train_data) mean_estimate = mean.estimate_