variable_effect: Dataset Level Variable Effect as Partial Dependency Profile...

Description Usage Arguments Value References Examples

View source: R/model_variable_effect.R

Description

From DALEX version 1.0 this function calls the accumulated_dependence or partial_dependence from the ingredients package. Find information how to use this function here: https://pbiecek.github.io/ema/partialDependenceProfiles.html.

Usage

1
2
3
4
5
variable_effect(explainer, variables, ..., type = "partial_dependency")

variable_effect_partial_dependency(explainer, variables, ...)

variable_effect_accumulated_dependency(explainer, variables, ...)

Arguments

explainer

a model to be explained, preprocessed by the 'explain' function

variables

character - names of variables to be explained

...

other parameters

type

character - type of the response to be calculated. Currently following options are implemented: 'partial_dependency' for Partial Dependency and 'accumulated_dependency' for Accumulated Local Effects

Value

An object of the class 'aggregated_profiles_explainer'. It's a data frame with calculated average response.

References

Explanatory Model Analysis. Explore, Explain and Examine Predictive Models. https://pbiecek.github.io/ema/

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
titanic_glm_model <- glm(survived~., data = titanic_imputed, family = "binomial")
explainer_glm <- explain(titanic_glm_model, data = titanic_imputed)
expl_glm <- variable_effect(explainer_glm, "fare", "partial_dependency")
plot(expl_glm)

 ## Not run: 
library("ranger")
titanic_ranger_model <- ranger(survived~., data = titanic_imputed, num.trees = 50,
                               probability = TRUE)
explainer_ranger  <- explain(titanic_ranger_model, data = titanic_imputed)
expl_ranger  <- variable_effect(explainer_ranger, variables = "fare",
                            type = "partial_dependency")
plot(expl_ranger)
plot(expl_ranger, expl_glm)

# Example for factor variable (with factorMerger)
expl_ranger_factor  <- variable_effect(explainer_ranger, variables =  "class")
plot(expl_ranger_factor)
 
## End(Not run)

DALEX documentation built on July 8, 2020, 7:17 p.m.

Related to variable_effect in DALEX...