Closed giacomog99 closed 1 year ago
Hi! I would like to know If the shapr explanation package can work with lighGBM model. I created this model:
train_id <- createDataPartition(bank$deposit, p = .8, list = FALSE)
train = bank[train_id, ] test = bank[-train_id, ]
trainm = sparse.model.matrix(deposit ~., data = train) train_label = train[,"deposit"]
testm = sparse.model.matrix(deposit~., data= test) test_label = test[,"deposit"]
train_matrix = lgb.Dataset(data = as.matrix(trainm), label = train_label) test_matrix = lgb.Dataset(data = as.matrix(testm), label = test_label)
params = list(learning_rate = 0.01, objective = "binary")
model = lightgbm(params = params, data = train_matrix, nrounds = 1000)
and now I want to use shapr explanation that I've already used for XGBoost but I'm not sure if I can use also for lightGBM
Thank you!
Hi
Yes, you can. You just need to make the prediction function yourself, see the vignette: https://norskregnesentral.github.io/shapr/articles/understanding_shapr.html#explain-custom-models
Hi! I would like to know If the shapr explanation package can work with lighGBM model. I created this model:
data preparation
train_id <- createDataPartition(bank$deposit, p = .8, list = FALSE)
train = bank[train_id, ] test = bank[-train_id, ]
train and test matrix
trainm = sparse.model.matrix(deposit ~., data = train) train_label = train[,"deposit"]
testm = sparse.model.matrix(deposit~., data= test) test_label = test[,"deposit"]
train_matrix = lgb.Dataset(data = as.matrix(trainm), label = train_label) test_matrix = lgb.Dataset(data = as.matrix(testm), label = test_label)
model parameters
params = list(learning_rate = 0.01, objective = "binary")
model training
model = lightgbm(params = params, data = train_matrix, nrounds = 1000)
and now I want to use shapr explanation that I've already used for XGBoost but I'm not sure if I can use also for lightGBM
Thank you!