View source: R/generatePartialDependence.R
generatePartialDependenceData | R Documentation |
Estimate how the learned prediction function is affected by one or more features. For a learned function f(x) where x is partitioned into x_s and x_c, the partial dependence of f on x_s can be summarized by averaging over x_c and setting x_s to a range of values of interest, estimating E_(x_c)(f(x_s, x_c)). The conditional expectation of f at observation i is estimated similarly. Additionally, partial derivatives of the marginalized function w.r.t. the features can be computed.
This function requires the mmpf
package to be installed. It is currently not on CRAN, but can
be installed through GitHub using devtools::install_github('zmjones/mmpf/pkg')
.
generatePartialDependenceData(
obj,
input,
features = NULL,
interaction = FALSE,
derivative = FALSE,
individual = FALSE,
fun = mean,
bounds = c(qnorm(0.025), qnorm(0.975)),
uniform = TRUE,
n = c(10, NA),
...
)
obj |
(WrappedModel) |
input |
(data.frame | Task) |
features |
character |
interaction |
( |
derivative |
( |
individual |
( |
fun |
A function which operates on the output on the predictions made on the |
bounds |
( |
uniform |
( |
n |
( |
... |
additional arguments to be passed to |
PartialDependenceData. A named list, which contains the partial dependence, input data, target, features, task description, and other arguments controlling the type of partial dependences made.
Object members:
data |
data.frame |
task.desc |
TaskDesc |
target |
Target feature for regression, target feature levels for classification, survival and event indicator for survival. |
features |
character |
interaction |
( |
derivative |
( |
individual |
( |
Goldstein, Alex, Adam Kapelner, Justin Bleich, and Emil Pitkin. “Peeking inside the black box: Visualizing statistical learning with plots of individual conditional expectation.” Journal of Computational and Graphical Statistics. Vol. 24, No. 1 (2015): 44-65.
Friedman, Jerome. “Greedy Function Approximation: A Gradient Boosting Machine.” The Annals of Statistics. Vol. 29. No. 5 (2001): 1189-1232.
Other partial_dependence:
plotPartialDependence()
Other generate_plot_data:
generateCalibrationData()
,
generateCritDifferencesData()
,
generateFeatureImportanceData()
,
generateFilterValuesData()
,
generateLearningCurveData()
,
generateThreshVsPerfData()
,
plotFilterValues()
lrn = makeLearner("regr.svm")
fit = train(lrn, bh.task)
pd = generatePartialDependenceData(fit, bh.task, "lstat")
plotPartialDependence(pd, data = getTaskData(bh.task))
lrn = makeLearner("classif.rpart", predict.type = "prob")
fit = train(lrn, iris.task)
pd = generatePartialDependenceData(fit, iris.task, "Petal.Width")
plotPartialDependence(pd, data = getTaskData(iris.task))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.