ModelOriented/iBreakDown

[shap] NA in variable_value column

hbaniecki opened this issue · 0 comments

library("xgboost")
library("DALEX")

model_matrix <- model.matrix(status == "fired" ~ . -1, HR)
data <- xgb.DMatrix(model_matrix, label = HR$status == "fired")

params <- list(max_depth = 2, eta = 1, silent = 1, nthread = 2,
               objective = "binary:logistic", eval_metric = "auc")

model_HR <- xgb.train(params, data, nrounds = 50)

explainer_HR <- explain(model_HR,
                        data = model_matrix,
                        y = HR$status == "fired",
                        verbose = FALSE)

library(iBreakDown)
# this works
break_down(explainer_HR, model_matrix[1,,drop=FALSE])

# this has NA in variable_value (and rownames)
shap(explainer_HR, model_matrix[1,,drop=FALSE])