Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/curso-r/treesnip
Parsnip backends for `tree`, `lightGBM` and `Catboost`
https://github.com/curso-r/treesnip
Last synced: about 2 months ago
JSON representation
Parsnip backends for `tree`, `lightGBM` and `Catboost`
- Host: GitHub
- URL: https://github.com/curso-r/treesnip
- Owner: curso-r
- License: gpl-3.0
- Created: 2020-03-23T14:29:59.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2022-04-29T17:57:05.000Z (over 2 years ago)
- Last Synced: 2024-05-21T01:13:46.282Z (4 months ago)
- Language: R
- Homepage: https://curso-r.github.io/treesnip
- Size: 21.9 MB
- Stars: 85
- Watchers: 7
- Forks: 14
- Open Issues: 27
-
Metadata Files:
- Readme: README.Rmd
- License: LICENSE.md
Awesome Lists containing this project
README
---
output: github_document
---```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
library(magrittr)
library(magrittr)
library(knitr)
library(kableExtra)
```[![R build status](https://github.com/curso-r/treesnip/workflows/R-CMD-check/badge.svg)](https://github.com/curso-r/treesnip)
[![Codecov test coverage](https://codecov.io/gh/curso-r/treesnip/branch/master/graph/badge.svg)](https://app.codecov.io/gh/curso-r/treesnip?branch=master)
[![R-CMD-check](https://github.com/curso-r/treesnip/workflows/R-CMD-check/badge.svg)](https://github.com/curso-r/treesnip/actions)
[![R-CMD-check](https://github.com/curso-r/treesnip/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/curso-r/treesnip/actions/workflows/R-CMD-check.yaml)This package provides the following bindings for parsnip package:
- the `tree` engine for `decision_tree`;
- the `catboost` engine for `boost_tree` - only available in `catboost` branch. See [catboost](#catboost);
- the `lightGBM` engine for `boost_tree`.**Note that the development of this package has shifted to the [bonsai package](https://github.com/tidymodels/bonsai). We suggest filing issues and/or pull requests there.**
## docs
- [tree package docs](https://cran.r-project.org/web/packages/tree/tree.pdf)
- [LightGBM docs](https://lightgbm.readthedocs.io/)
- [Catboost docs](https://catboost.ai/docs/)## Installation
Not on CRAN yet.
``` r
remotes::install_github("curso-r/treesnip")
```See [catboost](#catboost) to use with `catboost`.
## Minimal Example
``` r
# decision_tree
model <- parsnip::decision_tree()
parsnip::set_engine(model, "tree")# boost_tree
model <- parsnip::boost_tree(mtry = 1, trees = 50)parsnip::set_engine(model, "catboost")
parsnip::set_engine(model, "lightgbm")
```## Hyperparameters map
**decision_tree()**
```{r, echo=FALSE}
tibble::tribble(
~ parsnip, ~tree,
"min_n", "minsize",
"cost_complexity", "mindev"
) %>% knitr::kable()
```**boost_tree()**
```{r, echo=FALSE, warning=FALSE, message=FALSE}
tibble::tribble(
~ parsnip, ~catboost, ~lightGBM,
'mtry', 'rsm', 'feature_fraction',
'trees', 'iterations', 'num_iterations',
'min_n', 'min_data_in_leaf', 'min_data_in_leaf',
'tree_depth', 'depth', 'max_depth',
'learn_rate', 'learning_rate', 'learning_rate',
'loss_reduction', cell_spec('Not found', color = 'red', bold = TRUE), 'min_gain_to_split',
'sample_size', 'subsample', 'bagging_fraction'
) %>% kable(escape = FALSE)
```## Catboost
Originally `treesnip` had support for both `lightgbm` and `catboost`. Since `catboost` has no intent to make it to CRAN we removed the parsnip implementation from the main package. You can still use it from the `catboost` branch that we will keep up to date with the main branch.
The `catboost` branch can be installed with:
```
remotes::install_github("curso-r/treesnip@catboost")
```