Skip to contents

Validate a SHAP table Ensure that the input SHAP table is a data.table with at least one row and one numeric column. Optionally check for missing values and trigger an error any are found.

Usage

.validate_shap_table(shap_dt, allow_missing = FALSE)

Arguments

shap_dt

A data.table representing SHAP values to validate.

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

The input shap_dt if it passes validation checks.

Details

This function is used internally to ensure that SHAP tables are in a consistent format with appropriate types before decomposition. It checks that the input is a data.table (or coercible to one), contains at least one row and one column, that all columns are numeric, and optionally that there are no missing values.