Skip to contents

This function investigates all two-way interactions in the forest by measuring how many times splits of one variable is nested in splits of another variable.

Usage

first_order_interaction_investigator(
  yarf_mod,
  plot = TRUE,
  only_non_self_interactions = FALSE,
  num_var_plot = 50
)

Arguments

yarf_mod

The YARF model in which to query

plot

This controls whether or not the function plots the interaction strengths. If so, it plots in order of strength from highest to lowest. Default is TRUE.

only_non_self_interactions

Should we only show interactions between different variables? Default is FALSE to show interactions of variables with themselves.

num_var_plot

How many first order interactions to plot? All would be p-choose-2 which can be large. The default is 50. Use Inf to plot all p-choose-2.

Value

A list with two components: (1) interaction_counts is a p x p sized matrix of interaction counts between the variables and (2) sorted_counts is a vector of the top interactions in order. Returns invisibly.

Author

Adam Kapelner