I am trying to extract the relative influence of each variable from a gbm.fit object but it is coming up with the error below:
> summary(boost_cox, plotit = FALSE)
Error in data.frame(var = object$var.names[i], rel.inf = rel.inf[i]) :
row names contain missing values
The boost_cox
object itself is fitted as follows:
boost_cox = gbm.fit(x = x,
y = y,
distribution="coxph",
verbose = FALSE,
keep.data = TRUE)
I have to use the gbm.fit
function rather than the standard gbm
function due to the large number of predictors (26k+)
I have solve this issue now myself.
The relative.influence()
function can be used and works for objects created using both gbm()
and gbm.fit()
. However, it does not provide the plots as in the summary()
function.
I hope this helps anyone else looking in the future.