axe-C5.0 {butcher}R Documentation

Axing a C5.0.

Description

C5.0 objects are created from the C50 package, which provides an interface to the C5.0 classification model. The models that can be generated include basic tree-based models as well as rule-based models.

Usage

## S3 method for class 'C5.0'
axe_call(x, verbose = FALSE, ...)

## S3 method for class 'C5.0'
axe_ctrl(x, verbose = FALSE, ...)

## S3 method for class 'C5.0'
axe_fitted(x, verbose = FALSE, ...)

Arguments

x

A model object.

verbose

Print information each time an axe method is executed. Notes how much memory is released and what functions are disabled. Default is FALSE.

...

Any additional arguments related to axing.

Value

Axed C5.0 object.

Examples


# Load libraries
library(parsnip)
library(rsample)
library(rpart)

# Load data
set.seed(1234)
split <- initial_split(kyphosis, prop = 9/10)
spine_train <- training(split)

# Create model and fit
c5_fit <- decision_tree(mode = "classification") %>%
  set_engine("C5.0") %>%
  fit(Kyphosis ~ ., data = spine_train)

out <- butcher(c5_fit, verbose = TRUE)

# Try another model from parsnip
c5_fit2 <- boost_tree(mode = "classification", trees = 100) %>%
  set_engine("C5.0") %>%
  fit(Kyphosis ~ ., data = spine_train)
out <- butcher(c5_fit2, verbose = TRUE)

# Create model object from original library
library(C50)
library(modeldata)
data(mlc_churn)
c5_fit3 <- C5.0(x = mlc_churn[, -20], y = mlc_churn$churn)
out <- butcher(c5_fit3, verbose = TRUE)


[Package butcher version 0.3.3 Index]