Learn R Programming

shapr (version 0.2.2)

prepare_data: Generate data used for predictions

Description

Generate data used for predictions

Usage

prepare_data(x, ...)

# S3 method for empirical prepare_data(x, seed = 1, n_samples = 1000, index_features = NULL, ...)

# S3 method for gaussian prepare_data(x, seed = 1, n_samples = 1000, index_features = NULL, ...)

# S3 method for copula prepare_data( x, x_test_gaussian = 1, seed = 1, n_samples = 1000, index_features = NULL, ... )

# S3 method for ctree prepare_data( x, seed = 1, n_samples = 1000, index_features = NULL, mc_cores = 1, mc_cores_create_ctree = mc_cores, mc_cores_sample_ctree = mc_cores, ... )

Arguments

x

Explainer object. See explain for more information.

...

Currently not used.

seed

Positive integer. If NULL the seed will be inherited from the calling environment.

n_samples

Integer. The number of obs to sample from the leaf if sample = TRUE or if sample = FALSE but n_samples is less than the number of obs in the leaf.

index_features

List. Default is NULL but if either various methods are being used or various mincriterion are used for different numbers of conditioned features, this will be a list with the features to pass.

x_test_gaussian

Matrix. Test data quantile-transformed to standard Gaussian variables. Only applicable if approach = "empirical".

mc_cores

Integer. Only for class ctree currently. The number of cores to use in paralellization of the tree building (create_ctree) and tree sampling (sample_ctree). Defaults to 1. Note: Uses parallel::mclapply which relies on forking, i.e. uses only 1 core on Windows systems.

mc_cores_create_ctree

Integer. Same as mc_cores, but specific for the tree building function #' Defaults to mc_cores.

mc_cores_sample_ctree

Integer. Same as mc_cores, but specific for the tree building prediction function. Defaults to mc_cores.