-
Notifications
You must be signed in to change notification settings - Fork 26
Open
Description
I found out that varimp() doesn't work with blackboost models.
Code to reproduce the error:
library(mboost)
library(survival)
model <- blackboost(time ~., data=veteran)
vi <- varimp(model)
plot(vi)I wanted to fix it, but it got complicated, see
Lines 8 to 10 in 739cbe9
| learner_names <- if( !(inherits(object, "glmboost")) ) | |
| names(object$baselearner) else variable.names(object) | |
| learner_selected <- object$xselect() |
If learner_names are meant to be variable names, then we could do
if (inherits(object, "blackboost")) {
learner_names <- object$baselearner[[1]]$get_names()
}But then, object$xselect() returns a vector of only ones, should this be the case?
model$xselect()
[1] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
[39] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
[77] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1With glmboost, everything seems to work fine?
model <- glmboost(time ~ ., data = veteran)
vi <- varimp(model)
model$xselect()
[1] 7 7 7 7 7 7 7 3 4 3 7 4 3 4 3 4 7 3 4 3 4 7 3 4 3
[26] 4 7 3 4 3 4 7 3 4 3 4 7 3 4 7 10 4 3 6 4 3 7 6 4 3
[51] 10 4 6 7 3 4 10 6 7 3 4 6 3 4 2 10 7 6 2 4 3 7 10 6 5
[76] 4 3 5 4 3 2 7 6 5 4 3 5 4 10 6 7 3 5 4 2 3 5 4 6 7
plot(vi)Metadata
Metadata
Assignees
Labels
No labels

