Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fastshap: Error in dimnames(x) <- dn : length of 'dimnames' [2] not equal to array extent #77

Open
bellalauys opened this issue Jul 5, 2024 · 1 comment

Comments

@bellalauys
Copy link

bellalauys commented Jul 5, 2024

Hi @bgreenwell ,

I have tried to run fastshap on my dataset with more than 120 features and 490,000 rows. However, it keeps having such error pop up " Error in dimnames(x) <- dn : length of 'dimnames' [2] not equal to array extent"

(rf <- ranger(Y ~ ., data = Z, probability = TRUE, write.forest = TRUE))

pfun <- function(object, newdata) { # prediction wrapper
unname(predict(object, data = newdata, type = "response")$predictions[, 1])
}

install.packages("doParallel")
library(doParallel)

registerDoParallel(cores = 20) # use forking with 12 cores

shap <- fastshap::explain(rf, X = X1, pred_wrapper = pfun, newdata = random_row, parallel = TRUE)

Does anyone know how to solve this issue?

@bgreenwell
Copy link
Owner

Hi @bellalauys, thanks for posting your issue. Can you post a reproducible example to run on my end?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants