This is a barebone implementation of Friedman's partial dependence
intended for developers. To get more information on partial dependence, see
partial_dependence().
Vector of partial dependence values in the same order as grid.
Arguments
object
Fitted model.
v
Variable name in data to calculate partial dependence.
data
Matrix or data.frame.
grid
Vector or factor of values to calculate partial dependence for.
pred_fun
Prediction function, by default stats::predict.
The function takes three arguments (names irrelevant): object, data, and ....
trafo
How should predictions be transformed?
A function or NULL (default). Examples are log (to switch to link scale)
or exp (to switch from link scale to the original scale).
Applied after which_pred.
which_pred
If the predictions are multivariate: which column to pick
(integer or column name). By default NULL (picks last column). Applied before
trafo.
w
Optional vector with case weights.
...
Further arguments passed to pred_fun(), e.g., type = "response" in
a glm() or (typically) prob = TRUE in classification models.
References
Friedman, Jerome H. 2001, Greedy Function Approximation: A Gradient Boosting Machine.
Annals of Statistics 29 (5): 1189-1232. doi:10.1214/aos/1013203451.