bgreenwell / pdp

A general framework for constructing partial dependence (i.e., marginal effect) plots from various types machine learning models in R.
http://bgreenwell.github.io/pdp
91 stars 12 forks source link

Is it possible to do pdp for an xgboost count::poisson? I get the following error: #123

Open Martafenix opened 2 years ago

Martafenix commented 2 years ago

image

bgreenwell commented 2 years ago

Hi @Martafenix, yes you certainly can. Here’s an example: https://github.com/bgreenwell/pdp/blob/master/slowtests/slowtests-mtcars.R. Not sure why you’re getting an error though without seeing a reproducible example.

Martafenix commented 2 years ago

My matrix is built like this, maybe that's why:

dt_train <- train_data %>% select(-all_of(vars_to_remove)) %>% as.matrix() %>% xgboost::xgb.DMatrix(label = target_train, weight = weight_train)

bgreenwell commented 2 years ago

Are you able to post a short reproducible example @Martafenix? If so, I'd be happy to provide the fix.