get_data_specs: Fetches feature information from a given data set

Description Usage Arguments Details Value Author(s) Examples

View source: R/preprocess_data.R

Description

Fetches feature information from a given data set

Usage

1

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 preprocess_data and make_dummies

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

1
2
3
4
5
6
7
8
# Load example data
if (requireNamespace("MASS", quietly = TRUE)) {
  data("Boston", package = "MASS")
  # Split data into test- and training data
  x_train <- data.table::as.data.table(head(Boston))
  x_train[, rad := as.factor(rad)]
  get_data_specs(x_train)
}

shapr documentation built on Jan. 28, 2021, 5:06 p.m.