Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/njtierney/broomstick

:evergreen_tree: broom helpers for decision tree methods (rpart, randomForest, and more!) :evergreen_tree:
https://github.com/njtierney/broomstick

broom decision-trees gbm machine-learning randomforest rpart rstats statistical-learning

Last synced: about 2 months ago
JSON representation

:evergreen_tree: broom helpers for decision tree methods (rpart, randomForest, and more!) :evergreen_tree:

Awesome Lists containing this project

README

        

---
output: github_document
---

```{r, echo = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "README-"
)
```

# broomstick

[![R build status](https://github.com/njtierney/broomstick/workflows/R-CMD-check/badge.svg)](https://github.com/njtierney/broomstick/actions)
[![Codecov test coverage](https://codecov.io/gh/njtierney/broomstick/branch/master/graph/badge.svg)](https://codecov.io/gh/njtierney/broomstick?branch=master)
[![R-CMD-check](https://github.com/njtierney/broomstick/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/njtierney/broomstick/actions/workflows/R-CMD-check.yaml)

Convert decision tree objects into tidy data frames with `broomstick`.

The goal of broomstick is to extend the [`broom`](https://github.com/tidyverse/broom) package to work with decision trees. It is currently borrowing heavily from the prototype package [`treezy`](https://github.com/njtierney/treezy).

## Installation

You can install broomstick from github with:

```{r gh-installation, eval = FALSE}
# install.packages("remotes")
remotes::install_github("njtierney/broomstick")
```

## Examples

## rpart

```{r example-rpart}
library(rpart)
library(broomstick)

fit_rpart <- rpart(Kyphosis ~ Age + Number + Start,
data = kyphosis)

tidy(fit_rpart)
augment(fit_rpart)
```

## gbm (Boosted Regression Tree)

```{r example-gbm}
library(gbm)
library(MASS)
fit_gbm <- gbm(calories ~., data = UScereal)

tidy(fit_gbm)
```

## random forest

```{r example-rf}
library(randomForest)
ozone_rf <- randomForest(Ozone ~ .,
data = airquality,
importance = TRUE,
na.action = na.omit)
tidy(ozone_rf)
glance(ozone_rf)
augment(ozone_rf)
```