Learn R Programming

MLwrap (version 0.3.0)

table_pairwise_interaction: Friedman's H-Statistic Pairwise Interaction Table

Description

The table_pairwise_interaction() function computes pairwise interaction strengths between predictors using Friedman's H-statistic, following the formulation described in Interpretable Machine Learning by Christoph Molnar. While the global H-statistic summarizes the overall interaction strength of each individual feature, this function focuses specifically on pairwise feature interactions, quantifying how strongly two variables interact in influencing the model's predictions. If normalize = TRUE, interaction scores are returned on a 0–1 scale for ease of comparison; if FALSE, raw interaction magnitudes are returned.

Usage

table_pairwise_interaction(
  analysis_object,
  show_table = FALSE,
  normalize = TRUE
)

Value

A tibble containing pairwise interaction strengths between all feature pairs, in either normalized or raw form depending on the normalize argument.

Arguments

analysis_object

A fitted wrap_object with results from sensitivity_analysis(methods = "Friedman H-stat") with pairwise interactions computed internally.

show_table

Logical. If TRUE, prints the resulting interaction table to the console (default = FALSE).

normalize

Logical. If TRUE (default), returns normalized pairwise interaction strengths; if FALSE, returns raw interaction values.

References

Molnar, C. (2022). Interpretable Machine Learning.
https://christophm.github.io/interpretable-ml-book/

See Also

sensitivity_analysis, table_h2_total

Examples

Run this code
# After running:
# wrap_object <- sensitivity_analysis(wrap_object, methods = "Friedman H-stat")
#
# Obtain normalized pairwise interactions:
# table_norm <- table_pairwise_interaction(wrap_object)
#
# Obtain raw interaction strengths:
# table_raw <- table_pairwise_interaction(wrap_object, normalize = FALSE)

Run the code above in your browser using DataLab