get_data_specs: Fetches feature information from a given data set

View source: R/setup.R

get_data_specsR Documentation

Fetches feature information from a given data set

Description

Fetches feature information from a given data set

Usage

get_data_specs(x)

Arguments

x

matrix, data.frame or data.table The data to extract feature information from.

Details

This function is used to extract the feature information to be checked against the corresponding information extracted from the model and other data sets. The function is called from internally

Value

A list with the following elements:

labels

character vector with the feature names to compute Shapley values for

classes

a named character vector with the labels as names and the class types as elements

factor_levels

a named list with the labels as names and character vectors with the factor levels as elements (NULL if the feature is not a factor)

Author(s)

Martin Jullum

Examples

# Load example data
data("airquality")
airquality <- airquality[complete.cases(airquality), ]
# Split data into test- and training data
x_train <- head(airquality, -3)
x_explain <- tail(airquality, 3)
# Split data into test- and training data
x_train <- data.table::as.data.table(head(airquality))
x_train[, Temp := as.factor(Temp)]
get_data_specs(x_train)

NorskRegnesentral/shapr documentation built on April 19, 2024, 1:19 p.m.