Science Score: 26.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
○DOI references
-
○Academic publication links
-
○Committers with academic emails
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (12.0%) to scientific vocabulary
Keywords from Contributors
Repository
caret models all the way down :turtle:
Basic Info
- Host: GitHub
- Owner: zachmayer
- License: other
- Language: R
- Default Branch: main
- Homepage: http://zachmayer.github.io/caretEnsemble/
- Size: 22.8 MB
Statistics
- Stars: 227
- Watchers: 24
- Forks: 75
- Open Issues: 7
- Releases: 7
Metadata Files
README.md
caretEnsemble
caretEnsemble is a framework for stacking models fit with the caret package.
Use caretList to fit multiple models, and then use caretStack to
stack them with another caret model.
First, use caretList to fit many models to the same data:
``` r set.seed(42L) data(diamonds, package = "ggplot2") dat <- data.table::data.table(diamonds) dat <- dat[sample.int(nrow(diamonds), 500L), ] models <- caretEnsemble::caretList( price ~ ., data = dat, methodList = c("rf", "glmnet") ) print(summary(models))
> The following models were ensembled: rf, glmnet
>
> Model accuracy:
> model_name metric value sd
>
> 1: rf RMSE 1076.492 215.4737
> 2: glmnet RMSE 1142.082 105.6022
```
Then, use caretEnsemble to make a greedy ensemble of these models
``` r greedystack <- caretEnsemble::caretEnsemble(models) print(greedystack)
> The following models were ensembled: rf, glmnet
>
> caret::train model:
> Greedy Mean Squared Error Optimizer
>
> No pre-processing
> Resampling: Cross-Validated (5 fold)
> Summary of sample sizes: 400, 400, 400, 400, 400
> Resampling results:
>
> RMSE Rsquared MAE
> 969.2517 0.9406218 557.1987
>
> Tuning parameter 'max_iter' was held constant at a value of 100
>
> Final model:
> Greedy MSE
> RMSE: 989.2085
> Weights:
> [,1]
> rf 0.55
> glmnet 0.45
```
You can also use caretStack to make a non-linear ensemble
``` r rf_stack <- caretEnsemble::caretStack(models, method = "rf")
> note: only 1 unique complexity parameters in default grid. Truncating the grid to 1 .
print(rf_stack)
> The following models were ensembled: rf, glmnet
>
> caret::train model:
> Random Forest
>
> No pre-processing
> Resampling: Cross-Validated (5 fold)
> Summary of sample sizes: 400, 400, 400, 400, 400
> Resampling results:
>
> RMSE Rsquared MAE
> 1081.425 0.930012 540.3294
>
> Tuning parameter 'mtry' was held constant at a value of 2
>
> Final model:
>
> Call:
> randomForest(x = x, y = y, mtry = param$mtry)
> Type of random forest: regression
> Number of trees: 500
> No. of variables tried at each split: 2
>
> Mean of squared residuals: 925377
> % Var explained: 93.95
```
Use autoplot from ggplot2 to plot ensemble diagnostics:
r
ggplot2::autoplot(greedy_stack, training_data = dat, xvars = c("carat", "table"))

r
ggplot2::autoplot(rf_stack, training_data = dat, xvars = c("carat", "table"))

