Learn R Programming

hhcartr (version 1.0.0)

best_split_: best_split_ finds the best feature column to split on.

Description

This internal function is used to find the feature column that will offer the best split based on using the Gini index or gini hyperplane index.

Usage

best_split_(
  X,
  y,
  most_freq_class,
  split_original,
  n_classes,
  max_features,
  depth
)

Arguments

X

feature variables to search for the best split.

y

target variable.

most_freq_class

the most frequent class in the target variable.

split_original

boolean to indicate whether to split on original data or reflected data.

n_classes

number of classes in the y column

max_features

the maximum number of features to use when splitting a node

depth

the depth of the current tree.

Value

a list of the following variables (best_idx, best_thr, best_gini)