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

predict_parts survshap runs out of memory when p >= 17 #25

Closed
hbaniecki opened this issue Jan 13, 2023 · 1 comment
Closed

predict_parts survshap runs out of memory when p >= 17 #25

hbaniecki opened this issue Jan 13, 2023 · 1 comment
Assignees
Labels
invalid ❕ This doesn't seem right

Comments

@hbaniecki
Copy link
Member

hbaniecki commented Jan 13, 2023

For p=17, this line produces a square matrix of dim [131072, 131072]

W <- diag(shap_kernel_weights)

See rnorm(131072*131072).

Source:

library(survival)
library(survex)
library(ranger)

N <- 100
P <- 17

X <- matrix(rnorm(N*P), ncol=P, nrow=N)
time <- rnorm(N)
status <- rbinom(N, 1, 0.5)
df <- cbind(data.frame(time=time, status=status), data.frame(X))

dim(df)

model <- ranger(Surv(time, status) ~ ., data = df, num.trees = 50)

explainer <- explain(model, data = df[, -c(1, 2)], y = Surv(df$time, df$status))

model_performance(explainer)

predict_parts(explainer, df[1, -c(1, 2)])
# Error: cannot allocate vector of size 128.0 Gb
@hbaniecki hbaniecki added the invalid ❕ This doesn't seem right label Jan 13, 2023
@krzyzinskim krzyzinskim self-assigned this Feb 10, 2023
@krzyzinskim
Copy link
Collaborator

Fixed with #26

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
invalid ❕ This doesn't seem right
Projects
None yet
Development

No branches or pull requests

2 participants