mrFlashlight: Wrapper to run multi-response model agnostic interpretable machine learning analyses.
Source:R/MrFlashLight.R
mrFlashlight.Rd
mrFlashlight: Wrapper to run multi-response model agnostic interpretable machine learning analyses.
Usage
mrFlashlight(
yhats,
X,
X1,
Y,
response = "multi",
index = 1,
mode = "regression",
predict_function = NULL
)
Arguments
- yhats
A
list
generated bymrIMLpredicts
.- X
A
data.frame
containing the feature data set.- X1
A
data.frame
of additional predictors (optional).- Y
A
data.frame
containing the response variable data set (species, OTUs, SNPs, etc.).- response
character
indicating the type of response: 'single' selects one response, 'multi' selects all responses.- index
numeric
used whenresponse
is 'single' to select which response to create a flashlight object for. The order is the same as inY
.- mode
character
indicating the type of model: 'classification' or 'regression'.- predict_function
function
specifying a user-defined prediction function (optional).
Details
This function enables users to utilize interpretable machine learning methods to understand their multi-response and single-response models.
Examples
# Single response
fl <- mrFlashlight(yhats, X, Y, response = "single", index = 1, mode = "regression")
#> Error in flashlight(model = yhats[[index]]$mod1_k, label = colnames(Y)[index], data = cbind(Y[index], X), y = colnames(Y)[index], predict_function = pred_fun, metrics = metrics): could not find function "flashlight"
plot(light_performance(fl), fill = "orange") + labs(x = element_blank())
#> Error in light_performance(fl): could not find function "light_performance"
plot(light_breakdown(fl, new_obs = cbind(X, Y)[1, ]), by = X, v = Y)
#> Error in light_breakdown(fl, new_obs = cbind(X, Y)[1, ]): could not find function "light_breakdown"
int <- light_interaction(fl, pairwise = TRUE)
#> Error in light_interaction(fl, pairwise = TRUE): could not find function "light_interaction"
# Multiple response
flashlightObj <- mrFlashlight(yhats, X, Y, response = "multi", mode = "regression")
#> Error in eval(expr, envir, enclos): object 'yhats' not found