{"id":13665890,"url":"https://github.com/tlverse/sl3","last_synced_at":"2026-02-19T08:50:13.629Z","repository":{"id":29971979,"uuid":"99736385","full_name":"tlverse/sl3","owner":"tlverse","description":"💪 🤔 Modern Super Learning with Machine Learning Pipelines","archived":false,"fork":false,"pushed_at":"2024-11-14T19:52:05.000Z","size":11698,"stargazers_count":102,"open_issues_count":44,"forks_count":43,"subscribers_count":12,"default_branch":"master","last_synced_at":"2025-04-26T08:36:53.071Z","etag":null,"topics":["data-science","ensemble-learning","ensemble-model","machine-learning","model-selection","r","r-package","regression","stacking","statistics"],"latest_commit_sha":null,"homepage":"https://tlverse.org/sl3/","language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tlverse.png","metadata":{"files":{"readme":"README.Rmd","changelog":"NEWS.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2017-08-08T21:09:22.000Z","updated_at":"2025-04-18T11:56:25.000Z","dependencies_parsed_at":"2024-01-22T23:35:44.386Z","dependency_job_id":"61652887-3930-4241-bfe4-5827d788f30b","html_url":"https://github.com/tlverse/sl3","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/tlverse/sl3","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tlverse%2Fsl3","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tlverse%2Fsl3/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tlverse%2Fsl3/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tlverse%2Fsl3/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tlverse","download_url":"https://codeload.github.com/tlverse/sl3/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tlverse%2Fsl3/sbom","scorecard":{"id":889521,"data":{"date":"2025-08-11","repo":{"name":"github.com/tlverse/sl3","commit":"0e8f2365bcbe54010b8120c04a7a2dcfc8119227"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.6,"checks":[{"name":"Code-Review","score":2,"reason":"Found 2/9 approved changesets -- score normalized to 2","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/R-CMD-check.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: GNU General Public License v3.0: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/R-CMD-check.yml:32: update your workflow using https://app.stepsecurity.io/secureworkflow/tlverse/sl3/R-CMD-check.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/R-CMD-check.yml:35: update your workflow using https://app.stepsecurity.io/secureworkflow/tlverse/sl3/R-CMD-check.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/R-CMD-check.yml:40: update your workflow using https://app.stepsecurity.io/secureworkflow/tlverse/sl3/R-CMD-check.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/R-CMD-check.yml:43: update your workflow using https://app.stepsecurity.io/secureworkflow/tlverse/sl3/R-CMD-check.yml/master?enable=pin","Info:   0 out of   1 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   3 third-party GitHubAction dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 27 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-24T11:15:47.841Z","repository_id":29971979,"created_at":"2025-08-24T11:15:47.841Z","updated_at":"2025-08-24T11:15:47.841Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29609125,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-19T06:47:36.664Z","status":"ssl_error","status_checked_at":"2026-02-19T06:45:47.551Z","response_time":117,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["data-science","ensemble-learning","ensemble-model","machine-learning","model-selection","r","r-package","regression","stacking","statistics"],"created_at":"2024-08-02T06:00:53.086Z","updated_at":"2026-02-19T08:50:13.599Z","avatar_url":"https://github.com/tlverse.png","language":"R","readme":"---\nalways_allow_html: true\noutput:\n  rmarkdown::github_document\nbibliography: \"inst/REFERENCES.bib\"\n---\n\n\u003c!-- README.md is generated from README.Rmd. Please edit that file --\u003e\n\n```{r, echo = FALSE}\nknitr::opts_chunk$set(\n  collapse = TRUE,\n  comment = \"#\u003e\",\n  fig.path = \"README-\"\n)\n```\n\n# R/`sl3`: Super Machine Learning with Pipelines\n\n[![R-CMD-check](https://github.com/tlverse/sl3/workflows/R-CMD-check/badge.svg)](https://github.com/tlverse/sl3/actions)\n[![Coverage Status](https://codecov.io/gh/tlverse/sl3/branch/master/graph/badge.svg)](https://codecov.io/gh/tlverse/sl3)\n[![Project Status: Active – The project has reached a stable, usable state and is being actively developed.](https://www.repostatus.org/badges/latest/active.svg)](https://www.repostatus.org/#active)\n[![License: GPL v3](https://img.shields.io/badge/License-GPL%20v3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0)\n[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.1342293.svg)](https://doi.org/10.5281/zenodo.1342293)\n\n\u003e A flexible implementation of the Super Learner ensemble machine learning\n\u003e system\n\n__Authors:__ [Jeremy Coyle](https://github.com/jeremyrcoyle),\n[Nima Hejazi](https://nimahejazi.org),\n[Ivana Malenica](https://github.com/imalenica),\n[Rachael Phillips](https://github.com/rachaelvp), and\n[Oleg Sofrygin](https://github.com/osofr)\n\n---\n\n## What's `sl3`?\n\n`sl3` is an implementation of the Super Learner ensemble machine learning\nalgorithm of @vdl2007super. The Super Learner algorithm performs ensemble\nlearning in one of two fashions:\n\n1. The _discrete_ Super Learner can be used to select the best prediction\n   algorithm from among a supplied library of machine learning algorithms\n   (\"learners\" in the `sl3` nomenclature) -- that is, the discrete Super Learner\n   is the single learning algorithm that minimizes the cross-validated risk.\n2. The _ensemble_ Super Learner can be used to assign weights to a set of\n   specified learning algorithms (from a user-supplied library of such\n   algorithms) so as to create a combination of these learners that minimizes\n   the cross-validated risk. This notion of weighted combinations has also been \n   referred to as _stacked regression_ [@breiman1996stacked] and \n   _stacked generalization_ [@wolpert1992stacked].\n\nLooking for long-form documentation or a walkthrough of the `sl3` package?\nDon't worry! Just browse [the chapter in our\nbook](https://tlverse.org/tlverse-handbook/sl3.html).\n\n---\n\n## Installation\n\n\u003c!--\nFor standard use, we recommend installing the package from\n[CRAN](https://cran.r-project.org/) via\n\n```{r cran-installation, eval = FALSE}\ninstall.packages(\"sl3\")\n```\n--\u003e\n\nInstall the _most recent version_ from the `master` branch on GitHub via\n[`remotes`](https://CRAN.R-project.org/package=remotes):\n\n```{r gh-master-installation, eval = FALSE}\nremotes::install_github(\"tlverse/sl3\")\n```\n\nPast stable releases may be located via the\n[releases](https://github.com/tlverse/sl3/releases) page on GitHub and may be\ninstalled by including the appropriate major version tag. For example,\n\n```{r gh-version-installation, eval = FALSE}\nremotes::install_github(\"tlverse/sl3@v1.3.7\")\n```\n\nTo contribute, check out the `devel` branch and consider submitting a pull\nrequest.\n\n---\n\n## Issues\n\nIf you encounter any bugs or have any specific feature requests, please [file an\nissue](https://github.com/tlverse/sl3/issues).\n\n---\n\n## Examples\n\n`sl3` makes the process of applying screening algorithms, learning algorithms,\ncombining both types of algorithms into a stacked regression model, and\ncross-validating this whole process essentially trivial. The best way to\nunderstand this is to see the `sl3` package in action:\n\n```{r sl3-simple-example, message=FALSE, warning=FALSE}\nset.seed(49753)\nlibrary(tidyverse)\nlibrary(data.table)\nlibrary(SuperLearner)\nlibrary(origami)\nlibrary(sl3)\n\n# load example data set\ndata(cpp)\ncpp \u003c- cpp %\u003e%\n  dplyr::filter(!is.na(haz)) %\u003e%\n  mutate_all(~ replace(., is.na(.), 0))\n\n# use covariates of intest and the outcome to build a task object\ncovars \u003c- c(\"apgar1\", \"apgar5\", \"parity\", \"gagebrth\", \"mage\", \"meducyrs\",\n            \"sexn\")\ntask \u003c- sl3_Task$new(\n  data = cpp,\n  covariates = covars,\n  outcome = \"haz\"\n)\n\n# set up screeners and learners via built-in functions and pipelines\nslscreener \u003c- Lrnr_pkg_SuperLearner_screener$new(\"screen.glmnet\")\nglm_learner \u003c- Lrnr_glm$new()\nscreen_and_glm \u003c- Pipeline$new(slscreener, glm_learner)\nSL.glmnet_learner \u003c- Lrnr_pkg_SuperLearner$new(SL_wrapper = \"SL.glmnet\")\n\n# stack learners into a model (including screeners and pipelines)\nlearner_stack \u003c- Stack$new(SL.glmnet_learner, glm_learner, screen_and_glm)\nstack_fit \u003c- learner_stack$train(task)\npreds \u003c- stack_fit$predict()\nhead(preds)\n```\n\n### Parallelization with `future`s\n\nWhile it's straightforward to fit a stack of learners (as above), it's easy to\ntake advantage of `sl3`'s built-in parallelization support too. To do this,\nyou can simply choose a `plan()` from the [`future`\necosystem](https://CRAN.R-project.org/package=future).\n\n```{r sl3-parallel-example, eval=FALSE, message=FALSE, warning=FALSE}\n# let's load the future package and set 4 cores for parallelization\nlibrary(future)\nplan(multicore, workers = 4L)\n\n# now, let's re-train our Stack in parallel\nstack_fit \u003c- learner_stack$train(task)\npreds \u003c- stack_fit$predict()\n```\n\n### Controlling the number of CV folds\n\nIn the above examples, we fit stacks of learners, but didn't create a Super\nLearner ensemble, which uses cross-validation (CV) to build the ensemble model.\nFor the sake of computational expedience, we may be interested in lowering the\nnumber of CV folds (from 10).  Let's take a look at how to do both below.\n\n```{r sl3-folds-example, eval=FALSE, message=FALSE, warning=FALSE}\n# first, let's instantiate some more learners and create a Super Learner\nmean_learner \u003c- Lrnr_mean$new()\nrf_learner \u003c- Lrnr_ranger$new()\nsl \u003c- Lrnr_sl$new(mean_learner, glm_learner, rf_learner)\n\n# CV folds are controlled in the sl3_Task object; we can lower the number of\n# folds simply by specifying this in creating the Task\ntask \u003c- sl3_Task$new(\n  data = cpp,\n  covariates = covars,\n  outcome = \"haz\",\n  folds = 5L\n)\n\n# now, let's fit the Super Learner with just 5-fold CV, then get predictions\nsl_fit \u003c- sl$train(task)\nsl_preds \u003c- sl_fit$predict()\n```\n\nThe `folds` argument to `sl3_Task` supports both integers (for V-fold CV) and\nall of the CV schemes supported in the [`origami`\npackage](https://CRAN.R-project.org/package=origami). To see the full list,\nquery `?fold_funs` from within `R` or take a look at [`origami`'s online\ndocumentation](https://tlverse.org/origami/reference/).\n\n---\n\n## Learner Properties\n\nProperties supported by `sl3` learners are presented in the following table:\n\n```{r sl3-learner-properties, warning=FALSE, echo=FALSE, message=FALSE}\nlibrary(sl3)\nlibrary(kableExtra)\n\nall_properties \u003c- sl3_list_properties()\n\nget_all_learners \u003c- function() {\n  # search for objects named like sl3 learners\n  learner_names \u003c- apropos(\"^Lrnr_\")\n  learners \u003c- mget(learner_names, inherits = TRUE)\n\n  # verify that learner inherits from Lrnr_base (and is therefore an actual\n  # sl3 Learner)\n  is_learner_real \u003c- sapply(learners, `[[`, \"inherit\") == \"Lrnr_base\"\n  return(learners[which(is_learner_real)])\n}\nall_learners \u003c- get_all_learners()\n\n# get a list where each element is a list of properties of a particular learner\nget_learner_class_properties \u003c- function(learner_class) {\n  return(learner_class$private_fields$.properties)\n}\nlearner_property_lst \u003c- lapply(all_learners, get_learner_class_properties)\n\n# get a list where each element is a list of logicals indicating whether a\n# learner has a property or not\nget_learner_class_properties_ownership \u003c- function(properties) {\n  return(sl3_list_properties() %in% unlist(properties))\n}\nlearner_property_ownership \u003c- lapply(learner_property_lst,\n                                     get_learner_class_properties_ownership)\n\nget_learner_name \u003c- function(learner_class) {\n  return(learner_class$classname)\n}\nlearner_names \u003c- lapply(all_learners, get_learner_name)\n\n# generate matrix whose columns are properties and rows are learner names\nfinal_mat \u003c- matrix(unlist(learner_property_ownership),\n                    nrow = length(learner_property_ownership),\n                    ncol = length(sl3_list_properties()), byrow = TRUE)\ndimnames(final_mat) \u003c- list(unlist(learner_names), sl3_list_properties())\nfinal_mat.df \u003c- as.data.frame(final_mat)\n\nchar_final_mat.df \u003c- ifelse(final_mat.df == TRUE, \"√\", \"x\")\nkable(char_final_mat.df) %\u003e%\n  kable_styling(bootstrap_options = c(\"striped\", \"hover\", \"condensed\",\n                                      \"responsive\")) %\u003e%\n  scroll_box(width = \"100%\", height = \"200px\", fixed_thead = T)\n```\n\n---\n\n## Contributions\n\nContributions are very welcome. Interested contributors should consult our\n[contribution\nguidelines](https://github.com/tlverse/sl3/blob/master/CONTRIBUTING.md) prior to\nsubmitting a pull request.\n\n---\n\n## Citation\n\nAfter using the `sl3` R package, please cite the following:\n\n        @software{coyle2021sl3-rpkg,\n          author = {Coyle, Jeremy R and Hejazi, Nima S and Malenica, Ivana and\n            Phillips, Rachael V and Sofrygin, Oleg},\n          title = {{sl3}: Modern Pipelines for Machine Learning and {Super\n            Learning}},\n          year = {2021},\n          howpublished = {\\url{https://github.com/tlverse/sl3}},\n          note = {{R} package version 1.4.2},\n          url = {https://doi.org/10.5281/zenodo.1342293},\n          doi = {10.5281/zenodo.1342293}\n        }\n\n---\n\n## License\n\n\u0026copy; 2017-2021 [Jeremy R. Coyle](https://github.com/jeremyrcoyle), [Nima S.\nHejazi](https://nimahejazi.org), [Ivana\nMalenica](https://github.com/podTockom), [Rachael V.\nPhillips](https://github.com/rachaelvp), [Oleg\nSofrygin](https://github.com/osofr)\n\nThe contents of this repository are distributed under the GPL-3 license. See\nfile `LICENSE` for details.\n\n---\n\n## References\n\n","funding_links":[],"categories":["R"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftlverse%2Fsl3","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftlverse%2Fsl3","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftlverse%2Fsl3/lists"}