knitr::opts_chunk$set( collapse = TRUE, comment = "#>", fig.path = "man/figures/" ) library(compboost) ggplot2::theme_set(ggthemes::theme_tufte()) ggplot = function(...) ggplot2::ggplot(...) + scale_color_brewer(palette = "Set1") set.seed(31415)
Documentation | Contributors | Release Notes
Component-wise boosting applies the boosting framework to statistical models, e.g., general additive models using component-wise smoothing splines. Boosting these kinds of models maintains interpretability and enables unbiased model selection in high dimensional feature spaces.
The R
package compboost
is an alternative implementation of component-wise
boosting written in C++
to obtain high runtime
performance and full memory control. The main idea is to provide a modular
class system which can be extended without editing the
source code. Therefore, it is possible to use R
functions as well as
C++
functions for custom base-learners, losses, logging mechanisms or
stopping criteria.
For an introduction and overview about the functionality visit the project page.
<!--
install.packages("compboost")
-->
devtools::install_github("schalkdaniel/compboost")
The examples are rendered using compboost
.r packageVersion("compboost")
The fastest way to train a Compboost
model is to use the wrapper functions boostLinear()
or boostSplines()
:
cboost = boostSplines(data = iris, target = "Sepal.Length", oob_fraction = 0.3, iterations = 500L, trace = 100L) ggrisk = plotRisk(cboost) ggpe = plotPEUni(cboost, "Petal.Length") ggicont = plotIndividualContribution(cboost, iris[70, ], offset = FALSE) library(patchwork) ggrisk + ggpe + ggicont
For more extensive examples and how to use the R6
interface visit the project page.
Compboost also ships an mlr3
learners for regression and binary classification which can be used to apply compboost
within the whole mlr3verse
:
library(mlr3) ts = tsk("spam") lcboost = lrn("classif.compboost", iterations = 500L, bin_root = 2) lcboost$train(ts) lcboost$predict_type = "prob" lcboost$predict(ts) # Access the `$model` field to access all the `compboost` functionality: plotBaselearnerTraces(lcboost$model) + plotPEUni(lcboost$model, "charDollar")
Because of the usage of C++
objects as backend, it is not possible to use R
s save()
method to save models. Instead, use $saveToJson("mymodel.json")
to save the model to mymodel.json
and Compboost$new(file = "mymodel.json")
to load the model:
cboost = boostSplines(iris, "Sepal.Width") cboost$saveToJson("mymodel.json") cboost_new = Compboost$new(file = "mymodel.json") # Save the model without data: cboost$saveToJson("mymodel_without_data.json", rm_data = TRUE)
file.remove("mymodel.json", "mymodel_without_data.json")
compboost
with mboost
. For this purpose, the runtime behavior and memory consumption of the two packages were compared. The results of the benchmark can be read here.To cite compboost
in publications, please use:
Schalk et al., (2018). compboost: Modular Framework for Component-Wise Boosting. Journal of Open Source Software, 3(30), 967, https://doi.org/10.21105/joss.00967
@article{schalk2018compboost, author = {Daniel Schalk, Janek Thomas, Bernd Bischl}, title = {compboost: Modular Framework for Component-Wise Boosting}, URL = {https://doi.org/10.21105/joss.00967}, year = {2018}, publisher = {Journal of Open Source Software}, volume = {3}, number = {30}, pages = {967}, journal = {JOSS} }
In order to test the package functionality you can use devtools to test the package on your local machine:
devtools::test()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.