scikit-learn n_jobs在双CPU 28核计算机上启动数百个线程

时间:2019-06-10 15:22:20

标签: linux python-3.x parallel-processing scikit-learn random-forest

我对API docs is that n_jobs should control the number of threads that is started by the fit() and predict() methods的理解。我的笔记本电脑(MacBook Pro四核i7)确实是这种情况,但是当我在具有2个14核Xeon CPU的Linux服务器上运行相同的代码时,我可以看到python进程正在生成数百个线程。有什么事吗?

def getRFClassifier():
return RandomForestClassifier(n_estimators=args.ntrees, min_samples_leaf=10, n_jobs=args.nthreads, class_weight="balanced_subsample")

我有ntrees=1000nthreads=-2(我也尝试过-1并将其数目减少到20),我仍然得到比预期更多的方法。

培训开始之前: enter image description here

之后: enter image description here

我可能会丢失任何东西吗?

0 个答案:

没有答案