-
Notifications
You must be signed in to change notification settings - Fork 13
/
README.Rmd
104 lines (76 loc) · 3.12 KB
/
README.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{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)
```
# treesnip <a href='https://curso-r.github.io/treesnip'><img src='man/figures/logo.png' align="right" height="139" /></a>
<!-- badges: start -->
[![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)
<!-- badges: end -->
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")
```