Skip to contents

Prepare a SHAP table with named numeric columns Ensure that the input SHAP table is a data.table with named numeric columns. If the input is coercible to a data.table but has no column names, assign default names like "feature_1", "feature_2", etc. Validate that all columns are numeric and optionally check for missing values.

Usage

.prepare_named_shap_dt(shap, allow_missing = FALSE)

Arguments

shap

A SHAP table to prepare.

allow_missing

Logical scalar. If TRUE, allow missing values in SHAP columns. If FALSE, trigger an error if any SHAP column contains missing values.

Value

A data.table with named numeric columns representing SHAP features.

Details

This function is used internally to standardize SHAP tables before decomposition. It ensures that the SHAP data is in a consistent format with appropriate column names and types.