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 of CARET preProcess not working within furrr future_map #72

Closed
Gomesdrg opened this issue May 30, 2019 · 3 comments
Closed

predict of CARET preProcess not working within furrr future_map #72

Gomesdrg opened this issue May 30, 2019 · 3 comments

Comments

@Gomesdrg
Copy link

Gomesdrg commented May 30, 2019

Having trouble running a function within future_map that runs fine on its own.

This predict of a preProcess model (KNNImpute) from Caret works fine on its own.

library(caret)
fullNetworkImpute <- predict(missingdata_model, newdata = fullNetwork)

Hoping to use furrr as the newdata i need to predict for is very large and want to parrallelize.

Tried to run this...

library(caret)
library(furrr)
plan(multiprocess)
fullNetworkImpute <- future_map(rep(1, 10), ~predict(missingdata_model, newdata = fullNetwork))

and got error message...

Error in UseMethod("predict") :
no applicable method for 'predict' applied to an object of class "preProcess"

Look forward to your suggestions!

Thanks in advance!!!

@DavisVaughan
Copy link
Collaborator

Can you please provide a reproducible example, using the reprex package?

I have a feeling the issue is that caret isn't loaded in each worker, because predict() on its own isn't enough to know that the predict.preProcess method is being called.

Nevertheless, this doesn't look like it will be very efficient. It looks like you are trying to move the full model and the full data set to each worker, and subset the data set on the worker and then predict and return the predictions. All of that data shuffling is likely going to be more expensive than just doing it normally

@Gomesdrg
Copy link
Author

Gomesdrg commented May 31, 2019 via email

@DavisVaughan
Copy link
Collaborator

Closed in favor of tracking futureverse/globals#46

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