Installation
Install the stable version from CRAN:
r
install.packages("caretEnsemble")
Install the dev version from github:
r
devtools::install_github("zachmayer/caretEnsemble")
There are also tagged versions of caretEnsemble on github you can install via devtools. For example, to install the previous release of caretEnsemble use:
r
devtools::install_github("zachmayer/caretEnsemble@2.0.3")
This is useful if the latest release breaks some aspect of your workflow. caretEnsemble is pure R with no compilation, so this command will work in a variety of environments.
Package development
This package uses a Makefile. Use make help to see the supported
options.
Use make fix-style to fix simple linting errors.
For iterating while writing code, run make dev. This runs just
make clean fix-style document lint spell test, for a quicker local dev
loop. Please still run make all before making a PR.
Use make all before making a pull request, which will also run R CMD
CHECK and a code coverage check. This runs
make clean fix-style document install build-readme build-vignettes lint spell test check coverage preview-site.
First time dev setup:
run make install from the git repository to install the dev version of
caretEnsemble, along with the necessary package dependencies. #
Inspiration and similar packages: caretEnsemble was inspired by
medley, which in turn was inspired by
Caruana et. al.’s (2004) paper Ensemble Selection from Libraries of
Models.
If you want to do something similar in python, check out vecstack.
Code of Conduct:
Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms.
Owner
- Name: Zach Deane-Mayer
- Login: zachmayer
- Kind: user
- Location: Boston, MA
- Company: DataRobot
- Website: https://www.datacamp.com/courses/advanced-deep-learning-with-keras-in-python
- Repositories: 22
- Profile: https://github.com/zachmayer
https://www.datacamp.com/courses/advanced-deep-learning-with-keras-in-python https://www.datacamp.com/courses/machine-learning-toolbox
GitHub Events
Total
- Issues event: 9
- Watch event: 2
- Delete event: 25
- Issue comment event: 118
- Push event: 91
- Pull request review comment event: 57
- Pull request review event: 56
- Pull request event: 62
- Fork event: 2
- Create event: 29
Last Year
- Issues event: 9
- Watch event: 2
- Delete event: 25
- Issue comment event: 118
- Push event: 91
- Pull request review comment event: 57
- Pull request review event: 56
- Pull request event: 62
- Fork event: 2
- Create event: 29
Committers
Last synced: over 2 years ago
Top Committers
| Name | Commits | |
|---|---|---|
| Zach Mayer | z****r@g****m | 270 |
| Jared Knowles | j****s@g****m | 119 |
| Eric Czech | e****h@g****m | 7 |
| Zach Deane-Mayer | 5****r | 3 |
| Jason Cohen | J****C@g****m | 2 |
| terrytangyuan | t****n@g****m | 1 |
| rlesca01 | r****u@g****m | 1 |
| topazand | 4****d | 1 |
| Graeme | g****0@g****m | 1 |
| Matt | w****e | 1 |
| Shyam Saladi | s****i | 1 |
Committer Domains (Top 20 + Academic)
Issues and Pull Requests
Last synced: 11 months ago
All Time
- Total issues: 139
- Total pull requests: 110
- Average time to close issues: almost 4 years
- Average time to close pull requests: about 1 month
- Total issue authors: 50
- Total pull request authors: 13
- Average comments per issue: 3.54
- Average comments per pull request: 2.95
- Merged pull requests: 89
- Bot issues: 0
- Bot pull requests: 7
Past Year
- Issues: 21
- Pull requests: 77
- Average time to close issues: 14 days
- Average time to close pull requests: about 13 hours
- Issue authors: 3
- Pull request authors: 5
- Average comments per issue: 2.71
- Average comments per pull request: 1.58
- Merged pull requests: 66
- Bot issues: 0
- Bot pull requests: 7
Top Authors
Issue Authors
- zachmayer (69)
- sparcycram (9)
- jknowles (5)
- farbodr (3)
- lsemployeeoftheyear (2)
- Mosquito00 (2)
- brent-halen (2)
- hadley (2)
- topepo (2)
- iamdeit (2)
- univ12 (2)
- JasonCEC (2)
- drag05 (1)
- achekroud (1)
- pglez82 (1)
Pull Request Authors
- zachmayer (145)
- antongomez (9)
- dependabot[bot] (7)
- eric-czech (4)
- github-actions[bot] (3)
- washcycle (3)
- devloai[bot] (2)
- smsaladi (1)
- the-tourist- (1)
- terrytangyuan (1)
- Malhadas (1)
- JasonCEC (1)
- topazand (1)
Top Labels
Issue Labels
Pull Request Labels
Packages
- Total packages: 2
-
Total downloads:
- cran 1,715 last-month
- Total docker downloads: 2,071
-
Total dependent packages: 2
(may contain duplicates) -
Total dependent repositories: 6
(may contain duplicates) - Total versions: 8
- Total maintainers: 1
cran.r-project.org: caretEnsemble
Ensembles of Caret Models
- Homepage: http://zachmayer.github.io/caretEnsemble/
- Documentation: http://cran.r-project.org/web/packages/caretEnsemble/caretEnsemble.pdf
- License: MIT + file LICENSE
-
Latest release: 4.0.1
published almost 2 years ago
Rankings
Maintainers (1)
conda-forge.org: r-caretensemble
- Homepage: https://github.com/zachmayer/caretEnsemble
- License: MIT
-
Latest release: 2.0.1
published over 4 years ago
Rankings
Dependencies
- R >= 3.2.0 depends
- caret * imports
- data.table * imports
- digest * imports
- ggplot2 * imports
- gridExtra * imports
- lattice * imports
- methods * imports
- pbapply * imports
- plyr * imports
- MASS * suggests
- caTools * suggests
- e1071 * suggests
- gbm * suggests
- glmnet * suggests
- ipred * suggests
- kernlab * suggests
- klaR * suggests
- knitr * suggests
- lintr * suggests
- mlbench * suggests
- nnet * suggests
- pROC * suggests
- randomForest * suggests
- rmarkdown * suggests
- rpart * suggests
- testthat * suggests