How to get the response variable from gbm model when train.fraction is <1 ?
0
0
Entering edit mode
4.7 years ago
carina2817 ▴ 20

Hello,

I am running gbm function (from GBM R package) and I am setting the option train.fraction to 0.7. I would like to get a vector with the response variable corresponding to this subset. I though this must be saved in one of the variables of the output gbm object but I haven't found it and I don't know if there is a way to get it. Does someone know?

Thanks

R GBM response training • 1.1k views
ADD COMMENT
0
Entering edit mode

If possible provide minimum reproducible example. I would suggest you to explore R tidyModels. Probably function broom::tidy() could solve your problem. See the example below where I used model created by lm() function and later get model details using broom::tidy()

library(tidyverse)
ctl <- c(4.17,5.58,5.18,6.11,4.50,4.61,5.17,4.53,5.33,5.14)
trt <- c(4.81,4.17,4.41,3.59,5.87,3.83,6.03,4.89,4.32,4.69)
group <- gl(2, 10, 20, labels = c("Ctl","Trt"))
weight <- c(ctl, trt)
lm.D9 <- lm(weight ~ group)


lm.D9 %>% broom::tidy()
#> # A tibble: 2 x 5
#>   term        estimate std.error statistic  p.value
#>   <chr>          <dbl>     <dbl>     <dbl>    <dbl>
#> 1 (Intercept)    5.03      0.220     22.9  9.55e-15
#> 2 groupTrt      -0.371     0.311     -1.19 2.49e- 1

Created on 2020-03-25 by the reprex package (v0.3.0)

ADD REPLY

Login before adding your answer.

Traffic: 1946 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6