FeatureEffects computes and plots feature effects of multiple features at once.
Details
FeatureEffects computes the effects for all given features on the model prediction. FeatureEffects is a convenience class that calls FeatureEffect multiple times. See ?FeatureEffect for details what's actually computed.
Only first-order effects can be computed with the FeatureEffects interface. If you are interested in the visualization of interactions between two features, directly use FeatureEffect .
Parallelization
Parallelization is supported via package list("future"). To initialize future-based parallelization, select an appropriate backend and specify the amount of workers. For example, to use a PSOCK based cluster backend do:
future::plan(multisession, workers = 2)
<iml function here>
Consult the resources of the list("future") package for more parallel backend options.
Examples
# We train a random forest on the Boston dataset:library("rpart")data("Boston", package ="MASS")rf <- rpart(medv ~ ., data = Boston)mod <- Predictor$new(rf, data = Boston)# Compute the accumulated local effects for all featureseff <- FeatureEffects$new(mod)eff$plot()## Not run:# Again, but this time with a partial dependence ploteff <- FeatureEffects$new(mod, method ="pdp")eff$plot()# Only a subset of featureseff <- FeatureEffects$new(mod, features = c("nox","crim"))eff$plot()# You can access each FeatureEffect individuallyeff.nox <- eff$effects[["nox"]]eff.nox$plot()# FeatureEffects also works with multiclass classificationrf <- rpart(Species ~ ., data = iris)mod <- Predictor$new(rf, data = iris, type ="prob")FeatureEffects$new(mod)$plot(ncol =2)## End(Not run)
References
Apley, D. W. 2016. "Visualizing the Effects of Predictor Variables in Black Box Supervised Learning Models." ArXiv Preprint.
Friedman, J.H. 2001. "Greedy Function Approximation: A Gradient Boosting Machine." Annals of Statistics 29: 1189-1232.
Goldstein, A., Kapelner, A., Bleich, J., and Pitkin, E. (2013). Peeking Inside the Black Box: Visualizing Statistical Learning with Plots of Individual Conditional Expectation, 1-22. https://doi.org/10.1080/10618600.2014.907095
See Also
plot.FeatureEffects
Super class
iml::InterpretationMethod -> FeatureEffects
Public fields
grid.size: (numeric(1) | numeric(2))
The size of the grid.
method: (character(1))
* "ale" for accumulated local effects,
* "pdp" for partial dependence plot,
* "ice" for individual conditional expectation curves,
* "pdp+ ice" for partial dependence plot and ice curves within the same plot.
effects: (list )
Named list of FeatureEffects.
features: (character())
The names of the features for which the effects were computed.
center.at: numeric
Value at which the plot was centered. Ignored in the case of two features.
The object (created with `Predictor$new()`) holding the machine learning model and the data.
features: (character())
The names of the features for which to compute the feature effects.
method: (character(1))
* 'ale' for accumulated local effects,
* 'pdp' for partial dependence plot,
* 'ice' for individual conditional expectation curves,
* 'pdp+ice' for partial dependence plot and ice curves within the same plot.
center.at: (numeric(1))
Value at which the plot should be centered. Ignored in the case of two features.
grid.size: (numeric(1) | numeric(2))
The size of the grid for evaluating the predictions.