class_tree_interaction_finder: class_tree_interaction_finder

View source: R/class_tree_interaction_finder.R

class_tree_interaction_finderR Documentation

class_tree_interaction_finder

Description

This code creates interaction features via decision trees when the target is a binary column (0/1).

Usage

class_tree_interaction_finder(
  df,
  target,
  n_trees = 100,
  feature_fraction = 1,
  lower_pt = 0.1,
  upper_pt = 0.1,
  lower_dev = 0.1,
  suffix_output = "tree"
)

Arguments

df,

the main frame of data where the target and explanatory variables reside

target,

the name of the binary target column

n_trees,

number of trees to test. Default: 100

feature_fraction,

double, between 0 and 1. Will randomly select a subset of features on each tree if feature_fraction is smaller than 1.Default = 1.

lower_pt,

double, between 0 and 1. what is the max target penetration required to keep a node as a low penetration node. Default = 0.1

upper_pt

, double greater than 0, what is the min target penetration index required to keep a node as a high penetration node? Default = 0.1

lower_dev,

double greater than 0, the lower threshold for the deviance of the nodes accepted. Default = 0.1

suffix_output,

string, suffix to the output columns

Details

Note: ALL features need to be numericals

The penetration index used in the formula is the result of the deviance of a node divided by the sum of case weights for each observation reaching the node.

The results of this function is a data frame containing each node, their target penetration, and a R formula to recreate the node from the features.

Value

A (possibly empty) data.frame with the list of leaves interactions


bronnimannj/jbutilities documentation built on July 2, 2023, 4:09 p.m.