get_tree_breaks {creditmodel}R Documentation

Getting the breaks for terminal nodes from decision tree

Description

get_tree_breaks is for generating initial braks by decision tree for a numerical or nominal variable. The get_breaks function is a simpler wrapper for get_tree_breaks.

Usage

get_tree_breaks(
  dat,
  x,
  target,
  pos_flag = NULL,
  tree_control = list(p = 0.02, cp = 0.000001, xval = 5, maxdepth = 10),
  sp_values = NULL
)

Arguments

dat

A data frame with x and target.

x

name of variable to cut breaks by tree.

target

The name of target variable.

pos_flag

The value of positive class of target variable, default: "1".

tree_control

the list of parameters to control cutting initial breaks by decision tree.

  • p the minimum percent of observations in any terminal <leaf> node. 0 < p< 1; 0.01 to 0.1 usually work.

  • cp complexity parameter. the larger, the more conservative the algorithm will be. 0 < cp< 1 ; 0.0001 to 0.0000001 usually work.

  • xval number of cross-validations.Default: 5

  • max_depth maximum depth of a tree. Default: 10

sp_values

A list of special value. Default: NULL.

See Also

get_breaks, get_breaks_all

Examples

#tree breaks
tree_control = list(p = 0.02, cp = 0.000001, xval = 5, maxdepth = 10)
tree_breaks = get_tree_breaks(dat = UCICreditCard, x = "MARRIAGE",
target = "default.payment.next.month", tree_control = tree_control)

[Package creditmodel version 1.3.0 Index]