{"id":28395383,"url":"https://github.com/joshd898/caretmultimodal","last_synced_at":"2025-06-27T04:32:14.832Z","repository":{"id":281928724,"uuid":"915458805","full_name":"JoshD898/caretMultimodal","owner":"JoshD898","description":"Multimodal model training in R","archived":false,"fork":false,"pushed_at":"2025-05-14T18:15:24.000Z","size":2393,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-01T06:53:02.971Z","etag":null,"topics":["caret","ensemble-learning","multimodal-learning","r","testthat"],"latest_commit_sha":null,"homepage":"","language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/JoshD898.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","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":"2025-01-11T22:27:31.000Z","updated_at":"2025-05-14T18:15:27.000Z","dependencies_parsed_at":"2025-04-12T02:42:47.097Z","dependency_job_id":"b553de77-59a2-439a-9e3f-6675807c663c","html_url":"https://github.com/JoshD898/caretMultimodal","commit_stats":null,"previous_names":["joshd898/caretmultimodal"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/JoshD898/caretMultimodal","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JoshD898%2FcaretMultimodal","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JoshD898%2FcaretMultimodal/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JoshD898%2FcaretMultimodal/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JoshD898%2FcaretMultimodal/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/JoshD898","download_url":"https://codeload.github.com/JoshD898/caretMultimodal/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JoshD898%2FcaretMultimodal/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262188396,"owners_count":23272341,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["caret","ensemble-learning","multimodal-learning","r","testthat"],"created_at":"2025-05-31T19:39:59.783Z","updated_at":"2025-06-27T04:32:14.822Z","avatar_url":"https://github.com/JoshD898.png","language":"R","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003c!-- badges: start --\u003e\n\n[![Codecov test\ncoverage](https://codecov.io/gh/JoshD898/caretMultimodal/graph/badge.svg)](https://app.codecov.io/gh/JoshD898/caretMultimodal)\n[![R-CMD-check](https://github.com/JoshD898/caretMultimodal/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/JoshD898/caretMultimodal/actions/workflows/R-CMD-check.yaml)\n[![CodeFactor](https://www.codefactor.io/repository/github/joshd898/caretmultimodal/badge)](https://www.codefactor.io/repository/github/joshd898/caretmultimodal)\n![Code Size](https://img.shields.io/github/languages/code-size/joshD898/caretMultimodal)\n\n\u003c!-- badges: end --\u003e\n\n# caretMultimodal\n\nCaretMultimodal is a wrapper around the\n[caret](https://github.com/topepo/caret) package that allows for\nsimplified multi-dataset training and ensembling. It is heavily inspired\nby Zach Mayer's\n[caretEnsemble](https://github.com/zachmayer/caretEnsemble) package.\n\n## Example Usage\n\nFor the following examples, we will [these publicly available data\nsets](https://amritsingh.shinyapps.io/omicsBioAnalytics/) on heart\nfailure. The data sets are described\n[here](https://pubmed.ncbi.nlm.nih.gov/30935638/).\n\nLet's train models on rows 10 - 20 of the **cells, holter, and protein**\ndata sets to predict patient **hospitalization** using the **random\nforest (RF)** method.\n\n### Creating a `caret_list` object\n\n``` r\n# Load the heart failure data\nload(system.file(\"sample_data\", \"HeartFailure.RData\", package = \"caretMultimodal\")) \n\nmodels \u003c- caretMultimodal::caret_list(\n    target = demo$hospitalizations[10:20], \n    data_list = list(cells = cells[10:20,], holter = holter[10:20,], proteins = proteins[10:20,]), \n    method = \"rf\"\n)\n\nsummary(models)\n#\u003e The following models were trained: cells_model, holter_model, proteins_model \n#\u003e\n#\u003e Model metrics:\n#\u003e             model method metric value        sd\n#\u003e            \u003cchar\u003e \u003cchar\u003e \u003cchar\u003e \u003cnum\u003e     \u003cnum\u003e\n#\u003e 1:    cells_model     rf    ROC   0.5 0.5000000\n#\u003e 2:   holter_model     rf    ROC   0.8 0.4472136\n#\u003e 3: proteins_model     rf    ROC   1.0 0.0000000\n\nplot(models)\n```\n\n![image](https://github.com/user-attachments/assets/6c896c2a-a88f-4263-a0e7-d95e12138b87)\n\n### Using `caret_stack` to stack models\n\nThe `caret_stack` function trains a new `caret::train` object on the\npredictions from models in a `caret_list`. Let's use the **GLMNET**\nmethod to train an ensemble model with the remaining rows of the\n**cells, holter, and protein** data sets.\n\n``` r\nstack \u003c- caretMultimodal::caret_stack(\n    caret_list = models,\n    data_list = list(cells = cells[-(10:20),], holter = holter[-(10:20),], proteins = proteins[-(10:20),]),\n    target = demo$hospitalizations[-(10:20)], \n    method = \"glmnet\"\n)\n\nsummary(stack)\n#\u003e The following models were ensembled: cells_model, holter_model, proteins_model  \n#\u003e \n#\u003e Relative importance:\n#\u003e                 Overall\n#\u003e cells_model    36.65609\n#\u003e holter_model   15.42738\n#\u003e proteins_model 47.91653\n#\u003e \n#\u003e Model metrics (based on caret_stack training data):\n#\u003e             model method metric     value         sd\n#\u003e            \u003cchar\u003e \u003cchar\u003e \u003cchar\u003e     \u003cnum\u003e      \u003cnum\u003e\n#\u003e 1:       ensemble glmnet    ROC 0.7392857 0.16540766\n#\u003e 2:    cells_model     rf    ROC 0.5977564 0.11202056\n#\u003e 3:   holter_model     rf    ROC 0.6666667 0.08445071\n#\u003e 4: proteins_model     rf    ROC 0.6602564 0.09410487\n\npredict(\n    stack,\n    new_data_list = list(cells = cells, holter = holter, proteins = proteins)\n)\n#\u003e           Yes\n#\u003e         \u003cnum\u003e\n#\u003e 1: 0.25371960\n#\u003e 2: 0.07682839\n#\u003e 3: 0.30947239\n#\u003e 4: 0.26927079\n#\u003e          ...\n\nplot(stack)\n```\n\n![image](https://github.com/user-attachments/assets/5e51c9fc-9e83-4d2b-9ab5-1085fff78d88)\n\n## Installation\n\nThe package can be installed using devtools\n\n``` r\ndevtools::install_github(\"JoshD898/caretMultimodal\")\n```\n\n## Project Structure\n\nThis project generally follows the [Tidyverse style\nguide](https://style.tidyverse.org/).\n\n### Naming Conventions\n\n-   Internal (non-exported) functions are prefixed with `.` to hide them\n    from the package namespace.\n\n### File Organization\n\nEach object’s definition and its associated methods are contained within\na single file.\n\n-   **`caret_list.R`** – Defines the `caret_list` object and its\n    methods.\\\n-   **`caret_stack.R`** – Defines the `caret_stack` object and its\n    methods.\\\n-   **`helpers.R`** – Contains internal helper functions shared across\n    multiple objects.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjoshd898%2Fcaretmultimodal","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjoshd898%2Fcaretmultimodal","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjoshd898%2Fcaretmultimodal/lists"}