SLIDE 18 . . . . . .
Inspecting interactions using Friedman’s H-stat
require(gbm) n <- 50 # number of inputs x <- 1:n best.iter <- gbm.perf(gbm.model, plot.it = FALSE, method = "cv") ans <- matrix(nrow = length(x), ncol = length(x)) for (i in 1:length(x)) { for (j in 1:length(x)) { if (i > j) { ans[i,j] <- interact.gbm(gbm.model, data=mydata, i.var =c(x[i],x[j]), n.trees = best.iter) } } }
Interaction Matrix x1 x2 . . . xn x1 na na · · · na x2 0.5 na · · · na . . . . . . . . . ... . . . xn 0.9 0.8 · · · na
Y r s . L i c e n s e d
10 20 30 40 50 60
Hpwr
0.05 0.10 0.15 0.20
partial dependence
5500 6000 6500 7000 7500
(RBC Insurance) Balancing robust statistics... March, 2012 18 / 35