forked from curso-r/treesnip
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathREADME.Rmd
108 lines (83 loc) · 2.65 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
104
105
106
107
108
---
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)
<!-- badges: end -->
This package provides the following bindings for parsnip package:
- the `tree` engine for `decision_tree`;
- the `catboost` engine for `boost_tree`;
- the `lightGBM` engine for `boost_tree`.
**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")
```
## 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)
```
## Roadmap
```{r, echo=FALSE, warning=FALSE, message=FALSE}
ok <- function(x = "") {
if(x == "x") ":heavy_check_mark:"
else if(x == "n") ":white_circle:"
else ":red_circle:"
}
tibble::tribble(
~fun, ~tree, ~catboost, ~lightGBM,
"set_fit", ok("x"), ok("x"), ok("x"),
"set_model_arg", ok("x"), ok("x"), ok("x"),
"set_pred", ok("x"), ok("x"), ok("x"),
"train", ok("x"), ok("x"), ok("x"),
"predict", ok("x"), ok("x"), ok("x"),
"multi_predict", ok("n"), ok("x"), ok("x"),
"tests", ok("x"), ok("x"), ok("x")
) %>% kable()
```