Skip to content Skip to sidebar Skip to footer

Is The Predict_proba Method Of Scikit Learn's Sgdclassifier Thread Safe?

I would like to expose a model built using sklearn.linear_model.SGDClassifier through a web API. Every web request would call into the predict_proba method of the model, however I

Solution 1:

In one word: yes.

sklearn.linear_model.SGDClassifier's predict_proba method uses just a simple dot product between input and weights and therefore it only reads the weights from the class. So you can't run in any state related problems due to threads.

However, as scikit-learn is written in python, you might have some trouble with the GIL.

Post a Comment for "Is The Predict_proba Method Of Scikit Learn's Sgdclassifier Thread Safe?"