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

Slow mutate_if() #36

Closed
mayer79 opened this issue Mar 12, 2024 · 1 comment
Closed

Slow mutate_if() #36

mayer79 opened this issue Mar 12, 2024 · 1 comment
Assignees

Comments

@mayer79
Copy link
Contributor

mayer79 commented Mar 12, 2024

The calculations of {randomForest} models lose a significant amount of time in mutate_if() calls. Replacing them by an explicit mutate() is easy, and gives a clear speed-up:

library(randomForest)
library(randomForestExplainer)

set.seed(12)

fit <- randomForest(Sepal.Width~., data = iris)
fit2 <- ranger(Sepal.Width~., data = iris)

system.time( # 2.1 seconds with mutate_if() -> 0.8 seconds with mutate()
out <- min_depth_distribution(fit)
)

@mayer79
Copy link
Contributor Author

mayer79 commented Mar 14, 2024

Done in #37

@mayer79 mayer79 closed this as completed Mar 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant