bgreenwell/pdp

get_task fails in certain situations for xgboost

bgreenwell opened this issue · 1 comments

Seems like it will fail whever an xgboost model is fit without a params argument:

library(pdp)
library(xgboost)

boston <- pdp::boston
X <- data.matrix(subset(boston, select = -cmedv))
y <- boston$cmedv

set.seed(1612)
bst <- xgboost(X, label = y, nrounds = 100, verbose = 0)

partial(bst, pred.var = "chas", train = X)  # will fail
partial(bst, pred.var = "chas", train = X, type = "regression") 

Need to check if bst$params$objective is NULL first.