[scikit-learn] Estimator.predict() thread safety

Sebastian Raschka mail at sebastianraschka.com
Fri Jun 17 11:18:33 EDT 2016


> I set n_jobs=-1 for both FeatureUnion and estimators/gridsearchers there

I am typically careful with this, e.g., if my machine has 16 cores, I’d set feature union to n_jobs=3 and the gridsearch_cv to n_jobs=4 or so. Curious to hear what the scikit devs think about nesting calls n_jobs=-1; am I too conservative?

Best,
Sebastian

 
> On Jun 17, 2016, at 11:01 AM, Philip Tully <tully at csc.kth.se> wrote:
> 
> Hi all,
> 
> I notice when I train a model and expose the predict function through a web API, predict takes longer to run in a multi-threaded environment than a single-threaded one. I'm guessing the root cause has something to do with thread collisions but I must be doing something incorrectly within the code (I set n_jobs=-1 for both FeatureUnion and estimators/gridsearchers there)
> 
> has someone else ran into a similar issue? I can provide more details if this Q is rather opaque still
> 
> best,
> Philip
> _______________________________________________
> scikit-learn mailing list
> scikit-learn at python.org
> https://mail.python.org/mailman/listinfo/scikit-learn



More information about the scikit-learn mailing list