context("shapleyImportance with WrappedModel works")
test_that("shapleyImportance with WrappedModel works", {
feat = features
set.seed(1)
imp = shapleyImportance(mod, data = d, features = feat, n.feat.perm = n.feat.perm,
#n.shapley.perm = 10,
measures = measures, local = FALSE)
expect_output(print.ShapleyImportance(imp), "Shapley")
# check if using mod$learner.model yields the same importances
set.seed(1)
imp2 = shapleyImportance(mod$learner.model, data = d, target = target, features = feat, n.feat.perm = n.feat.perm, #n.shapley.perm = 10,
measures = measures.fun, local = FALSE, predict.fun = predict.fun)
expect_identical(imp$shapley.value, imp2$shapley.value)
# FIXME: check if shapleyImportance local importance works
# imp = shapleyImportance(mod, data = d, features = feat, n.feat.perm = n.feat.perm, n.shapley.perm = 1, measures = measures, local = TRUE)
})
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.