https://github.com/paithiov909/baritsu
Wrappers for the 'mlpack' R package; at times and in some situations, baritsu may be more powerful than a swiss army knife
https://github.com/paithiov909/baritsu
r r-package tidymodels
Last synced: 6 months ago
JSON representation
Wrappers for the 'mlpack' R package; at times and in some situations, baritsu may be more powerful than a swiss army knife
- Host: GitHub
- URL: https://github.com/paithiov909/baritsu
- Owner: paithiov909
- License: other
- Created: 2023-12-13T07:16:53.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2025-02-23T05:44:26.000Z (7 months ago)
- Last Synced: 2025-02-23T06:25:58.192Z (7 months ago)
- Topics: r, r-package, tidymodels
- Language: R
- Homepage: https://paithiov909.github.io/baritsu/
- Size: 5.25 MB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.Rmd
- License: LICENSE
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%"
)
pkgload::load_all()
```# baritsu
[](https://paithiov909.r-universe.dev/baritsu)
[](https://github.com/paithiov909/baritsu/actions/workflows/R-CMD-check.yaml)
[](https://app.codecov.io/gh/paithiov909/baritsu)
[](https://lifecycle.r-lib.org/articles/stages.html#experimental)The main goal of baritsu is to implement wrappers for [mlpack](https://www.mlpack.org/doc/stable/r_documentation.html) that allows formula as their argument.
Also, baritsu provides [parsnip](https://parsnip.tidymodels.org/) engines of those wrappers, so they can be used with [tidymodels](https://www.tidymodels.org/) workflows.## Installation
You can install the development version of baritsu from [GitHub](https://github.com/) with:
``` r
remotes::install_github("paithiov909/baritsu")
```## Example
This is a basic example which shows you how to solve a common problem:
```{r example}
suppressPackageStartupMessages({
require(tidymodels)
require(baritsu)
})data("penguins", package = "modeldata")
set.seed(1218)
data_split <- initial_split(penguins, strata = species)
penguins_train <- training(data_split)
penguins_test <- testing(data_split)rec <-
recipe(
species ~ .,
data = penguins_train
) |>
step_impute_median(all_numeric_predictors()) |>
step_impute_mode(all_nominal_predictors())spec <-
decision_tree(
tree_depth = 0,
min_n = 5
) |>
set_engine("baritsu") |>
set_mode("classification")translate(spec)
wf_fit <- workflow() |>
add_recipe(rec) |>
add_model(spec) |>
fit(penguins_train)pred <- augment(wf_fit, penguins_test) |>
dplyr::select(species, .pred_class)pred
f_meas(pred, truth = species, estimate = .pred_class)
```