且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

scikit learn 的 SGDClassifier 线程的 predict_proba 方法是否安全?

更新时间:2023-12-02 14:52:34

一句话:是的.

sklearn.linear_model.SGDClassifier 的 predict_proba 方法仅使用输入和权重之间的简单点积,因此它只从类中读取权重.所以你不能因为线程在任何状态相关的问题中运行.

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.

但是,由于 scikit-learn 是用 Python 编写的,您可能会遇到 GIL.

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