Learn R Programming

mlr (version 2.7)

generatePartialPredictionData: Generate partial predictions

Description

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.

Usage

generatePartialPredictionData(obj, input, features, interaction = FALSE,
  derivative = FALSE, individual = FALSE, center = NULL, fun = mean,
  bounds = c(qnorm(0.025), qnorm(0.975)), resample = "none", fmin, fmax,
  gridsize = 10L, ...)

Arguments

Value

[PartialPredictionData], A named list, which contains the partial predictions, input data, target, features, task description, and other arguments controlling the type of partial predictions made.

References

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.

See Also

Other generate_plot_data: generateCalibrationData, generateCritDifferencesData, generateFilterValuesData, generateLearningCurveData, generateROCRCurvesData, generateThreshVsPerfData, getFilterValues

Other partial_prediction: plotPartialPredictionGGVIS, plotPartialPrediction

Examples

Run this code
lrn = makeLearner("regr.rpart")
fit = train(lrn, bh.task)
pd = generatePartialPredictionData(fit, bh.task, "lstat")
plotPartialPrediction(pd)

lrn = makeLearner("classif.rpart", predict.type = "prob")
fit = train(lrn, iris.task)
pd = generatePartialPredictionData(fit, iris.task, "Petal.Width")
plotPartialPrediction(pd)

Run the code above in your browser using DataLab