Generate dataset for local exploration.

sample_locally(data, explained_instance, explained_var, size,
  method = "live", fixed_variables = NULL, seed = NULL, ...)

Arguments

data

Data frame from which new dataset will be simulated.

explained_instance

One row data frame with the same variables as in data argument. Local exploration will be performed around this observation.

explained_var

Name of a column with the variable to be predicted.

size

Number of observations is a simulated dataset.

method

If "live", new observations will be created by changing one value per observation. If "permute", new observation will be created by permuting all columns of data. If "normal", numerical features will be sampled from multivariate normal distribution specified by ... arguments mu and Sigma.

fixed_variables

names or numeric indexes of columns which will not be changed while sampling.

seed

Seed to set before sampling. If NULL, results will not be reproducible.

...

Mean and covariance matrix for normal sampling method.

Value

list of class "live_explorer" consisting of

data

Dataset generated by sample_locally function with response variable.

target

Name of the response variable.

explained_instance

Instance that is being explained.

sampling_method

Name of used sampling method

fixed_variables

Names of variables which were not sampled

sdevations

Standard deviations of numerical variables

Examples

# NOT RUN {
dataset_for_local_exploration <- sample_locally(data = wine,
                                                explained_instance = wine[5, ],
                                                explained_var = "quality",
                                                size = 50)
# }