[R] Which is the final model for a Boosted Regression Trees (GBM)?

Samuel Reuther samuel.reuther at web.de
Sun Dec 7 11:17:52 CET 2014


Hi Kristi,

 

One year later I've been with the same question and found a solution with
the help (see plot.gbm: Marginal plots of fitted gbm objects.)

 

If your GBM-model is gbm1 <-   gbm(y ~ x1+x2, .) one can get the
coefficients for each x with:

 

print(plot(gbm1, i.var=1, n.trees=1000, return.grid=TRUE)) print(plot(gbm1,
2, return.grid=TRUE))

print(plot(gbm1, i.var=2, n.trees=1000, return.grid=TRUE)) print(plot(gbm1,
2, return.grid=TRUE))

 

This includes all trees from 1 to 1000. Without "return.grid=TRUE" the
graphic is shown. Additionally one can see the coefficients for up to 3-way
interactions:

 

print(plot(gbm1, i.var=c(1,2), n.trees=1000, return.grid=TRUE))
print(plot(gbm1, 2, return.grid=TRUE))

 

Hope that helps for others searching for the same thing!

Samuel

 


	[[alternative HTML version deleted]]



More information about the R-help mailing list