View source: R/get_factor_split_levels.R
get_factor_split_levels | R Documentation |
Get split criterion (levels) for factor or character variables Character variables are automatically turned into factors in function ranger() from the package "ranger" Considers the three possibilities to treat and split factors (Parameter "respect.unordered.factors" in ranger()): - Treat the factor like an ordinal variable ("none", "NULL" or "FALSE" in ranger()) - Treat the factor as nominal and check all 2-partitions for split ("partition") - Treat factor as ordinal and determine optimal order of levels for the random forest ("order", "TRUE" in ranger())
get_factor_split_levels(
node_id,
split_variable,
split_variable_type,
split_value,
train_data_df,
rf_list
)
node_id |
Node ID of the node whose parent ID is to be determined |
split_variable |
Column name of the split variable in training data |
split_variable_type |
Type of split variable: "factor" for factors, "character" for character variable |
split_value |
Number(s) used for the split, for example the entry "splival" from the function treeInfo() |
train_data_df |
Data frame of the training data with which the random forest was trained |
rf_list |
Random forest, which is built like the one you get from ranger() |
Character with levels passed from the parent node to the considered node
Lea Louisa Kronziel, M.Sc.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.